Stu Grossman
2004-08-13 16:21:48 UTC
It seems that under some circumstances, the phone will escape
characters other than 0x7e and 0x7d. I've run into a case where it
escapes 0x7f (which looks like 0x7d 0x5f in the raw). Unescape
doesn't handle this, so it gets passed through untouched, which then
causes bad crcs.
Since the escaping scheme looks something like byte-oriented PPP/HDLC,
I think it's probably reasonable to assume that 0x7d can escape
anything that follows it.
FYI, with this fixed, I can reliably do filesystem ops from my debian
system to a Samsung SCH-A650 using a simple USB cable.
def unescape(data):
esc=0
res=""
for d in data:
if d=="\x7d":
esc=0x20
else:
res+=chr(ord(d)^esc)
esc=0
return res
characters other than 0x7e and 0x7d. I've run into a case where it
escapes 0x7f (which looks like 0x7d 0x5f in the raw). Unescape
doesn't handle this, so it gets passed through untouched, which then
causes bad crcs.
Since the escaping scheme looks something like byte-oriented PPP/HDLC,
I think it's probably reasonable to assume that 0x7d can escape
anything that follows it.
FYI, with this fixed, I can reliably do filesystem ops from my debian
system to a Samsung SCH-A650 using a simple USB cable.
def unescape(data):
esc=0
res=""
for d in data:
if d=="\x7d":
esc=0x20
else:
res+=chr(ord(d)^esc)
esc=0
return res