Discussion:
[Bitpim-devel] Phone programming status
Stephen Wood
2004-03-03 02:33:16 UTC
Permalink
I rushed the SCP-5500 support to get it into this latest test release.
As a result, it has a feature in which writing to the phonebook on the
phone will sometimes throw an exception. Repeating the "Send Phone
Data" operation WITHOUT rebooting the phone, usually succeeds.

I believe what happens is that when the phone is put into programming
mode, it is actually not ready to accept data. A phonebook entry
written to the phone returns with the first few bytes of the packet,
prepended with at 0x18, likely some kind of not-ready error code. I
thought of either just waiting several seconds or handing the 0x18 error
code when I recalled that the QCPLINK (http://qcplink.sourceforge.net/)
protocol document describes a way to check the programming status by
sending a packet with 0x0c in it (plus checksum and 7e). The return
packet contains the ESN as well as 4 bytes that change value if the 0x0c
command is repeatedly sent just after putting the phone into programming
mode.

I tried this on my Sanyo phones and the packet returned the esn and 4
flags in exactly the same place as the QCP-2760 phone used in the
qcplink project. (The Sanyo packets have less padding at the end.)

If I poll rapidly after putting the phone in write mode, the 4 flags
change state at different times. So I just chose the flag that changed
last and used that to determine when it is safe to write to the phone.

This trick seems to work on the phones I tried it on, 4900, 8100, and
5500. Perhaps it might be of use to other phones

Stephen

PACKET statusrequest:
1 UINT {'constant': 0x0c} +command

PACKET statusresponse:
P UINT {'constant': 0x0} readyvalue
1 UINT command
3 UNKNOWN dunno1
4 UINT esn
1 UINT flag0
14 UNKNOWN dunno2
1 UINT ready
1 UINT dunno3
1 UINT flag2
6 UINT dunno4
1 UINT flag3
* UNKNOWN unknown

def writewait(self):
"""Loop until phone status indicates ready to write"""
for i in range(100):
req=self.protocolclass.statusrequest()
res=self.sendpbcommand(req,
self.protocolclass.statusresponse)
# print res.flag0, res.ready, res.flag2, res.flag3
if res.ready==res.readyvalue:
return
time.sleep(0.1)

self.log("Phone did not transfer to ready to write state")
self.log("Waiting a bit longer and trying anyway")
return
Roger Binns
2004-03-04 00:41:09 UTC
Permalink
Post by Stephen Wood
protocol document describes a way to check the programming status by
sending a packet with 0x0c in it (plus checksum and 7e).
The LG phones don't have the 'not ready issue'. For the 4400 and 6000
I don't even send the start sync command (which requires a reboot at the
end).

I do wonder if this is all to do with buffer management.

Roger

Loading...