Discussion:
[BitPim-devel] phone detect changes needed
Roger Binns
2005-04-18 05:53:48 UTC
Permalink
Joe,

In order to do LG phone detect I need one of two things:

- Some way of tying together the modem and diagnostics
ports which show up as different com ports or even
completely different device drivers. This would reqiure
heroic platform specific effort

- Be able to send a LG phonebook command - this is not
the Brew protocol but similar and sent while in Brew mode

The first would be nice since the other AT commands are then
available (eg battery level) but way too hard most of the time.

In order to do the second, please make the following changes:

- Include the comscan information with the dict passed to
detectphone

- Ideally only pass the phone module ports that it considers
ok (ie comdiagnose.islikelyport returns true)

- Run the detectphone function in the worker thread not the
main thead

The last bit is needed because I will change the LG phone modules
to send the phonebook init command and record it against each
passed in port in the phonedetect dict if it isn't already there.
The key added will be something like 'lgphonebookinit' and will
be binary data.

This is what it looks like to give an idea. The 4 bytes preceding
the 'LG-VX...' are the ESN and the actual location of the text
identifier varies by model.

BTW please make sure we don't actually store the ESN anywhere.
It is a relatively private and useful piece of information.
(Imagine there is some spyware that comes along and extracts
it out of where BitPim was keeping it - we'd have done nothing
wrong but still get blamed). We should always make an effort
to obfuscate it, with my preference being to SHA-1 it. That
way you can always tell if you have seen it before, but can't
tell by inspection what it is.

19:57:09.358 LG-VX8000: lg phonebook request Data - 10 bytes
<#! p_lg.pbinforequest !#>
000 ff 15 01 01 00 00 00 00 00 00 ..........
19:57:09.358 LG-VX8000: lg phonebook response Data - 402 bytes
<#! p_lg.pbinforesponse !#>
000 ff 15 01 00 00 00 00 00 58 00 01 01 00 00 01 00 ........X.......
010 00 00 c6 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
020 00 00 00 00 00 00 00 00 f4 01 2c 01 00 00 00 00 ..........,.....
030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4a bc ..............J.
040 20 23 4c 47 2d 56 58 38 30 30 30 43 6f 6e 6e 65 #LG-VX8000Conne
050 63 74 6f 72 00 00 00 00 00 00 00 00 00 00 00 00 ctor............
060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
080 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
190 67 00 g.

Roger
Joe Pham
2005-04-18 06:32:39 UTC
Permalink
Not a problem.

I was just curious: what's involved of handling the dual-port issue at the BitPim app level instead of at the OS level?

-Joe Pham



______________________________________________________________________
Speed up your surfing with NetZero HiSpeed.
Now includes pop-up blocker!
Only $14.95/month -visit http://www.netzero.com/surf to sign up today!
Roger Binns
2005-04-18 06:56:26 UTC
Permalink
Post by Joe Pham
I was just curious: what's involved of handling the dual-port issue
at the BitPim app level instead of at the OS level?
The problem is that the LG phones are USB composite devices. The first(*)
USB interface is of modem class. The second interface is bulk data and is
of 'vendor specific protocol' class, aka the diagnostics interface.

In Windows, a USB device node is created for the overal composite device
and then each interface appears as a seperate device and has a totally
seperate driver. It will also have a seperate COM port number and the
first interface will show up as a modem and the second as a serial port.
The COM port numbers are usually sequential but don't have to be. The
only way you could link them is by examining the hardware id that Windows
assigns, although even that won't work well if you have two LG phones
plugged in since you can't tell them apart. USB devices can have serial
numbers which Windows will then use to ensure the settings follow the
device, as opposed to having seperate settings for each place the device
is plugged in. For whatever reason LG don't provide a USB level serial
number.

On Linux and Mac, the modem interface is detected and automatically
assigned a USB modem device driver. The second interface is ignored
and we have to access it via libusb. There is no easy way of tying the
the /dev device node and the libusb second interface access together.

Since we don't speak the USB modem protocol directly in BitPim, we have
to use the OS level driver for accessing the modem interface on Mac/Linux
and since there are no device drivers, we have to use libusb for the
diagnostics interface. (And if a driver is present for an interface,
you can't use libusb for the same interface).

(*) Technically the zeroth interface is a interrupt interface and the
first interface is bulk data and together they implement the USB
modem protocol.

Roger
Joe Pham
2005-04-20 03:50:17 UTC
Permalink
Post by Roger Binns
- Include the comscan information with the dict passed to
detectphone
- Ideally only pass the phone module ports that it considers
ok (ie comdiagnose.islikelyport returns true)
detectphone is now declared as:

def detectphone(coms, likely_ports, data_dict):
...
detectphone=staticmethod(detectphone)

coms: comscan information
likely_port: list of likely ports ['com1', 'com2']
data_dict: phone detection data dict
Post by Roger Binns
- Run the detectphone function in the worker thread not the
main thead
Done.
Post by Roger Binns
BTW please make sure we don't actually store the ESN anywhere.
My plan is to sha it and use that as a key to associate an owner's name with a phone, ie Joe's SCH-A650. Just not getting to it yet.

Please give it a try and let me know what else you need.

-Joe Pham



______________________________________________________________________
Speed up your surfing with NetZero HiSpeed.
Now includes pop-up blocker!
Only $14.95/month -visit http://www.netzero.com/surf to sign up today!
Loading...