pygarmin eTrex Legend comm problems

R

Robert Brewer

Hello,

I realize I'm a bit over my head, here, but I'm trying to pull waypoint
data from a Garmin eTrex Legend, and having mixed success. On a Win98
box last night, I was able to connect and (after a small hack [1]) grab
the waypoints easily.

Today, trying the same procedure on a Win2k Pro, I can connect (after
more hacking [2]), but I can't get getWaypoints [3]. I've tried multiple
versions of win32all (v163 and v201) but no change.

So, here's the hacks and output:

[1] This is the hack to garmin.FormatA001. I narrowed the NameError to
simply pass over unknown protocols rather than raise an exception, so I
could (or so I thought) continue with known protocols.

def FormatA001(protocols):
"""This is here to get the list of strings returned by A001 into
the same format as used in the ModelProtocols dictionary"""

## try:
phys = eval(protocols[0])
link = eval(protocols[1])
cmnd = eval(protocols[2])

tuples = {"1" : None, "2" : None, "3" : None, "4" : None,
"5" : None, "6" : None, "7" : None, "8" : None,
"9" : None}
last_seen = None
for i in range(3, len(protocols)):
p = protocols
if p[0] == "A":
pclass = p[1]
if tuples[pclass] == None:
tuples[pclass] = []
last_seen = tuples[pclass]
try:
last_seen.append(eval(p))
except NameError:
pass
## except NameError:
## print sys.exc_info()[2]
## raise NameError, "Protocol %s not supported yet!" %
sys.exc_info()[1]
return (None, link, cmnd, tuples["1"], tuples["2"], tuples["3"],
tuples["4"], tuples["5"])


[2] Then, I was having problems with win32file.ReadFile not filling the
buffer. So I rewrote garmin.Win32SerialLink as follows (which got me the
protocol list from A001):

def read(self, n):
## buffer = win32file.AllocateReadBuffer(n)
## rc, data = win32file.ReadFile(self.f, buffer)
## if len(data) != n:
## raise StandardError("time out", rc, n, map(ord, data))
## return data
data = ""
while 1:
rc, chars = win32file.ReadFile(self.f, n, None)
data += chars
if len(data) >= n:
break
if len(chars) == 0:
raise LinkException, "timeout"
return data


[3] So here's the interactive output (garmin.debug = 6):
C:\Python23\lib\site-packages\pygarmin\garmin.py:901: FutureWarning:
hex/oct constants > sys.maxint will return positive values in Python 2.4
and up
ete = 0xffffffff # Estimated time en route in seconds to next
waypoint
C:\Python23\lib\site-packages\pygarmin\garmin.py:1475: FutureWarning:
hex/oct constants > sys.maxint will return positive values in Python 2.4
and up
timeouts = 0xFFFFFFFF, 0, 1000*secs, 0, 1000*secs< packet 254 :
(>ack) > packet 6 : fe 00
packet 255 : b3 00 68 01 65 54 72 65 78 20 4c 65 67 65 6e 64 20 53 6f
66 74 77 61 72 65 20 56 65 72 73 69 6f 6e 20 33 2e 36 30 00 56 45 52 42
4d 41 50 20 41 6d 65 72 69 63 61 73 20 48 69 67 68 77 61 79 20 32 2e 30
30 00 56 45 52 53 4d 41 50 20 41 6d 65 72 69 63 61 73 20 4d 61 72 69 6e
65 20 50 4f 49 20 31 2e 30 30 00
(<ack) < packet 6 : ff 00
id, ver, desc = 179 3.6 ['eTrex Legend Software Version 3.60', 'VERBMAP
Americas Highway 2.00', 'VERSMAP Americas Marine POI 1.00']
Get supported protocols
Try reading protocols using PCP
packet 253 : 50 00 00 4c 01 00 41 0a 00 41 64 00 44 6c 00 41 c9 00 44
ca 00 44 6c 00 44 d2 00 41 2d 01 44 36 01 44 2d 01 41 f4 01 44 f5 01 41
58 02 44 58 02 41 bc 02 44 bc 02 41 20 03 44 20 03 41 22 03 44 22 03 41
84 03 41 86 03 41 87 03
(<ack) < packet 6 : fd 00
Protocols reported by A001: ['P000', 'L001', 'A010', 'A100', 'D108',
'A201', 'D202', 'D108', 'D210', 'A301', 'D310', 'D301', 'A500', 'D501',
'A600', 'D600', 'A700', 'D700', 'A800', 'D800', 'A802', 'D802', 'A900',
'A902', 'A903']< packet 10 : 07 00
(>ack) resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
resync - expected DLE and got something else
packet 35 : 00 ff 00 60 12 00 00 00 00 00 00 00 ff ff ff ff ff ff ff
ff ff ff ff ff 1e 45 26 17 87 d9 d7 ac 30 c2 2a 43 51 59 04 69 51 59 04
69 20 20 20 20 30 30 32 00 00 00 00 00 00
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python23\lib\site-packages\pygarmin\garmin.py", line 1535, in
getWaypoints
return self.wptLink.getData(callback)
File "C:\Python23\lib\site-packages\pygarmin\garmin.py", line 372, in
getData
self.link.Pid_Wpt_Data)
File "C:\Python23\lib\site-packages\pygarmin\garmin.py", line 313, in
getData
self.link.sendPacket(self.link.Pid_Command_Data, cmd)
File "C:\Python23\lib\site-packages\pygarmin\garmin.py", line 118, in
sendPacket
self.readAcknowledge(ptype)
File "C:\Python23\lib\site-packages\pygarmin\garmin.py", line 163, in
readAcknowledge
raise LinkException, "Acknowledge error"
Link Error: Acknowledge error


I'm out of ideas on where to dig next. I'm not a guru when it comes to
win32. Any ideas (or outright fixes ;) would be greatly appreciated.


Robert Brewer
MIS
Amor Ministries
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top