Created attachment 1438210 [details] Xorg.0.log Description of problem: I have a USB hub that periodically disconnects and reconnects. I don't know why this happens -- this hub is probably more than 10 years old so it could just be that the hardware is dying -- but for the purposes of this issue it doesn't really matter, as I can reproduce this issue simply by unplugging and replugging a device several times. The related issue with libinput is that, when the USB hub disconnects and reconnects, the camera device remains as a device listed in xinput (why the camera device is considered to be a keyboard is another minor mystery, but I suppose since it is, libinput should deal with it correctly). Explicitly unplugging the webcam from the USB hub also shows the same behavior -- the webcam devices in the xinput list never go away. For example, before a disconnect: # xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Logitech Performance MX id=8 [slave pointer (2)] ⎜ ↳ Logitech MK700 id=9 [slave pointer (2)] ⎜ ↳ Genius Optical Mouse id=10 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Power Button id=7 [slave keyboard (3)] ↳ Device 2Port KVMSwitcher id=11 [slave keyboard (3)] ↳ SteelSeries SteelSeries Arctis 7 id=12 [slave keyboard (3)] ↳ Eee PC WMI hotkeys id=13 [slave keyboard (3)] ↳ Logitech MK700 id=14 [slave keyboard (3)] ↳ HD Pro Webcam C920 id=15 [slave keyboard (3)] The hub is connected to the Logitech Performance MX / MK700 via a Logitech receiver, the Genius Optimal Mouse, a scanner (not shown above), and the Logitech Webcam C920 -- 3 / 4 of these devices are shown above in xinput list. After the hub disconnects and reconnects: # xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Logitech MK700 id=8 [slave pointer (2)] ⎜ ↳ Logitech Performance MX id=10 [slave pointer (2)] ⎜ ↳ Genius Optical Mouse id=16 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Power Button id=7 [slave keyboard (3)] ↳ Device 2Port KVMSwitcher id=11 [slave keyboard (3)] ↳ SteelSeries SteelSeries Arctis 7 id=12 [slave keyboard (3)] ↳ Eee PC WMI hotkeys id=13 [slave keyboard (3)] ↳ HD Pro Webcam C920 id=15 [slave keyboard (3)] ↳ Logitech MK700 id=9 [slave keyboard (3)] ↳ HD Pro Webcam C920 id=14 [slave keyboard (3)] and now you can see that the HD Pro Webcam C920 is listed as two separate inputs. In and of itself, this is not a big deal, however the bigger problem comes after this happens about 20 times. Then, the X.Org libinput module starts ignoring devices because it says that the device limit has been reached, and then it unloads itself. From /var/log/Xorg.0.log (full log attached) after manually unplugging and replugging the webcam repeatedly: [152589.509] (II) config/udev: Adding input device HD Pro Webcam C920 (/dev/input/event295) [152589.510] (**) HD Pro Webcam C920: Applying InputClass "evdev keyboard catchall" [152589.510] (**) HD Pro Webcam C920: Applying InputClass "libinput keyboard catchall" [152589.510] (**) HD Pro Webcam C920: Applying InputClass "system-keyboard" [152589.510] (II) Using input driver 'libinput' for 'HD Pro Webcam C920' [152589.510] (**) HD Pro Webcam C920: always reports core events [152589.510] (**) Option "Device" "/dev/input/event295" [152589.510] (**) Option "_source" "server/udev" [152589.510] (II) event295 - HD Pro Webcam C920: is tagged by udev as: Keyboard [152589.510] (II) event295 - HD Pro Webcam C920: device is a keyboard [152589.510] (II) event295 - HD Pro Webcam C920: device removed [152589.530] (EE) Too many input devices. Ignoring HD Pro Webcam C920 [152589.530] (II) UnloadModule: "libinput" The problematic behavior seems to be when the hub disconnects/reconnects rather than the above procedure -- when this happens the Xorg.0.log message about "Too many input devices" seems to trigger on my mouse instead, leaving me with no ability to move the mouse -- libinput debug-events still shows the mouse is connected though, and the events are being received by libinput. Version-Release number of selected component (if applicable): xorg-x11-drv-libinput-0.27.1-2.fc27.x86_64 xorg-x11-server-utils-7.7-23.fc27.x86_64 How reproducible: Very easily
These devices usually have a key to trigger the camera function, that's why they're regarded as keyboard device. Not as much of a mystery as you were hoping for, but we can't all be Loch Ness :) What I'm missing in the xorg log is this message you should get when removing it: (II) config/udev: removing device Logitech Gaming Mouse G303 obviously with your device's name but the important bit is "config/udev", which means that the device was properly removed and the message was sent to the server. Without that, the device shuts down but the server waits with the real removal until udev tells us it's gone. If you look at the event nodes, they are counting up, from event5 for the first connect to event295 when the final message appears. The kernel re-uses the event node numbers, you should never get to 295 in any sane setup. This indicates that the kernel doesn't release the devices correctly when the hub goes away. Would be interesting to see the output of sudo evemu-record without arguments, it probably lists the webcam a million times. Either way, this isn't a bug with libinput or with the server. We never get told that the device is gone so we keep it around. This may be a kernel bug but I'd guess it's an issue with that USB hub being dodgy. when you reproduce it with directly unplugging, do you plug it into that USB hub? Can you reproduce it plugging it straight into the box itself?
Happening here as well, when I dock the laptop -- not all the time though. Here's the evemu-record output: [root@pc96 ~]# evemu-record Available devices: /dev/input/event0: Lid Switch /dev/input/event1: Power Button /dev/input/event2: Sleep Button /dev/input/event3: Power Button /dev/input/event4: AT Translated Set 2 keyboard /dev/input/event5: AlpsPS/2 ALPS DualPoint Stick /dev/input/event6: AlpsPS/2 ALPS DualPoint TouchPad /dev/input/event7: Video Bus /dev/input/event8: HDA Intel PCH Dock Mic /dev/input/event9: HDA Intel PCH Headset Mic /dev/input/event10: HDA Intel PCH Dock Line Out /dev/input/event11: HDA Intel PCH Headphone /dev/input/event12: HDA Intel PCH HDMI/DP,pcm=3 /dev/input/event13: HDA Intel PCH HDMI/DP,pcm=7 /dev/input/event14: HDA Intel PCH HDMI/DP,pcm=8 /dev/input/event15: Dell WMI hotkeys /dev/input/event16: Laptop_Integrated_Webcam_E4HD: /dev/input/event17: UVC Camera (046d:0994) /dev/input/event18: NOVATEK USB Keyboard /dev/input/event19: UVC Camera (046d:0994) /dev/input/event20: UVC Camera (046d:0994) /dev/input/event21: NOVATEK USB Keyboard /dev/input/event22: UVC Camera (046d:0994) /dev/input/event23: UVC Camera (046d:0994) /dev/input/event24: UVC Camera (046d:0994) /dev/input/event25: UVC Camera (046d:0994) /dev/input/event26: UVC Camera (046d:0994) /dev/input/event27: UVC Camera (046d:0994) /dev/input/event28: UVC Camera (046d:0994) /dev/input/event29: UVC Camera (046d:0994) /dev/input/event30: UVC Camera (046d:0994) /dev/input/event31: UVC Camera (046d:0994) /dev/input/event256: WWW.TUACT.COM VENOM-X_MOUSE VENOM-X_MOUSE /dev/input/event257: UVC Camera (046d:0994) /dev/input/event258: UVC Camera (046d:0994) /dev/input/event259: UVC Camera (046d:0994) /dev/input/event260: UVC Camera (046d:0994) /dev/input/event261: UVC Camera (046d:0994) /dev/input/event262: UVC Camera (046d:0994) /dev/input/event263: UVC Camera (046d:0994) /dev/input/event264: UVC Camera (046d:0994) /dev/input/event265: UVC Camera (046d:0994) /dev/input/event266: UVC Camera (046d:0994) /dev/input/event267: UVC Camera (046d:0994) /dev/input/event268: UVC Camera (046d:0994) /dev/input/event269: UVC Camera (046d:0994) /dev/input/event270: WWW.TUACT.COM VENOM-X_MOUSE VENOM-X_MOUSE /dev/input/event271: UVC Camera (046d:0994) /dev/input/event272: WWW.TUACT.COM VENOM-X_MOUSE VENOM-X_MOUSE /dev/input/event273: UVC Camera (046d:0994) /dev/input/event274: UVC Camera (046d:0994) /dev/input/event275: UVC Camera (046d:0994) /dev/input/event276: UVC Camera (046d:0994) Select the device event number [0-276]: I'll plug the camera and the mouse directly into the laptop and wait for it to happen again.
> These devices usually have a key to trigger the camera function, that's why they're regarded as keyboard device. Not as much of a mystery as you were hoping for, but we can't all be Loch Ness :) Fair enough :-) Mine actually does not have a hardware button AFAIK, but I guess the driver is playing it safe. > when you reproduce it with directly unplugging, do you plug it into that USB hub? Yes, I have been plugging it back into the same hub. > Can you reproduce it plugging it straight into the box itself? Yes, it is exactly the same behavior plugging the device into the box itself. Just to make the test complete, I have also purchased a new hub and see the same behavior with that new hub as well. > Would be interesting to see the output of sudo evemu-record without arguments, it probably lists the webcam a million times. Yup: # evemu-record Available devices: /dev/input/event0: Power Button /dev/input/event1: Power Button /dev/input/event2: SteelSeries SteelSeries Arctis 7 /dev/input/event3: HD Pro Webcam C920 /dev/input/event4: Genius Optical Mouse /dev/input/event5: HD Pro Webcam C920 /dev/input/event6: Device 2Port KVMSwitcher /dev/input/event7: HD Pro Webcam C920 /dev/input/event8: HD Pro Webcam C920 /dev/input/event9: Eee PC WMI hotkeys /dev/input/event10: HD-Audio Generic Front Mic /dev/input/event11: HD-Audio Generic Rear Mic /dev/input/event12: HD-Audio Generic Line Out Front /dev/input/event13: HD-Audio Generic Line Out Surround /dev/input/event14: HD-Audio Generic Line Out CLFE /dev/input/event15: HD-Audio Generic Headphone /dev/input/event16: HD-Audio Generic Front Headphone /dev/input/event17: HD Pro Webcam C920 /dev/input/event18: HD Pro Webcam C920 /dev/input/event19: HD Pro Webcam C920 /dev/input/event20: HD Pro Webcam C920 /dev/input/event21: HD Pro Webcam C920 /dev/input/event22: HD Pro Webcam C920 /dev/input/event23: HD Pro Webcam C920 /dev/input/event24: HD Pro Webcam C920 /dev/input/event25: HD Pro Webcam C920 /dev/input/event26: HD Pro Webcam C920 /dev/input/event27: HD Pro Webcam C920 /dev/input/event28: HD Pro Webcam C920 /dev/input/event29: HD Pro Webcam C920 /dev/input/event30: HD Pro Webcam C920 /dev/input/event31: HD Pro Webcam C920 /dev/input/event256: HD Pro Webcam C920 /dev/input/event257: HD Pro Webcam C920 /dev/input/event258: HD Pro Webcam C920 /dev/input/event259: HD Pro Webcam C920 /dev/input/event260: HD Pro Webcam C920 /dev/input/event261: HD Pro Webcam C920 /dev/input/event262: HD Pro Webcam C920 /dev/input/event263: HD Pro Webcam C920 /dev/input/event264: HD Pro Webcam C920 /dev/input/event265: HD Pro Webcam C920 /dev/input/event266: HD Pro Webcam C920 /dev/input/event267: HD Pro Webcam C920 /dev/input/event268: HD Pro Webcam C920 /dev/input/event269: HD Pro Webcam C920 /dev/input/event270: HD Pro Webcam C920 /dev/input/event271: HD Pro Webcam C920 /dev/input/event272: Logitech MK700 /dev/input/event273: HD Pro Webcam C920 /dev/input/event274: HD Pro Webcam C920 /dev/input/event275: HD Pro Webcam C920 /dev/input/event276: HD Pro Webcam C920 /dev/input/event277: HD Pro Webcam C920 /dev/input/event278: HD Pro Webcam C920 /dev/input/event279: Logitech Performance MX /dev/input/event280: HD Pro Webcam C920 /dev/input/event281: HD Pro Webcam C920 /dev/input/event282: HD Pro Webcam C920 /dev/input/event283: HD Pro Webcam C920 /dev/input/event284: HD Pro Webcam C920 /dev/input/event285: HD Pro Webcam C920 /dev/input/event286: HD Pro Webcam C920 /dev/input/event287: HD Pro Webcam C920 /dev/input/event288: HD Pro Webcam C920 /dev/input/event289: HD Pro Webcam C920 /dev/input/event290: HD Pro Webcam C920 /dev/input/event291: HD Pro Webcam C920 /dev/input/event292: HD Pro Webcam C920 /dev/input/event293: HD Pro Webcam C920 /dev/input/event294: HD Pro Webcam C920 /dev/input/event295: HD Pro Webcam C920 /dev/input/event296: HD Pro Webcam C920 > This may be a kernel bug but I'd guess it's an issue with that USB hub being dodgy Doesn't seem like it is an issue with the USB hub, based on the test above. I've also tried this with kernel 4.16.11-200.fc27.x86_64 with the same behavior. I noticed something else interesting -- after I unplugged and replugged the camera a whole bunch of times to reproduce this, the old USB hub no longer disconnects periodically on its own. It had been stable for almost 48 hours (normally these disconnects happen several times a day). The camera was being "ignored" by libinput, but the camera function, which is not dependent on libinput, still worked. Given that and my test above, it certainly seems like the periodic hub disconnects are actually caused by the kernel, and not due to the hub itself at all. Furthermore, the disconnects of the hub seem related to this problem somehow.
Punting this to the kernel, since it triggers only with the webcam and without the USB hub, it could be the webcam driver. Meanwhile, I recommend using this in /etc/X11/xorg.conf.d/99-ignore-webcam.conf: Section "InputClass" Identifier "ignore the webcam" MatchProduct "HD Pro Webcam C920" Option "Ignore" "on" EndSection This will make the server ignore the webcam, so you get to use your mouse until you run out of event nodes in the kernel :)
*** This bug has been marked as a duplicate of bug 1564894 ***