I am trying to get the keyboard and mouse control from a Startech crash cart adapter working smoothly on a Pi 2.
The adapter has an internal USB hub (Alcor, 058F:6254) and behind that a virtual keyboard, mouse, and storage device -- so it should appear to the Pi as a hub with a keyboard, mouse, and (if enabled) a storage device plugged into it. I've read through https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=53832 and have done what I could.
I've got the latest version of everything according to rpi-update
, kernel is:
$ uname -a
Linux unbound-proto-1 4.1.19-v7+ #851 SMP Sat Mar 5 22:58:42 GMT 2016 armv7l GNU/Linux
So the first thing I did was plug in the adapter right out of the box. The keyboard and mouse were not recognized, although the Pi works fine with a real keyboard and mouse. When I plugged in the adapter, I get:
$ dmesg
[ 132.364632] usb 1-1.5: new high-speed USB device number 7 using dwc_otg
[ 132.465121] usb 1-1.5: New USB device found, idVendor=058f, idProduct=6254
[ 132.465147] usb 1-1.5: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 132.466846] hub 1-1.5:1.0: USB hub found
[ 132.467082] hub 1-1.5:1.0: 4 ports detected
[ 132.744659] usb 1-1.5.2: new full-speed USB device number 8 using dwc_otg
[ 132.745223] dwc_otg: DEVICE:000 : update_urb_state_xfer_intr:1435:trimming xfer length
[ 132.844646] usb 1-1.5.2: device descriptor read/64, error -71
[ 133.054639] usb 1-1.5.2: device descriptor read/64, error -71
[ 133.244659] usb 1-1.5.2: new full-speed USB device number 9 using dwc_otg
[ 133.344695] usb 1-1.5.2: device descriptor read/64, error -71
[ 133.554641] usb 1-1.5.2: device descriptor read/64, error -71
[ 133.744660] usb 1-1.5.2: new full-speed USB device number 10 using dwc_otg
[ 134.164628] usb 1-1.5.2: device not accepting address 10, error -71
[ 134.244665] usb 1-1.5.2: new full-speed USB device number 11 using dwc_otg
[ 134.664646] usb 1-1.5.2: device not accepting address 11, error -71
[ 134.664821] usb 1-1.5-port2: unable to enumerate USB device
And lsusb
shows the hub but not the keyboard / mouse that should be attached to it (the Logitech devices are the real ones, the Alcor hub is the adapter):
$ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 046d:c31c Logitech, Inc. Keyboard K120 for Business
Bus 001 Device 005: ID 046d:c05a Logitech, Inc. Optical Mouse M90
Bus 001 Device 006: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 007: ID 058f:6254 Alcor Micro Corp. USB Hub
$ lsusb -t
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/5p, 480M
|__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M
|__ Port 2: Dev 4, If 0, Class=HID, Driver=usbhid, 1.5M
|__ Port 2: Dev 4, If 1, Class=HID, Driver=usbhid, 1.5M
|__ Port 3: Dev 5, If 0, Class=HID, Driver=usbhid, 1.5M
|__ Port 4: Dev 6, If 0, Class=vend., Driver=rtl8192cu, 480M
|__ Port 5: Dev 7, If 0, Class=hub, Driver=hub/4p, 480M
Seeing no other option, I then added dwc_otg.speed=1
to /boot/cmdline.txt
:
dwc_otg.speed=1 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait
After rebooting, I found that the Startech's keyboard and mouse interface now worked fine, but the real keyboard and mouse were no longer recognized. Here's what I got plugging in the Startech after making the above change:
$ dmesg
[ 234.404780] usb 1-1.5: new full-speed USB device number 15 using dwc_otg
[ 234.505447] usb 1-1.5: not running at top speed; connect to a high speed hub
[ 234.506146] usb 1-1.5: New USB device found, idVendor=058f, idProduct=6254
[ 234.506167] usb 1-1.5: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 234.507320] hub 1-1.5:1.0: USB hub found
[ 234.507683] hub 1-1.5:1.0: 4 ports detected
[ 234.804794] usb 1-1.5.2: new full-speed USB device number 16 using dwc_otg
[ 234.907221] usb 1-1.5.2: New USB device found, idVendor=152a, idProduct=8461
[ 234.907247] usb 1-1.5.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 234.907266] usb 1-1.5.2: Product: USB KM
[ 234.907282] usb 1-1.5.2: Manufacturer: NXP SEMICOND
[ 234.907298] usb 1-1.5.2: SerialNumber: 000000000000
[ 234.912362] input: NXP SEMICOND USB KM as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5.2/1-1.5.2:1.0/0003:152A:8461.0003/input/input2
[ 234.965635] hid-generic 0003:152A:8461.0003: input,hidraw0: USB HID v1.00 Keyboard [NXP SEMICOND USB KM ] on usb-3f980000.usb-1.5.2/input0
[ 234.969975] input: NXP SEMICOND USB KM as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5.2/1-1.5.2:1.1/0003:152A:8461.0004/input/input3
[ 234.971755] hid-generic 0003:152A:8461.0004: input,hidraw1: USB HID v1.00 Mouse [NXP SEMICOND USB KM ] on usb-3f980000.usb-1.5.2/input1
And lsusb
also shows the devices on the hub now:
$ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 012: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 015: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 001 Device 016: ID 152a:8461
$ lsusb -t
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/5p, 12M
|__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 12M
|__ Port 4: Dev 12, If 0, Class=vend., Driver=rtl8192cu, 12M
|__ Port 5: Dev 15, If 0, Class=hub, Driver=hub/4p, 12M
|__ Port 2: Dev 16, If 0, Class=HID, Driver=usbhid, 12M
|__ Port 2: Dev 16, If 1, Class=HID, Driver=usbhid, 12M
Also, here is some more detailed info on the keyboard / mouse, from lsusb -v
:
Bus 001 Device 016: ID 152a:8461
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x152a
idProduct 0x8461
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 59
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 10mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.00
bCountryCode 51 Unknown
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 65
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 16
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.00
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 85
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 16
Interestingly, though, the Startech's virtual storage device works fine through its hub in both cases. So it is not an issue with the hub, it seems to be an issue with the Startech virtual keyboard and mouse hardware.
TL;DR
So basically, in summary:
- Without
dwc_otg.speed=1
:- My real Logitech keyboard/mouse works fine.
- The Startech hub -> keyboard/mouse doesn't work.
- The Startech hub -> storage device works fine.
- With
dwc_otg.speed=1
:- My real Logitech keyboard/mouse doesn't work.
- The Startech hub -> keyboard/mouse works fine.
- The Startech hub -> storage device still works fine.
- Also wifi feels a bit slower.
How can I make everything work? Why is dwc_otg.speed=1
allowing the Startech stuff to work but breaking the Logitech stuff, and how can I get it working without setting that option?
Here's a diagram. Red only works with .speed=1
, yellow only works with .speed=0
, and green works no matter what the setting is:
I'm not really sure what's going on. I don't know much about how USB works or what drivers are involved. I've used the Startech device on Windows, Linux, and OS X PCs, on Gumstix, Udoos, and on Beagleboards. The Pi is uniquely troublesome.
dwc_otg.speed=1
.lsusb
doesn't seem to be aware of the vendor/product string even though at some point it is read and echoed to kern.log (hid-generic ... USB HID v1.00 Keyboard [NXP SEMICOND USB KM]
). Plus, the issue is unique to the Pi. So I'm not sure what I should be pursuing: Missing drivers, hid driver bugs on the Pi, etc. I'm still trying to find the exact part, NXP makes a bunch of USB controllers used in devices with virtual keyboards and mice (seems like a common chip in various KVM switches). The vendor ID 152A seems bogus though.