[RFC] m241: Add greeting and goodbye

View: New views
6 Messages — Rating Filter:   Alert me  

[RFC] m241: Add greeting and goodbye

by Stefan Bauer-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,


this patch adds some PHLX commands to the mtk_rd_init() and mtk_rd_deinit()
functions to make the Holux GR 245 display a nice "USB PROCESSING..." message
while downloading.

The commands were extracted from the following snoop created with ezTour:
<http://freenet-homepage.de/yoltia/holux-gr245/snoop_ascii.log>

Is it ok to send these commands for every device or should I check for
mtk_device == HOLUX_GR245? It would be nice if someone owning a m241 (or any
other device using m241 fmt) could test if the new commands succeeding and not
producing any harm.


Regards,
Stefan Bauer

[gr245_init.patch]

Index: mtk_logger.c
===================================================================
RCS file: /cvsroot/gpsbabel/gpsbabel/mtk_logger.c,v
retrieving revision 1.18
diff -u -r1.18 mtk_logger.c
--- mtk_logger.c 7 Sep 2009 21:23:06 -0000 1.18
+++ mtk_logger.c 13 Sep 2009 18:16:38 -0000
@@ -414,9 +414,17 @@
     if ( rc != 0 )
       fatal(MYNAME ": This is not a MTK based GPS ! (or is device turned off ?)\n");
 
