Дано:Имеется отладчик TI eZ430-T2013, втыкающийся в USB. Под виндой работает стабильно, к нему претензий нет.
lsusb -d 0451: -v
Bus 005 Device 006: ID 0451:f430 Texas Instruments, Inc. MSP-FET430UIF JTAG Tool
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 255 Vendor Specific Class
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0451 Texas Instruments, Inc.
idProduct 0xf430 MSP-FET430UIF JTAG Tool
bcdDevice 1.01
iManufacturer 1 Texas Instruments
iProduct 2 MSP-FET430UIF JTAG Tool
iSerial 3 TUSB3410200FC3E5135DFF0D
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)
Имеется Ubuntu 9.10:
uname -a
Linux enot 2.6.31-21-generic #59-Ubuntu SMP Wed Mar 24 07:28:56 UTC 2010 i686 GNU/Linux
Проблема: при передаче устройства в Virtualbox (отладочный софт есть только под винду) Windows его видит, ставит драйвера, но доступа к устройству потом нет.
Без виртуалбокса миником тоже не может открыть порт ttyUSB0:
minicom: cannot open /dev/ttyUSB0: Input/output error
Теперь подробности:Что происходит при втыкании:
dmesg -c
[ 193.837082] usb 5-2: new full speed USB device using uhci_hcd and address 7
[ 194.033295] usb 5-2: configuration #1 chosen from 1 choice
[ 194.037384] ti_usb_3410_5052 5-2:1.0: TI USB 3410 1 port adapter converter detected
[ 194.037399] usb 5-2: firmware: requesting ti_usb-v0451-pf430.fw
[ 194.052870] usb 5-2: firmware: requesting ti_3410.fw
[ 194.640117] usb 5-2: reset full speed USB device using uhci_hcd and address 7
[ 194.840117] usb 5-2: device firmware changed
[ 194.840181] ti_usb_3410_5052: probe of 5-2:1.0 failed with error -5
[ 194.840286] usb 5-2: USB disconnect, address 7
[ 194.956101] usb 5-2: new full speed USB device using uhci_hcd and address 8
[ 195.181280] usb 5-2: configuration #1 chosen from 2 choices
[ 195.185186] ti_usb_3410_5052 5-2:1.0: TI USB 3410 1 port adapter converter detected
[ 195.185211] ti_usb_3410_5052: probe of 5-2:1.0 failed with error -5
[ 195.189168] ti_usb_3410_5052 5-2:2.0: TI USB 3410 1 port adapter converter detected
[ 195.189294] usb 5-2: TI USB 3410 1 port adapter converter now attached to ttyUSB0
И у нас вроде бы появляется ttyUSB0, но поскольку не работает ровно половина endpoints, то и порт остается недоступным.
Уже за 2 дня скурил весь гугль на эту тему - проблема популярная, ибо на том же чипе сделаны разные хуавейские модемы.
Решение для старого ядра было таким:
Здесь:
http://lkml.indiana.edu/hypermail/linux/kernel/0711.0/0077.html'drivers/usb/serial/usb-serial.c: wrong number of endpoints'
which is pretty much what I expected, throwing some more printk's in
usb-serial gives:
drivers/usb/serial/usb-serial.c: num_interrupt_in = 0, expected 1
drivers/usb/serial/usb-serial.c: num_interrupt_out = 0, expected 0
drivers/usb/serial/usb-serial.c: num_bulk_in = 0, expected 1
drivers/usb/serial/usb-serial.c: num_bulk_out = 1, expected 1
Changing num_interrupt_in and num_bulk_in from 1 to NUM_DONT_CARE makes
ti_usb_3410_5052 work again
и здесь:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/231276ti_usb_3410_5052.c
267,268c267,268
< .num_interrupt_in = 1,
< .num_bulk_in = 1,
---rules.d
> .num_interrupt_in = NUM_DONT_CARE,
> .num_bulk_in = NUM_DONT_CARE,
Драйвер выдает ту же версию 0.9, но сорцы совсем другие, поскольку начиная с 9.04 формат слегка изменился.
В любом случае, перекомпиливать ядро - не то решение, которое мне нужно.
Насколько я понимаю, проблему можно решить соответствующим /etc/udev/rules.d
На одном из форумов был найден такой вариант:
cat 36-MSP430-FET.rules
#
# Copyright (C) Friedrich Lobenstock <fl at fl.priv.at>
# partly based on code from Nicholas Preyss <npreyss at ee.ethz.ch>
# see http://people.ee.ethz.ch/~npreyss/msp430/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# give use a stable name /dev/msp-fet430uif for access
# to the MSP430 Flash Emulation Tool (FET)
KERNEL=="ttyUSB*", \
ATTRS{product}=="MSP-FET430UIF JTAG Tool", \
SYSFS{bNumConfigurations}=="2", \
SYSFS{bConfigurationValue}=="2", \
SYMLINK+="msp-fet430uif", \
GROUP="users", \
MODE="0660", \
OPTIONS+="last_rule"
# to activate the serial port of the MSP-FET430UIF we
# need to activate its second configuration
SUBSYSTEM=="usb_device", \
ACTION=="add", \
ATTRS{product}=="MSP-FET430UIF JTAG Tool", \
SYSFS{bNumConfigurations}=="2", \
SYSFS{bConfigurationValue}=="1", \
RUN+="/bin/sh -c 'echo 2 > /sys%p/device/bConfigurationValue'"
Устройство /dev/msp-fet430uif после втыкания эмулятора появляется, но все так же недоступно.
Еще был один хинт:
http://kerneltrap.org/mailarchive/linux-usb/2009/4/23/5558194The actual Linux CDC-ACM driver is waiting for 2 interfaces ( 1 for DATA and 1
for COMM ), so, the eZ430u tool does'nt work with Linux.
После перекомпиливания ядра с предложенным патчем все осталось по прежнему.
Кто еще может предложить какие-то мысли? У меня идеи закончились после второй пересборки ядра.
Добавлено:
Может, будет полезен вывод udevadm monitor:
KERNEL[1270217763.109055] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2 (usb)
KERNEL[1270217763.111940] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:1.0 (usb)
KERNEL[1270217763.111998] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/firmware/5-2 (firmware)
UDEV [1270217763.121307] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2 (usb)
UDEV [1270217763.122071] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:1.0 (usb)
KERNEL[1270217763.126450] remove /devices/pci0000:00/0000:00:1d.0/usb5/5-2/firmware/5-2 (firmware)
KERNEL[1270217763.126477] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/firmware/5-2 (firmware)
UDEV [1270217763.128870] remove /devices/pci0000:00/0000:00:1d.0/usb5/5-2/firmware/5-2 (firmware)
UDEV [1270217763.131791] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/firmware/5-2 (firmware)
KERNEL[1270217763.132451] remove /devices/pci0000:00/0000:00:1d.0/usb5/5-2/firmware/5-2 (firmware)
UDEV [1270217763.132972] remove /devices/pci0000:00/0000:00:1d.0/usb5/5-2/firmware/5-2 (firmware)
UDEV [1270217763.133338] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/firmware/5-2 (firmware)
KERNEL[1270217763.853608] remove /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:1.0 (usb)
KERNEL[1270217763.853907] remove /devices/pci0000:00/0000:00:1d.0/usb5/5-2 (usb)
UDEV [1270217763.855618] remove /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:1.0 (usb)
UDEV [1270217763.859640] remove /devices/pci0000:00/0000:00:1d.0/usb5/5-2 (usb)
KERNEL[1270217764.192840] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2 (usb)
KERNEL[1270217764.201315] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:1.0 (usb)
UDEV [1270217764.201421] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2 (usb)
KERNEL[1270217764.202702] remove /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:1.0 (usb)
KERNEL[1270217764.206243] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:2.0 (usb)
KERNEL[1270217764.206312] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:2.0/ttyUSB0 (usb-serial)
KERNEL[1270217764.206367] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:2.0/ttyUSB0/tty/ttyUSB0 (tty)
UDEV [1270217764.211000] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:2.0 (usb)
UDEV [1270217764.211059] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:2.0/ttyUSB0 (usb-serial)
UDEV [1270217764.215801] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:1.0 (usb)
UDEV [1270217764.215831] remove /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:1.0 (usb)
UDEV [1270217764.226964] add /devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2:2.0/ttyUSB0/tty/ttyUSB0 (tty)