[PATCH kdrive/ephyr v7 3/9] kdrive: introduce input hot-plugging support for udev and hal backends (#33140)

Laércio de Sousa laerciosousa at sme-mogidascruzes.sp.gov.br
Fri Feb 12 12:13:32 UTC 2016

2016-02-11 19:35 GMT-02:00 Peter Hutterer <peter.hutterer at who-t.net>:
> I just checked the kernel sources and there is no specific error case that
> this code can trigger, it's something to do with the fd itself (EBADF,
> EPERM, etc.). I guess fd is already closed/reset by the time you get here.
> What errno do you get?

I've got EBADF (Bad File Descriptor). Anyway, I realized that this error
message when trying to ungrab devices are unrelated to fd unregistering.

I've modified EvdevPtrDisable/EvdevKbdDisable functions, making them call
KdUnregisterFd *twice*. I don't know why, but it seems to solve my problem
(my "garbage collector" no longer detect orphan fds left behind and my
Xephyr no longer segfaults when I unplug/replug them).

Some more details about my issues:

1. This problem with incomplete fd unregistering only affects the device
with the *lowest* fd number (I've found it by swapping the keyboard and
mouse connections in my USB hub).

2. When I unplug the device with the lowest fd number (e.g. mouse), the one
with the highest fd number (e.g. keyboard) stops working. If I then unplug
this highest fd device, it does *not* disappear from "xinput list". When I
finally replug this device, it works again, but it appears "duplicated" in
"xinput list", with another fd number. Example:

⎡ Virtual core pointer                     id=2 [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer               id=4 [slave  pointer  (2)]
⎜   ↳ SIGMACHIP Usb Mouse                      id=6 [slave  pointer  (2)]
⎣ Virtual core keyboard                    id=3 [master keyboard (2)]
    ↳ Virtual core XTEST keyboard              id=5 [slave  keyboard (3)]
    ↳ HID 04f3:0103                            id=7 [slave  keyboard (3)]
    ↳ HID 04f3:0103                            id=8 [slave  keyboard (3)]

Crazily, issue 2 above only seems to affect Debian/Ubuntu systems. I have
another openSUSE box with Xephyr-based multi-seat configured, and it's not
affected by issue 2. I'll do more tests with this openSUSE box to see if
it's affected by issue 1.
*Laércio de Sousa*
*Orientador de Informática*
*Escola Municipal "Professor Eulálio Gruppi"*
*Rua Ismael da Silva Mello, 559, Mogi Moderno*
*Mogi das Cruzes - SPCEP 08717-390*
Telefone: (11) 4726-8313
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160212/690abb2f/attachment.html>

More information about the xorg-devel mailing list