On Sun, Sep 12, 2004 at 04:33:13AM +0400, Alexander N. Kozhushkin wrote: > Unfortunately, now I cannot present a full list of device drivers > which use the first and second approaches. However, the > "drivers/input/mousedev.c" file by Vojtech Pavlik is an example of > such a device driver. It offers the first approach for the mouse-like > devices with the minor numbers from 0 to 30, and the second one for > the so-called "MOUSEDEV_MIX" device with minor number 31.
This is intentional, as the only reason for mousedev to exist are old application that cannot use the event interface (which has the third approach semantics). There are applications (IIRC old versions of qtembedded and others) that break when read on a PS/2 device returns an error. Hence we can't. > Here is a patch for kernel 2.6.7 which makes that driver use the > third approach for the devices with minor numbers 0--30. Most likely, > the patch can be used for kernels 2.6.8 and 2.6.9 too. The archive > "tests.tgz" contains some very simple programs to test the patch and > the original mouse driver. The description of the changes to the > "mousedev.c" file can be found in the "patch.txt" file. > > The 'gpm' program, properly rewritten by me to support hotplug > mice, and the above tests work reliably on my computer with the > modified mouse driver. The X-server works reliably too if it uses the > data supplied by the modified version of the 'gmp', instead of the > real mouse data. Well, I think it'd be better if X and GPM were modified to use the event interface, which would remove several more limitations (like the number of buttons on a mouse). > > Sincerely yours, > Alexander. > > > -- > ********************************************************* > Alexander N. Kozhushkin. > ADDR: [EMAIL PROTECTED] > ********************************************************* > I have made the following changes to the "drivers/input/mousedev.c" file: > > 1. 'mousedev_write()', 'mousedev_read()': > The changes protect an application using the 'read()' function from > waiting indefinitely for a disconnected mouse. If the application > performs a read or write operation on the disconnected device, the > call fails with the 'ENODEV' error code. This behavior of the > 'read()' and 'write()' functions is proposed in the > "drivers/usb/usb-skeleton.c" file. > > 2. 'mousedev_poll()': > The changes protect an application using the 'select()' function > from waiting indefinitely for a disconnected mouse. If the mouse > was disconnected, each file descriptor of the respective device > file is assumed to be always ready for reading. The device > disconnection is assumed to be a permanent exceptional condition on > the file descriptor. The 'select()' function treats that file > descriptor as a valid and ready one. So if the file descriptor is > contained in a descriptor set supplied to a 'select()' call as an > argument, then the 'select()' function adds that file descriptor to > the respective output descriptor set, i.e., sets the appropriate > bit of the respective 'fd_set' input variable. In this case the > function returns successfully. The mouse disconnection and the > unusable file descriptor can be easily detected by checking the > results of the successive 'read()' calls, which make use of the > results of the 'select()' call, for the 'ENODEV' error. > > 3. 'mousedev_disconnect()': > a) Sending a 'SIGIO' signal. > This 'SIGIO' signal protects an application using the > 'sigsuspend()' function from waiting indefinitely for a 'SIGIO' > signal. If a file descriptor corresponds to a device special > file representing a mouse, and the 'O_ASYNC' status flag is set > on that file descriptor, a 'SIGIO' signal is generated when the > mouse becomes disconnected. > b) The pointers in the 'mousedev_table' are used only by the > 'mousedev_open()' and 'mousedev_connect()' functions, so the > 'mousedev_disconnect()' function can safely remove the pointer > corresponding to the disconnected mouse from the > 'mousedev_table'. > > 4. 'mousedev_free()': > The line "mousedev_table[mousedev->minor] = NULL;" is moved into > the 'mousedev_disconnect()' function. -- Vojtech Pavlik SuSE Labs, SuSE CR ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel