Hi!
I've been digging around the kernel sources of 2.4.23-pre8 looking for a
way from user space to find out the iSerialNumber of each entry in
/proc/tty/driver/usb-serial ... I cannot figure out how to map, say,
00:1d.7-5.3 to an entry in /proc/bus/usb/devices or any entry in
/proc/bus/usb/00?/???.
I have several FTDI usb<-->serial converters with exactly the same
chips and only with the different serial numbers can I figure out what
should go where.
Using hotplug I would like to look evaluate the serial number of each FTDI
entry and then setup a neat link to it. Like so:
for ftdis in usb-serial; do
ttyUSB=ttyUSB`sed-magci to filter out tty #`
if [ "`magic to find serial`" = "FTB9HWRM" ]; then
ln -s /dev/$ttyUSB /dev/big_customer/rs422
fi
if [ "`magic to find serial`" = "FTB5K8IO" ]; then
ln -s /dev/$ttyUSB /dev/big_customer/printer
fi
done
This way the application can always talk to /dev/big_customer/rs422 and
/dev/big_customer/printer no matter the order in which they where
actually probed.
How can this be done?
$ cat /proc/tty/driver/usb-serial
usbserinfo:1.0 driver:v1.4
0: name:"FTDI FT232BM Compatible" vendor:0403 product:6001 num_ports:1 port:1
path:usb-00:1d.7-5.2
1: name:"FTDI FT232BM Compatible" vendor:0403 product:6001 num_ports:1 port:1
path:usb-00:1d.7-5.3
If these entrys also had a device entry my job would be done. It would
be really easy to map them all with a simple call to lsusb -s 001:032
How about adding device: to serial_read_proc()? Like this:
0: name:"FTDI FT232BM Compatible" vendor:0403 product:6001 num_ports:1 port:1
path:usb-00:1d.7-5.2 device:/001/031
1: name:"FTDI FT232BM Compatible" vendor:0403 product:6001 num_ports:1 port:1
path:usb-00:1d.7-5.3 device:/001/032
$ cat "relevant parts of /proc/bus/usb/devices"
T: Bus=01 Lev=02 Prnt=18 Port=01 Cnt=02 Dev#= 31 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0403 ProdID=6001 Rev= 4.00
S: Manufacturer=FTDI
S: Product=US232B
S: SerialNumber=FTB5K8IO
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 44mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=serial
E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
T: Bus=01 Lev=02 Prnt=18 Port=02 Cnt=03 Dev#= 32 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0403 ProdID=6001 Rev= 4.00
S: Manufacturer=FTDI
S: Product=USB TO RS-422/485 ADAPTER
S: SerialNumber=FTB9HWRM
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 44mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=serial
E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
Regards
/Joachim
--
Joachim Nilsson :: <joachim AT vmlinux DOT org>
+46-(0)21-123348 :: <http://joachim.vmlinux.org>
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users