+    rc |= do_cmd("$PHLX810*35\r\n", "PHLX852,", NULL, 10);
+    rc |= do_cmd("$PHLX826*30\r\n", "PHLX859*38", NULL, 10);
+    if (rc != 0)
+      dbg(2, "Greeting not successfull.\n");
  }
 
 static void mtk_rd_deinit(void){
+    int rc = do_cmd("$PHLX827*31\r\n", "PHLX860*32", NULL, 10);
+    if (rc != 0)
+      dbg(2, "Goodbye not successfull.\n");
+
     dbg(3, "Closing port...\n");
     gbser_deinit(fd);
     fd = NULL;


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
Gpsbabel-code@...
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code

Re: [RFC] m241: Add greeting and goodbye

by Robert Lipe-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Actually, this patch hoses m241 in an interesting way.

./gpsbabel -t -D9 -i m241 -f /dev/cu.serial-0001
Send $PMTK605*31
 Read 42 bytes: '$PMTK705,B-core_1.20,0023,01017-00D,1.0*76'
NMEA command success !
Send $PHLX810*35   We send your new command
 Read 16 bytes: '$PMTK001,-1,0*1F'
RECV: '$PMTK001,-1,0*1F'   I'm guessing this is a NAK, but we don't recognize it as such.
Read 80 bytes: '$GPGGA,135644.000,3549.4974,N,08650.8277,W,2,9,0.85,261.0,M,-31.4,M,0000,0000*62'
[ we spin, reading 10 seconds of NMEA chatter ]
NMEA command '$PHLX810*35
' timeout   Eventually, we give up
Send $PHLX826*30
 Read 58 bytes: '$GPGSA,A,3,23,32,16,29,20,31,13,25,03,,,,1.15,0.85,0.78*0F'
Read 68 bytes: '$GPGSV,3,1,10,16,80,086,34,23,51,319,39,32,44,215,26,20,43,249,26*75'
Read 68 bytes: '$GPGSV,3,2,10,31,36,060,34,48,26,240,30,03,17,165,26,25,16,279,25*7A'
Read 42 bytes: '$GPGSV,3,3,10,13,12,313,24,29,08,042,19*73'
Read 68 bytes: '$GPRMC,135654.000,A,3549.4977,N,08650.8279,W,0.09,0.00,140909,,,D*7C'
Read 35 bytes: '$GPVTG,0.00,T,,M,0.09,N,0.17,K,D*37'
Read 16 bytes: '$PMTK001,-1,0*1F'
RECV: '$PMTK001,-1,0*1F'  We repeat for the second message
[ another 10 seconds pass ]

So I think you need to test for the NAK case and not make the 'greeting successful' dependent upon thse apparently optional commands.

Also, is this device really the stupidest possible USB device?   It transfers track logs as hex encoded text (thus ensuring that every byte takes two bytes) over USB at 38.4kbits a second?  Run a 12Mbit/sec bus at 38Kbits/sec and then throw away half the the bandwidth again for a lame encoding?  Seriously?

RJL


On Sun, Sep 13, 2009 at 1:31 PM, Stefan Bauer <yoltia-maintain@...> wrote:
Hello,


this patch adds some PHLX commands to the mtk_rd_init() and mtk_rd_deinit()
functions to make the Holux GR 245 display a nice "USB PROCESSING..." message
while downloading.

The commands were extracted from the following snoop created with ezTour:
<http://freenet-homepage.de/yoltia/holux-gr245/snoop_ascii.log>

Is it ok to send these commands for every device or should I check for
mtk_device == HOLUX_GR245? It would be nice if someone owning a m241 (or any
other device using m241 fmt) could test if the new commands succeeding and not
producing any harm.


Regards,
Stefan Bauer

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
Gpsbabel-code@...
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
Gpsbabel-code@...
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code

Re: [RFC] m241: Add greeting and goodbye

by P. Borgentun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>
> So I think you need to test for the NAK case and not make
> the 'greeting successful' dependent upon thse
> apparently optional commands.
>
Well, from the looks from the GR245 logfile it seems that even
the target device will return NAK on these commands.
All sent $PHLX commands return $PHLX___ followed by a $PMTK001,-1,0*1F.

Note that there is a bug/problem in the current mtk_logger do_cmd()
function. Sending a $PMTK182 command will return both  PMTK182
response followed by PMTK001 ACK. As the commands are sent sequentially
and reading/parsing is done until expected response is returned - the
next command sent will find the previous command ACK as the first data
and the command seems to fail since the cmd/response are out of sync.

>
> Also, is this device really the stupidest possible USB
> device?   It transfers track logs as hex encoded text
> (thus ensuring that every byte takes two bytes) over USB at
> 38.4kbits a second?  Run a 12Mbit/sec bus at 38Kbits/sec
> and then throw away half the the bandwidth again for a lame
> encoding?  Seriously?
>
Originally it make sense at least, you're using NMEA (like) protocol
for the entire transfer and don't have to detect and switch to a binary
protocol for the download phase. NMEA is a plaintext only.
Unfortunately Holux has made several devices based on the MTK chipset and
 'improved' the logformat/protocol
- i.e save 1 byte on log reason and then use "HOLUXGR245WAYPNT    " as
a header before each waypoint...
The choice of using 38.4k for transfer speed, hmmm, it seems to be inline
with all other design decision by Holux.

/Devlin



     

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
Gpsbabel-code@...
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code

Re: [RFC] m241: Add greeting and goodbye

by Stefan Bauer-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 14 September 2009 16:17:05 you wrote:

> Actually, this patch hoses m241 in an interesting way.
>
> ./gpsbabel -t -D9 -i m241 -f /dev/cu.serial-0001
> Send $PMTK605*31
>  Read 42 bytes: '$PMTK705,B-core_1.20,0023,01017-00D,1.0*76'
> NMEA command success !
> Send $PHLX810*35   We send your new command
>  Read 16 bytes: '$PMTK001,-1,0*1F'
> RECV: '$PMTK001,-1,0*1F'   I'm guessing this is a NAK, but we don't
> recognize it as such.
You're right. From your google-spreadsheet [1], "Holux commands" page: "As the
MTK device does not understand these commands, each holux command results in
a $PMTK001,-1,0*1F reply." I got these $PMTK001,-1,0*1F, too, but preceeded
by PHLX852 as described at "PHLX (M-1000C)" page.

So we can state M241 does not support/need such a greeting.

> [PHLX826*30 fails]
>
> So I think you need to test for the NAK case and not make the 'greeting
> successful' dependent upon thse apparently optional commands.

Given the following:
- Greeting only has a benefit only to GR245
- Greeting is only supported by GR245
My suggestion is to send it only if a GR245 is detected in favor of touching
the mtk_read() function to detect these NACK packages (see attached second
version of the patch).

Did the goodbye work on your M241?


Regards,
Stefan

[1]
<http://spreadsheets.google.com/pub?key=pyCLH-0TdNe-5N-5tBokuOA>


[attachment removed]
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
Gpsbabel-code@...
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code

Re: [RFC] m241: Add greeting and goodbye

by Stefan Bauer-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Montag, 14. September 2009 schrieb Stefan Bauer:

> > [PHLX826*30 fails]
> >
> > So I think you need to test for the NAK case and not make the 'greeting
> > successful' dependent upon thse apparently optional commands.
>
> Given the following:
> - Greeting only has a benefit only to GR245
> - Greeting is only supported by GR245
> My suggestion is to send it only if a GR245 is detected in favor of
> touching the mtk_read() function to detect these NACK packages

I wanted to say do_cmd() instead of mtk_read().

--Stefan



------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
Gpsbabel-code@...
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code

Re: [RFC] m241: Add greeting and goodbye

by Robert Lipe-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Devlin's analysis of the problem seems sane to me.   I'll let you two work out a solution on that.

On Mon, Sep 14, 2009 at 4:23 PM, Stefan Bauer <yoltia-maintain@...> wrote:

- Greeting only has a benefit only to GR245
- Greeting is only supported by GR245
My suggestion is to send it only if a GR245 is detected in favor of touching
the mtk_read() function to detect these NACK packages (see attached second
version of the patch).

I'm hip with that.  It seems to penalize the m241 much less.   If Devlin OKs it, I'll commit it.
 
Did the goodbye work on your M241?

I wasn't that patient.   If the hello failed, it never really filled me with curiosity that the goodbye would succeed.

$ time ./gpsbabel -D2 -t -i m241 -f /dev/cu.serial-0001
GPSBabel Version: 1.3.7-beta20090906
options: module/option=value: m241/erase="0" (=default)
options: module/option=value: m241/erase_only="0" (=default)
options: module/option=value: m241/log_enable="0" (=default)
Opening port /dev/cu.serial-0001...
Verifying MTK based device...
Download /dev/cu.serial-0001 -> data.bin
NMEA command '$PMTK182,5*20
' failed - Valid packet but action failed
Download 1664kB from device
Reading 0x196800 100 %
Note !!! -- Logging is DISABLED !
Invalid initial log policy 0x0102 - check next block
Default Bitmask 0000001d, Log every 1 sec, 0 m, 0 km/h
71906: Bad CRC ff != 02 (pos 0x11b400)
72087: Bad CRC ff != 9b (pos 0x11c000)
72150: Bad CRC ff != 26 (pos 0x11c400)
72277: Bad CRC ff != ea (pos 0x11cc00)
72404: Bad CRC ff != 48 (pos 0x11d400)
[ more scary stuff implying I need to reset my unit... ]
72782: Bad CRC 0c != 1f (pos 0x11ec00)
72783: Bad CRC 06 != 12 (pos 0x11ec00)
# Log period change 1 sec
# Log distance change 30.4 m
# Log period change 1 sec
# Log distance change 0.0 m
cet_util: Converting from "US-ASCII" to "UTF-8", done.
cet_util: Converting from "UTF-8" to "US-ASCII", done.

real    18m18.565s
user    0m8.577s
sys    0m17.927s



------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
Gpsbabel-code@...
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code