Bug 211967 - USB Keyboard is detected as USB mouse when USB mouse is plugged in at boot
Summary: USB Keyboard is detected as USB mouse when USB mouse is plugged in at boot
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: 10.3-STABLE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-usb mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-18 15:22 UTC by nc
Modified: 2016-08-24 13:26 UTC (History)
4 users (show)

See Also:


Attachments
login prompt when unplugging/plugging in keyboard when mouse is plugged in at boot (138.61 KB, image/jpeg)
2016-08-18 16:01 UTC, nc
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description nc 2016-08-18 15:22:44 UTC
When I have both a USB Keyboard and a USB Mouse plugged in a boot, the keyboard gets detected as some kind of mouse or some other (non-keyboard) device. When I try to type, control code characters get inserted instead of regular characters.

The same thing happens if I run `usbconfig reset` with both the keyboard and mouse plugged in.

The current workaround I have is to leave the USB Mouse unplugged on boot, waiting to get to the login prompt, then plugging the Mouse in. When I do this, the keyboard is detected properly (and the mouse works as well).
Comment 1 Anthony Jenkins 2016-08-18 15:33:03 UTC
What keyboard and mouse are they?
Does the same behavior happen when a different USB mouse is plugged in at boot?
What is the output of 'usbconfig dump_device_desc' when
 1) both devices were plugged in at boot, and
 2) mouse is plugged in after boot?
Comment 2 karl 2016-08-18 15:48:55 UTC
This sounds related to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211884

I'm going to try removing the code change that might be involved and will advise.
Comment 3 nc 2016-08-18 16:01:50 UTC
Created attachment 173828 [details]
login prompt when unplugging/plugging in keyboard when mouse is plugged in at boot
Comment 4 nc 2016-08-18 16:02:23 UTC
(In reply to Anthony Jenkins from comment #1)
Wow, thanks for jumping on this so fast :)

* The keyboard is a WhiteFox Mechanical Keyboard and the mouse is a SteelSeries Kinzu v2.
* The problem still exists with other USB mice.
* Output of usbconfig dump_device_desc (mouse plugged in after boot):

ugen0.1: <XHCI root HUB 0x1106> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0300
  bDeviceClass = 0x0009  <HUB>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0003
  bMaxPacketSize0 = 0x0009
  idVendor = 0x0000
  idProduct = 0x0000
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <0x1106>
  iProduct = 0x0002  <XHCI root HUB>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

ugen1.1: <OHCI root HUB ATI> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0100
  bDeviceClass = 0x0009  <HUB>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x0000
  idProduct = 0x0000
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <ATI>
  iProduct = 0x0002  <OHCI root HUB>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

ugen2.1: <OHCI root HUB ATI> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0100
  bDeviceClass = 0x0009  <HUB>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x0000
  idProduct = 0x0000
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <ATI>
  iProduct = 0x0002  <OHCI root HUB>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

ugen3.1: <EHCI root HUB ATI> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0009  <HUB>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0001
  bMaxPacketSize0 = 0x0040
  idVendor = 0x0000
  idProduct = 0x0000
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <ATI>
  iProduct = 0x0002  <EHCI root HUB>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

ugen4.1: <OHCI root HUB ATI> at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0100
  bDeviceClass = 0x0009  <HUB>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x0000
  idProduct = 0x0000
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <ATI>
  iProduct = 0x0002  <OHCI root HUB>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

ugen5.1: <OHCI root HUB ATI> at usbus5, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0100
  bDeviceClass = 0x0009  <HUB>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x0000
  idProduct = 0x0000
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <ATI>
  iProduct = 0x0002  <OHCI root HUB>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

ugen6.1: <EHCI root HUB ATI> at usbus6, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0009  <HUB>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0001
  bMaxPacketSize0 = 0x0040
  idVendor = 0x0000
  idProduct = 0x0000
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <ATI>
  iProduct = 0x0002  <EHCI root HUB>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

