From: Aivils S. <Aiv...@un...> - 2003-11-27 08:41:47
|
Hi All! What happen on USB device replug or restore after failure. 1) on unplug kernel remove device file (/dev/input/mouse0) 2) all open file descriptors become invalid, xf86 mouse device file descriptor included here. 3) on plug kernel creates device file again, but no more file descriptors point to this file. Also, we should reopen device file in userspace program. xf86 do not read bytes from device file periodic, but wait for signals, which notify about changes. When kernel close device file, then file descriptor is invalid and do not recive signals from kernel, even kernel creates new device file, xf86 mouse is dead. I know how to reopen mouse device file. To recive signals i use switch to text mode console and back to xf86. After xf86 patching i can unplug USB mouse , plug again, perform Ctrl-Alt-F1,Ctrl-F7 and my xf86 works as nothing happens. Of course as xf86 mouse device i use /dev/symlink_to_real_mouse, created by input.agent. input.agent is necessary, because kernel may instead /dev/input/mouse0 create /dev/input/mouse1. Unfortunately 2nd xf86 user cannot switch to text mode console and function pFoo->read_input() must be called forced , see file xf86Events.c functions xf86Wakeup() xf86SigioReadInput(). Forced mode not implemented in my patch :( May be any other may help me complete this stuff? against XFree86 4.3.0 --- xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c 2003-02-11 05:33:06.000000000 +0200 +++ xc-chg/programs/Xserver/hw/xfree86/input/mouse/mouse.c 2003-11-26 23:59:08.000000000 +0200 @@ -1474,6 +1474,18 @@ MouseReadInput(InputInfoPtr pInfo) ErrorF(" %02x",pBuf[j]); ErrorF("\n"); #endif + if(c == -2) { + xf86CloseSerial(pInfo->fd); + XisbFree(pMse->buffer); + pMse->buffer = NULL; + pInfo->fd = xf86OpenSerial(pInfo->options); + if(pInfo->fd == -1) + xf86Msg(X_WARNING, "%s: cannot reopen input device\n", pInfo->name); + else { + pMse->buffer = XisbNew(pInfo->fd, 64); + xf86FlushInput(pInfo->fd); + } + } post_event: #ifdef EXTMOUSEDEBUG Aivils Stoss p.s. IMHO You cannot replug PS/2 or serial mouse! |