Discussion:
[Bitpim-devel] linux debugging questions (really USB questions)
Paul Traina
2004-03-28 02:14:31 UTC
Permalink
Roger (et al),

I'm trying to get 0.7test6 running on a Linux box. I'm sorry, I have
little if any previous USB under Linux experience.

The environment:

Linux quemadura.shockwave.org 2.6.4-1-686-smp #1 SMP Sat Mar 13 21:05:54 EST 2004 i686 GNU/Linux

Debian testing/unstable

I've brought up bitpim. I first tried to let it auto-find my LG VX6000
phone with no luck. I figured libusb/usbscan was just confused?

The output of usbscan if run separately is nothing (nothing found).
I then tried /dev/usb/acm/0 as a hope of accessing the diagnostic port,
that failed with a BREW CRC error, so I assume that the particular port
I tried to access represents either the data port or some strange
composite port for the modem.

Traceback (most recent call last):
File "/home/pst/bitpim/gui.py", line 150, in run
res=call()
File "/home/pst/bitpim/gui.py", line 91, in __call__
return apply(self.method, self.args+args, d)
File "/home/pst/bitpim/gui.py", line 1053, in getdata
results=self.getfundamentals()
File "/home/pst/bitpim/gui.py", line 1047, in getfundamentals
self.commphone.getfundamentals(results)
File "/home/pst/bitpim/com_lgvx4400.py", line 89, in getfundamentals
results['uniqueserial']=sha.new(self.getfilecontents("nvm/$SYS.ESN")).hexdigest()
File "/home/pst/bitpim/com_brew.py", line 201, in getfilecontents
res=self.sendbrewcommand(req, p_brew.readfileresponse)
File "/home/pst/bitpim/com_brew.py", line 325, in sendbrewcommand
raise common.CommsDataCorruption(self.desc, "Brew packet failed CRC
check")
CommsDataCorruption: LG-VX6000: Brew packet failed CRC check

Variables by last 8 frames, innermost last

Frame __bootstrap in /usr/lib/python2.3/threading.py at line 436
self = <WorkerThread(BitPim helper, started daemon)>

Frame run in /home/pst/bitpim/gui.py at line 143
e = <common.CommsDataCorruption instance at 0x42065dac>
res = None
self = <WorkerThread(BitPim helper, started daemon)>
item = (<gui.Request instance at 0x41fb76ac>, <gui.Callback
instanc
call = <gui.Request instance at 0x41fb76ac>
ex = <common.CommsDataCorruption instance at 0x42065dac>
resultcb = <gui.Callback instance at 0x4204b04c>
first = 0

Frame __call__ in /home/pst/bitpim/gui.py at line 91
self = <gui.Request instance at 0x41fb76ac>
args = ()
d = {}
kwargs = {}

Frame getdata in /home/pst/bitpim/gui.py at line 1053
self = <WorkerThread(BitPim helper, started daemon)>
req = <guiwidgets.GetPhoneDialog instance; proxy of C++
wxDialog i

Frame getfundamentals in /home/pst/bitpim/gui.py at line 1047
self = <WorkerThread(BitPim helper, started daemon)>
results = {}

Frame getfundamentals in /home/pst/bitpim/com_lgvx4400.py at line 89
self = <com_lgvx6000.Phone instance at 0x4204b78c>
results = {}

Frame getfilecontents in /home/pst/bitpim/com_brew.py at line 201
self = <com_lgvx6000.Phone instance at 0x4204b78c>
req = <p_brew.readfilerequest object at 0x42065d6c>
start = 1080438070.1254621
file = 'nvm/$SYS.ESN'
data = <cStringIO.StringO object at 0x42065d00>
desc = 'Reading nvm/$SYS.ESN'

Frame sendbrewcommand in /home/pst/bitpim/com_brew.py at line 325
origdata = 'Y\x04\rnvm/$SYS.ESN1\xe2~'
d = 0
responseclass = <class 'p_brew.readfileresponse'>
buffer = <prototypes.buffer instance at 0x42065ecc>
request = <p_brew.readfilerequest object at 0x42065d6c>
callsetmode = True
firsttwo = 'Y\x04'
crc = '1\xe2'
data = 'Y\x04\rnvm/$SYS.ESN'
self = <com_lgvx6000.Phone instance at 0x4204b78c>


I saw your note about checking libusb against the kernel (since I am
running 2.6 and downgrading is not an option for me). I ran the testusb
utility (as well as lsusb). It appears to clearly be finding the ACM
device and a couple of bulk endpoints (?), but the bit about not reading
the vendor string seems like it might be an issue? However I know that
we should just be looking for the IDs?

This could simply be that I don't know where to get access to the damn
thing in my /dev (devfs) tree. Any suggestions as to what the right
major (and minor) numbers for the diag port device should be? Then I
could just run a find command to figure out what debian called it?

Thanks,

Paul


lsusb

Bus 005 Device 005: ID 1004:6000 LG Electronics, Inc.
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 002: ID 046d:c501 Logitech, Inc. Cordless Mouse Receiver
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000

lsusb -v (just bus 5)

Bus 005 Device 005: ID 1004:6000 LG Electronics, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.01
bDeviceClass 2 Communications
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 16
idVendor 0x1004 LG Electronics, Inc.
idProduct 0x6000
bcdDevice 0.00
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 90
bNumInterfaces 3
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 bytes 16 once
bInterval 32
CDC Header:
bcdCDC 1.09
CDC Call Management:
bmCapabilities 0x03
call management
use DataInterface
bDataInterface 1
CDC ACM:
bmCapabilities 0f
connection notifications
sends break
line coding and serial state
get/set/clear comm features
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 4
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x8a EP 10 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 bytes 64 once
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x0b EP 11 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 bytes 64 once
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 bytes 64 once
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x06 EP 6 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 bytes 64 once
bInterval 0

Bus 005 Device 001: ID 0000:0000
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0000
idProduct 0x0000
bcdDevice 2.06
iManufacturer 3
iProduct 2
iSerial 1
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x40
Self Powered
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 bytes 2 twice
bInterval 255

output from testlibusb:

bus/device idVendor/idProduct
005/005 1004/6000
- Unable to fetch manufacturer string
- Unable to fetch product string
wTotalLength: 90
bNumInterfaces: 3
bConfigurationValue: 1
iConfiguration: 0
bmAttributes: e0h
MaxPower: 50
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 1
bInterfaceClass: 2
bInterfaceSubClass: 2
bInterfaceProtocol: 1
iInterface: 0
bEndpointAddress: 81h
bmAttributes: 03h
wMaxPacketSize: 16
bInterval: 32
bRefresh: 0
bSynchAddress: 0
bInterfaceNumber: 1
bAlternateSetting: 0
bNumEndpoints: 2
bInterfaceClass: 10
bInterfaceSubClass: 0
bInterfaceProtocol: 0
iInterface: 4
bEndpointAddress: 8ah
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0
bEndpointAddress: 0bh
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0
bInterfaceNumber: 2
bAlternateSetting: 0
bNumEndpoints: 2
bInterfaceClass: 255
bInterfaceSubClass: 255
bInterfaceProtocol: 0
iInterface: 0
bEndpointAddress: 83h
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0
bEndpointAddress: 06h
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0
005/001 0000/0000
- Unable to fetch manufacturer string
- Unable to fetch product string
- Unable to fetch serial number string
wTotalLength: 25
bNumInterfaces: 1
bConfigurationValue: 1
iConfiguration: 0
bmAttributes: 40h
MaxPower: 0
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 1
bInterfaceClass: 9
bInterfaceSubClass: 0
bInterfaceProtocol: 0
iInterface: 0
bEndpointAddress: 81h
bmAttributes: 03h
wMaxPacketSize: 2
bInterval: 255
bRefresh: 0
bSynchAddress: 0
004/001 0000/0000
- Unable to fetch manufacturer string
- Unable to fetch product string
- Unable to fetch serial number string
wTotalLength: 25
bNumInterfaces: 1
bConfigurationValue: 1
iConfiguration: 0
bmAttributes: 40h
MaxPower: 0
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 1
bInterfaceClass: 9
bInterfaceSubClass: 0
bInterfaceProtocol: 0
iInterface: 0
bEndpointAddress: 81h
bmAttributes: 03h
wMaxPacketSize: 2
bInterval: 255
bRefresh: 0
bSynchAddress: 0
003/002 046D/C501
- Unable to fetch manufacturer string
- Unable to fetch product string
wTotalLength: 34
bNumInterfaces: 1
bConfigurationValue: 1
iConfiguration: 0
bmAttributes: a0h
MaxPower: 25
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 1
bInterfaceClass: 3
bInterfaceSubClass: 1
bInterfaceProtocol: 2
iInterface: 0
bEndpointAddress: 81h
bmAttributes: 03h
wMaxPacketSize: 8
bInterval: 10
bRefresh: 0
bSynchAddress: 0
003/001 0000/0000
- Unable to fetch manufacturer string
- Unable to fetch product string
- Unable to fetch serial number string
wTotalLength: 25
bNumInterfaces: 1
bConfigurationValue: 1
iConfiguration: 0
bmAttributes: 40h
MaxPower: 0
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 1
bInterfaceClass: 9
bInterfaceSubClass: 0
bInterfaceProtocol: 0
iInterface: 0
bEndpointAddress: 81h
bmAttributes: 03h
wMaxPacketSize: 2
bInterval: 255
bRefresh: 0
bSynchAddress: 0
002/001 0000/0000
- Unable to fetch manufacturer string
- Unable to fetch product string
- Unable to fetch serial number string
wTotalLength: 25
bNumInterfaces: 1
bConfigurationValue: 1
iConfiguration: 0
bmAttributes: 40h
MaxPower: 0
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 1
bInterfaceClass: 9
bInterfaceSubClass: 0
bInterfaceProtocol: 0
iInterface: 0
bEndpointAddress: 81h
bmAttributes: 03h
wMaxPacketSize: 2
bInterval: 255
bRefresh: 0
bSynchAddress: 0
001/001 0000/0000
- Unable to fetch manufacturer string
- Unable to fetch product string
- Unable to fetch serial number string
wTotalLength: 25
bNumInterfaces: 1
bConfigurationValue: 1
iConfiguration: 0
bmAttributes: 40h
MaxPower: 0
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 1
bInterfaceClass: 9
bInterfaceSubClass: 0
bInterfaceProtocol: 0
iInterface: 0
bEndpointAddress: 81h
bmAttributes: 03h
wMaxPacketSize: 2
bInterval: 12
bRefresh: 0
bSynchAddress: 0
Roger Binns
2004-03-28 06:35:03 UTC
Permalink
Post by Paul Traina
I then tried /dev/usb/acm/0 as a hope of accessing the diagnostic port,
http://bitpim.sourceforge.net/testhelp/hoto-usbintro.htm

The VX6000 has 3 interfaces. 0 and 1 are the modem interface and
are used by the acm driver. Interface 2 is the diagnositcs
interface and is what BitPim needs to talk to. It can only
be accessed via libusb on Linux as there is no driver.

usbscan should list every USB device connected to your machine
(not just phones). If you aren't getting that then something
is wrong. Note that if you are working from the source code,
you need to build the USB module in native/usb which also
requires SWIG amongst other things.

The prebuilt rpm has all the right stuff built and links
dynamically to libusb:

$ ldd _libusb.so
libusb-0.1.so.4 => /usr/lib/libusb-0.1.so.4 (0x400e6000)
libc.so.6 => /lib/i686/libc.so.6 (0x400ed000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
Post by Paul Traina
but the bit about not reading
the vendor string seems like it might be an issue?
None of the LG phones will give up a vendor string except when
they very first get plugged in, and then they tell the OS as
it interrogates them.
Post by Paul Traina
However I know that we should just be looking for the IDs?
Yes, that is what happens. The strings from the device itself
are shown in the port browser if present.

We also have our own USB ids to string database to augment
the standard one.
Post by Paul Traina
This could simply be that I don't know where to get access to the damn
thing in my /dev (devfs) tree.
libusb accesses the usbfs tree.
Post by Paul Traina
Any suggestions as to what the right
major (and minor) numbers for the diag port device should be? Then I
could just run a find command to figure out what debian called it?
It doesn't work like that (except for the modem interface). The
devices and interfaces appear as nodes in the usb filesystem.

Roger
Paul Traina
2004-03-28 07:09:06 UTC
Permalink
Thanks! Now I understand your communications interface. I didn't wrap
my head around the fact that you couldn't use the native acm module.

Yes, I am building from source because I am running debian linux, and
even after converting your rpm to a deb and installing it, the precompiled
stuff was barfing due to libstdc++ shared library incompatabilities.

I'm sorry I missed that comment about building libusb in the other docs.
I installed swig and built your private _libusb.

So, usbscan is now working properly for me:

getting configvalue
value is 1 now about to set config
config set
claiming 1
getting configvalue
value is 1 now about to set config
config set
claiming 2
UsbScan $Revision: 1.5 $

usb::005::006::1:
active: True available: False
description: USB Device - Vendor LG Electroncs Product VX4400/4500/4600/6000 Phone (Interface Modem Interface)
libusb: True protocol: Data / Generic usb-interface: Modem Interface
usb-interface#: 1 usb-product: VX4400/4500/4600/6000 Phone
usb-product#: 24576 usb-productstring: Qualcomm CDMA Technologies MSM
usb-vendor: LG Electroncs usb-vendor#: 4100

usb::005::006::2:
active: True available: False
description: USB Device - Vendor LG Electroncs Product VX4400/4500/4600/6000 Phone (Interface Diagnostics Interface)
libusb: True protocol: Vendor Specific Class / Vendor Specific Subclass
usb-interface: Diagnostics Interface usb-interface#: 2
usb-product: VX4400/4500/4600/6000 Phone usb-product#: 24576
usb-productstring: Qualcomm CDMA Technologies MSM
usb-vendor: LG Electroncs usb-vendor#: 4100





but when I go to grab some data out of the phone I get a USB timeout:





An unexpected exception has occurred.
Please see the help for details on what to do.

Traceback (most recent call last):
File "/home/pst/bitpim/gui.py", line 150, in run
res=call()
File "/home/pst/bitpim/gui.py", line 91, in __call__
return apply(self.method, self.args+args, d)
File "/home/pst/bitpim/gui.py", line 1053, in getdata
results=self.getfundamentals()
File "/home/pst/bitpim/gui.py", line 1047, in getfundamentals
self.commphone.getfundamentals(results)
File "/home/pst/bitpim/com_lgvx4400.py", line 89, in getfundamentals
results['uniqueserial']=sha.new(self.getfilecontents("nvm/$SYS.ESN")).hexdigest()
File "/home/pst/bitpim/com_brew.py", line 201, in getfilecontents
res=self.sendbrewcommand(req, p_brew.readfileresponse)
File "/home/pst/bitpim/com_brew.py", line 283, in sendbrewcommand
self.setmode(self.MODEBREW)
File "/home/pst/bitpim/com_phone.py", line 102, in setmode
res=getattr(self, func)()
File "/home/pst/bitpim/com_brew.py", line 239, in _setmodebrew
self.sendbrewcommand(req, respc, callsetmode=False)
File "/home/pst/bitpim/com_brew.py", line 291, in sendbrewcommand
self.comm.write(data, log=False) # we logged above
File "/home/pst/bitpim/commport.py", line 187, in write
self.ser.write(data)
File "/home/pst/bitpim/commport.py", line 294, in write
self.dev.write(data, self.timeout)
File "/home/pst/bitpim/native/usb/usb.py", line 262, in write
raise USBException()
USBException: error writing to bulk endpoint 6: Connection timed out

Variables by last 8 frames, innermost last

Frame getfilecontents in /home/pst/bitpim/com_brew.py at line 201
self = <com_lgvx6000.Phone instance at 0x42ac7f2c>
req = <p_brew.readfilerequest object at 0x42ac7fec>
start = 1080457151.340672
file = 'nvm/$SYS.ESN'
data = <cStringIO.StringO object at 0x42ac7fa0>
desc = 'Reading nvm/$SYS.ESN'

Frame sendbrewcommand in /home/pst/bitpim/com_brew.py at line 283
callsetmode = True
request = <p_brew.readfilerequest object at 0x42ac7fec>
self = <com_lgvx6000.Phone instance at 0x42ac7f2c>
responseclass = <class 'p_brew.readfileresponse'>

Frame setmode in /home/pst/bitpim/com_phone.py at line 104
desiredmode = 'modebrew'
self = <com_lgvx6000.Phone instance at 0x42ac7f2c>
strmode = 'none'
strdesiredmode = 'brew'
func = '_setmodebrew'
v = 'writefile'

Frame _setmodebrew in /home/pst/bitpim/com_brew.py at line 242
self = <com_lgvx6000.Phone instance at 0x42ac7f2c>
req = <p_brew.memoryconfigrequest object at 0x42ac7f4c>
respc = <class 'p_brew.memoryconfigresponse'>

Frame sendbrewcommand in /home/pst/bitpim/com_brew.py at line 295
responseclass = <class 'p_brew.memoryconfigresponse'>
buffer = <prototypes.buffer instance at 0x42acc26c>
request = <p_brew.memoryconfigrequest object at 0x42ac7f4c>
callsetmode = False
firsttwo = 'Y\x0c'
data = 'Y\x0c\xc4\xc1~'
self = <com_lgvx6000.Phone instance at 0x42ac7f2c>

Frame write in /home/pst/bitpim/commport.py at line 187
self = <commport.CommConnection instance at 0x420b258c>
data = 'Y\x0c\xc4\xc1~'
log = False

Frame write in /home/pst/bitpim/commport.py at line 294
self = <commport._usbdevicewrapper instance at 0x42ac7f8c>
data = 'Y\x0c\xc4\xc1~'

Frame write in /home/pst/bitpim/native/usb/usb.py at line 262
res = -110
self = <native.usb.usb.USBFile instance at 0x42acc12c>
data = 'Y\x0c\xc4\xc1~'
timeout = 3000
first = False


Unfortunately, I'm running kernel 2.6.4 (can't go down to 2.4). I'm
also using python 2.3.

Has anyone else successfully built bitpim out of CVS HEAD under a 2.6
kernel or verified that your libusb works under 2.6?
Paul Traina
2004-03-28 07:37:24 UTC
Permalink
whoops, ignore me. the timeouts have gone away after a kernel reboot.

I probably screwed the pooch with some earlier debugging.

Thanks for all the help!

Loading...