You are not logged in.

#1 2010-05-07 21:41:55

aport
Member
From: San Diego
Registered: 2008-02-20
Posts: 99

libusb and kernel USB

I'm writing a small program to gather information about usb-serial devices (modems).

When the device is inserted, I read /proc/tty/driver/usbserial to associate the /dev/ttyUSBX devices with a particular USB device path on my hub. After this association, I know which ports belong to which modem.


I'd like to use libusb to get further information about the USB device, like number of endpoints, and the endpoint transfer type. My problem is that I can't find any way in libusb to associate devices with the USB path in /proc/tty/driver/usbserial. The hub/device paths in libusb are vastly different.



Here's the flow:
1) Modem is inserted
2) my program runs, associates /dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyUSB2 etc.. with a USB path from /proc/tty/driver/usbserial.
3) program uses libusb to look at that USB device, and gather endpoint information.


I use the USB device path from /proc/tty/driver/usbserial to associate ports with the device because it's the only attribute which is unique to that device. I could plug in two modems with the same vendor/product ID and still be able to see which ttyUSB ports are associated with each modem. However, I can't seem to associate information gathered via libusb with information in /proc/tty/driver/usbserial.


cliffs:
Is there a way to associate bus/device paths from libusb with the bus/device paths in the kernel?


edit: The purpose of this, if anyone is interested, is to determine which of the /dev/ttyUSB devices is the port used to establish a PPP connection. The endpoint transfer type for this port is interrupt, whereas the others are bulk. Right now I just send AT commands to each port and see which responds, but that process is very slow and not always reliable.

Last edited by aport (2010-05-07 21:44:30)

Offline

Board footer

Powered by FluxBB