<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">2016-02-11 19:35 GMT-02:00 Peter Hutterer <span dir="ltr"><<a href="mailto:peter.hutterer@who-t.net" target="_blank">peter.hutterer@who-t.net</a>></span>:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I just checked the kernel sources and there is no specific error case that<br>
this code can trigger, it's something to do with the fd itself (EBADF,<br>
EPERM, etc.). I guess fd is already closed/reset by the time you get here.<br>
What errno do you get?</blockquote></div><div>I've got EBADF (Bad File Descriptor). Anyway, I realized that this error message when trying to ungrab devices are unrelated to fd unregistering.</div><div><br></div><div>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).</div><div><br></div><div>Some more details about my issues:</div><div><br></div><div>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).</div><div><br></div><div>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:</div><div><br></div><div><div style="font-size:12.8px">⎡ Virtual core pointer                    <span style="white-space:pre-wrap">     </span>id=2<span style="white-space:pre-wrap">    </span>[master pointer  (3)]</div><div style="font-size:12.8px">⎜   ↳ Virtual core XTEST pointer              <span style="white-space:pre-wrap">      </span>id=4<span style="white-space:pre-wrap">    </span>[slave  pointer  (2)]</div><div style="font-size:12.8px">⎜   ↳ SIGMACHIP Usb Mouse                     <span style="white-space:pre-wrap"> </span>id=6<span style="white-space:pre-wrap">    </span>[slave  pointer  (2)]</div><div style="font-size:12.8px">⎣ Virtual core keyboard                   <span style="white-space:pre-wrap"> </span>id=3<span style="white-space:pre-wrap">    </span>[master keyboard (2)]</div><div style="font-size:12.8px">    ↳ Virtual core XTEST keyboard             <span style="white-space:pre-wrap">        </span>id=5<span style="white-space:pre-wrap">    </span>[slave  keyboard (3)]</div><div style="font-size:12.8px">    ↳ HID 04f3:0103                           <span style="white-space:pre-wrap">        </span>id=7<span style="white-space:pre-wrap">    </span>[slave  keyboard (3)]</div></div><div style="font-size:12.8px"><span style="font-size:12.8px">    ↳ HID 04f3:0103                          </span><span style="font-size:12.8px"> </span><span style="font-size:12.8px;white-space:pre-wrap">   </span><span style="font-size:12.8px">id=8</span><span style="font-size:12.8px;white-space:pre-wrap">       </span><span style="font-size:12.8px">[slave  keyboard (3)]</span><br></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">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.</span></div>-- <br><div><div dir="ltr"><div><b>Laércio de Sousa</b><br></div><div style="text-align:center"><div style="text-align:left"><i>Orientador de Informática</i></div><div style="text-align:left"><u>Escola Municipal "Professor Eulálio Gruppi"</u></div><div style="text-align:left"><i>Rua Ismael da Silva Mello, 559, Mogi Moderno</i></div><i><div style="text-align:left"><i>Mogi das Cruzes - SP</i></div><div style="text-align:left"><i>CEP 08717-390</i></div></i></div><div><span style="font-family:arial;font-size:small">Telefone: (11) 4726-8313</span></div></div></div>
</div></div>