ugen7.1: <OHCI root HUB ATI> at usbus7, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE (0mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0100
  bDeviceClass = 0x0009  <HUB>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x0000
  idProduct = 0x0000
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <ATI>
  iProduct = 0x0002  <OHCI root HUB>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

ugen0.2: <USB2.0 Hub vendor 0x2109> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (100mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0210
  bDeviceClass = 0x0009  <HUB>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0001
  bMaxPacketSize0 = 0x0040
  idVendor = 0x2109
  idProduct = 0x3431
  bcdDevice = 0x0420
  iManufacturer = 0x0000  <no string>
  iProduct = 0x0001  <USB2.0 Hub>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

ugen0.3: <HD Pro Webcam C920 vendor 0x046d> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x00ef  <Miscellaneous device>
  bDeviceSubClass = 0x0002
  bDeviceProtocol = 0x0001
  bMaxPacketSize0 = 0x0040
  idVendor = 0x046d
  idProduct = 0x082d
  bcdDevice = 0x0011
  iManufacturer = 0x0000  <no string>
  iProduct = 0x0002  <HD Pro Webcam C920>
  iSerialNumber = 0x0001  <C717D91F>
  bNumConfigurations = 0x0001

ugen0.4: <Elements 25A2 Western Digital> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0300
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0009
  idVendor = 0x1058
  idProduct = 0x25a2
  bcdDevice = 0x1004
  iManufacturer = 0x0001  <Western Digital>
  iProduct = 0x0002  <Elements 25A2>
  iSerialNumber = 0x0003  <57583831413136453032334C>
  bNumConfigurations = 0x0001

ugen1.2: <Keyboard - WhiteFox PartialMap pjrcUSB full Kiibohd> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x1c11
  idProduct = 0xb04d
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <Kiibohd>
  iProduct = 0x0002  <Keyboard - WhiteFox PartialMap pjrcUSB full>
  iSerialNumber = 0x0003  <Clean master - 2016-05-31 00:40:10 -0700>
  bNumConfigurations = 0x0001

ugen3.2: <Im Fulla Schiit Schiit Audio> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x0d8c
  idProduct = 0x1066
  bcdDevice = 0x0102
  iManufacturer = 0x0001  <Schiit Audio>
  iProduct = 0x0002  <I'm Fulla Schiit>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

ugen3.3: <product 0x8191 vendor 0x0bda> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x0bda
  idProduct = 0x8191
  bcdDevice = 0x0200
  iManufacturer = 0x0001  <Realtek>
  iProduct = 0x0002  <802.11n WLAN Adapter>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

ugen0.5: <Kinzu V2 Gaming Mouse SteelSeries> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0110
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x1038
  idProduct = 0x1366
  bcdDevice = 0x0096
  iManufacturer = 0x0001  <SteelSeries>
  iProduct = 0x0002  <Kinzu V2 Gaming Mouse>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

* I wasn't able to get the output when the mouse was plugged in at boot (since I couldn't log in because the keyboard wasn't working). When I plug in any keyboard after the mouse has been plugged in at boot, it is detected incorrectly. However, I did get the output of unplugging/replugging the keyboard, after boot, when the mouse was plugged in at boot (in attachment)
Comment 5 Hans Petter Selasky freebsd_committer 2016-08-18 16:12:03 UTC
Some dual USB keyboard and mice might not work. Setting one of the following quirks for your device and then "usbconfig -d X.Y reset" might resolve the issue.

usbconfig -d X.Y add_quirk UQ_KBD_BOOTPROTO
usbconfig -d X.Y add_quirk UQ_KBD_IGNORE
usbconfig -d X.Y add_quirk UQ_UMS_IGNORE

--HPS
Comment 6 nc 2016-08-18 16:52:07 UTC
(In reply to Hans Petter Selasky from comment #5)
OK, I'll try that. Should I run those commands for the keyboard or for the mouse?
Comment 7 Hans Petter Selasky freebsd_committer 2016-08-18 17:11:58 UTC
For wrongly detected mouse you add:
usbconfig -d X.Y add_quirk UQ_UMS_IGNORE

For wrongly detected keyboard you add:
usbconfig -d X.Y add_quirk UQ_KBD_IGNORE

Given that keyboard and mouse is not same ugenX.Y.

--HPS
Comment 8 nc 2016-08-18 18:30:33 UTC
(In reply to Hans Petter Selasky from comment #7)
Hmm... it doesn't seem to work.

I also realized that this issues is affecting any USB keyboard I plug in (including other brands/models). Maybe it has something to do with the USB controller on my motherboard?
Comment 9 karl 2016-08-18 18:35:45 UTC
See the bug I linked; I reverted that change and the problem with IPKVM keyboards disappeared.

You might want to try reverting this change on your system.
Comment 10 nc 2016-08-18 18:46:58 UTC
(In reply to karl from comment #9)
Thanks, I'll try that. Is there a "proper" way of building the kernel from a specific commit, or is it just an svn checkout to a random directory, then build it from there? (I couldn't find a docs page on it, and I've only done Linux kernel compilations in the past).
Comment 11 karl 2016-08-18 18:54:03 UTC
(In reply to nc from comment #10)

From /usr/src...

svn log -v -r xxxxxxx (will tell you which file(s) got changed, in this case just one file in the USB driver set)

Then, after figuring out whether you have interdependencies and can safely roll back just one file or you must do the entire tree:

svn update -r xxxxxx file-that-got-changed (if just one file as is the case here, and no other dependencies on later commits; this can be dangerous but in this case it's ok)

or

cd /usr/src (or /usr/src/sys in this case, since this is kernel-specific)

svn update -r xxxxxx . (will roll the entire tree from that point downward back to the specified revision)

and then of course "make buildkernel;make installkernel" from /usr/src.
Comment 12 karl 2016-08-18 18:57:33 UTC
(In reply to nc from comment #10)

BTW if your machine is multi-core (and most are these days) you may want "make -jx buildkernel" instead of just "make buildkernel"; the "-jx" (replace "x" with the number of cores you have) tells the system to build with one executing job per CPU core.  This can *greatly* reduce build time.
Comment 13 nc 2016-08-18 23:34:38 UTC
Awesome, I think that solved it. Should I leave this bug open or close it then?
Comment 14 karl 2016-08-18 23:37:19 UTC
(In reply to nc from comment #13)

Probably ought to merge it with my other report....