bk://kernel.bkbits.net/vojtech/input vojtech@suse.cz|ChangeSet|20050313222837|17996 vojtech # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/03/16 00:07:10-08:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-input # # Documentation/kernel-parameters.txt # 2005/03/16 00:07:05-08:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2005/03/14 23:59:57-08:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-input # # drivers/input/serio/i8042-x86ia64io.h # 2005/03/14 23:59:53-08:00 akpm@bix.(none) +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2005/03/14 23:59:53-08:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2005/03/13 14:35:54-08:00 akpm@bix.(none) # Merge bk://kernel.bkbits.net/vojtech/input # into bix.(none):/usr/src/bk-input # # Documentation/kernel-parameters.txt # 2005/03/13 14:35:50-08:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2005/03/13 23:28:37+01:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # Documentation/kernel-parameters.txt # 2005/03/13 23:28:31+01:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2005/03/13 20:19:37+01:00 akropel1@rochester.rr.com # input: HID items of width 32 (bits) or greater are incorrectly extracted due to # a masking bug in hid-core.c:extract(). This patch fixes it up by forcing # the mask to be 64 bits wide. # # # Signed-off-by: Adam Kropelin # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hid-core.c # 2005/03/13 20:19:24+01:00 akropel1@rochester.rr.com +1 -1 # input: HID items of width 32 (bits) or greater are incorrectly extracted due to # a masking bug in hid-core.c:extract(). This patch fixes it up by forcing # the mask to be 64 bits wide. # # # Signed-off-by: Adam Kropelin # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/13 19:29:10+01:00 vojtech@suse.cz # input: Workaround for Sunrex K8561 IR Keyboard/Mouse. The mouse # sends an incorrect ID and wasn't recognized. # # Reported-by: Stefan Seyfried # Signed-off-by: Vojtech Pavlik # # drivers/input/mouse/psmouse-base.c # 2005/03/13 19:28:59+01:00 vojtech@suse.cz +4 -1 # input: Workaround for Sunrex K8561 IR Keyboard/Mouse. The mouse # sends an incorrect ID and wasn't recognized. # # Reported-by: Stefan Seyfried # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/13 16:29:22+01:00 vojtech@suse.cz # input: Add a new I-Force device to the iforce driver. # # From: Marian-Nicolae V. Ion # Signed-off-by: Vojtech Pavlik # # drivers/input/joystick/iforce/iforce-usb.c # 2005/03/13 16:29:08+01:00 vojtech@suse.cz +1 -0 # input: Add a new I-Force device to the iforce driver. # # From: Marian-Nicolae V. Ion # Signed-off-by: Vojtech Pavlik # # drivers/input/joystick/iforce/iforce-main.c # 2005/03/13 16:29:08+01:00 vojtech@suse.cz +1 -0 # input: Add a new I-Force device to the iforce driver. # # From: Marian-Nicolae V. Ion # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/12 13:09:10-08:00 akpm@bix.(none) # Merge bk://kernel.bkbits.net/vojtech/input # into bix.(none):/usr/src/bk-input # # sound/pci/cs4281.c # 2005/03/12 13:09:04-08:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2005/03/12 13:07:40-08:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-input # # Documentation/kernel-parameters.txt # 2005/03/12 13:07:36-08:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2005/03/12 13:10:08+01:00 vojtech@suse.cz # Merge bk://dtor.bkbits.net/input into suse.cz:/home/vojtech/bk/input # # drivers/usb/input/hid-core.c # 2005/03/12 13:10:02+01:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2005/03/12 03:09:22-05:00 dtor_core@ameritech.net # Input: fix open/close races in joystick drivers - add a # a semaphore to the ones that register more than one # input device. # # Signed-off-by: Dmitry Torokhov # # drivers/input/joystick/turbografx.c # 2005/03/12 03:09:13-05:00 dtor_core@ameritech.net +16 -3 # Add a semaphore to serialize open and close methods. # # drivers/input/joystick/gamecon.c # 2005/03/12 03:09:13-05:00 dtor_core@ameritech.net +16 -3 # Add a semaphore to serialize open and close methods. # # drivers/input/joystick/db9.c # 2005/03/12 03:09:13-05:00 dtor_core@ameritech.net +13 -4 # Add a semaphore to serialize open and close methods. # # drivers/input/joystick/amijoy.c # 2005/03/12 03:09:13-05:00 dtor_core@ameritech.net +16 -13 # Add a semaphore to serialize open and close methods. # # ChangeSet # 2005/03/12 03:09:00-05:00 dtor_core@ameritech.net # Input: remove user counters from drivers/input/touchscreen since # input core takes care of calling open and close methods # only when needed. # # Signed-off-by: Dmitry Torokhov # # drivers/input/touchscreen/mk712.c # 2005/03/12 03:08:52-05:00 dtor_core@ameritech.net +7 -12 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # ChangeSet # 2005/03/12 03:08:34-05:00 dtor_core@ameritech.net # Input: remove user counters from drivers/usb/input since input # core takes care of calling open and close methods only # when needed. # # Signed-off-by: Dmitry Torokhov # # drivers/usb/input/xpad.c # 2005/03/12 03:08:25-05:00 dtor_core@ameritech.net +2 -9 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/usb/input/wacom.c # 2005/03/12 03:08:25-05:00 dtor_core@ameritech.net +2 -9 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/usb/input/usbmouse.c # 2005/03/12 03:08:25-05:00 dtor_core@ameritech.net +2 -9 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/usb/input/usbkbd.c # 2005/03/12 03:08:25-05:00 dtor_core@ameritech.net +2 -9 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/usb/input/touchkitusb.c # 2005/03/12 03:08:25-05:00 dtor_core@ameritech.net +2 -9 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/usb/input/mtouchusb.c # 2005/03/12 03:08:25-05:00 dtor_core@ameritech.net +2 -9 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/usb/input/kbtab.c # 2005/03/12 03:08:25-05:00 dtor_core@ameritech.net +2 -9 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/usb/input/itmtouch.c # 2005/03/12 03:08:25-05:00 dtor_core@ameritech.net +2 -8 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/usb/input/ati_remote.c # 2005/03/12 03:08:25-05:00 dtor_core@ameritech.net +5 -23 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/usb/input/aiptek.c # 2005/03/12 03:08:25-05:00 dtor_core@ameritech.net +2 -12 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # ChangeSet # 2005/03/12 03:08:01-05:00 dtor_core@ameritech.net # Input: remove user counters from drivers/input/mouse since input # core takes care of calling open and close methods only # when needed. # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/pc110pad.c # 2005/03/12 03:07:52-05:00 dtor_core@ameritech.net +1 -6 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/input/mouse/maplemouse.c # 2005/03/12 03:07:52-05:00 dtor_core@ameritech.net +23 -52 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/input/mouse/logibm.c # 2005/03/12 03:07:52-05:00 dtor_core@ameritech.net +0 -7 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/input/mouse/inport.c # 2005/03/12 03:07:52-05:00 dtor_core@ameritech.net +7 -13 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # drivers/input/mouse/amimouse.c # 2005/03/12 03:07:52-05:00 dtor_core@ameritech.net +1 -7 # Remove user counter from the driver; core takes care of calling # open/close only when needed. # # ChangeSet # 2005/03/12 03:07:37-05:00 dtor_core@ameritech.net # Input: add semaphore and user count to input_dev structure; # serialize open and close calls and ensure that device's # open and close methods are only called when first user # opens it or last user closes it. # # Signed-off-by: Dmitry Torokhov # # include/linux/input.h # 2005/03/12 03:07:28-05:00 dtor_core@ameritech.net +4 -0 # Add semaphore and user count to input_dev structure to serialize # open and close calls. # # drivers/input/input.c # 2005/03/12 03:07:28-05:00 dtor_core@ameritech.net +28 -5 # Serialize open and close calls. # # ChangeSet # 2005/03/12 03:07:15-05:00 dtor_core@ameritech.net # Input: maple_keyb - remove useless dc_kbd_open and dc_kbd_close # functions as they are not doing anything. # # Signed-off-by: Dmitry Torokhov # # drivers/input/keyboard/maple_keyb.c # 2005/03/12 03:07:07-05:00 dtor_core@ameritech.net +0 -20 # Remove useless dc_kbd_open and dc_kbd_close functions # # ChangeSet # 2005/03/12 03:06:55-05:00 dtor_core@ameritech.net # Input: mtouchusb was indented with spaces instead of tabs, pass # through Lindent and adjust results. # # Signed-off-by: Dmitry Torokhov # # drivers/usb/input/mtouchusb.c # 2005/03/12 03:06:46-05:00 dtor_core@ameritech.net +197 -210 # Pass through Lindent to convert spaces into tabs # # ChangeSet # 2005/03/12 03:06:16-05:00 dtor_core@ameritech.net # Input: whitespace fixes in drivers/usb/input # # Signed-off-by: Dmitry Torokhov # # drivers/usb/input/xpad.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +33 -33 # Whitespace fixes # # drivers/usb/input/wacom.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +23 -23 # Whitespace fixes # # drivers/usb/input/usbmouse.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +10 -10 # Whitespace fixes # # drivers/usb/input/usbkbd.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +9 -9 # Whitespace fixes # # drivers/usb/input/powermate.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +15 -15 # Whitespace fixes # # drivers/usb/input/kbtab.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +3 -3 # Whitespace fixes # # drivers/usb/input/itmtouch.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +24 -31 # Whitespace fixes # # drivers/usb/input/hiddev.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +28 -28 # Whitespace fixes # # drivers/usb/input/hid.h # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +9 -9 # Whitespace fixes # # drivers/usb/input/hid-lgff.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +9 -9 # Whitespace fixes # # drivers/usb/input/hid-input.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +8 -8 # Whitespace fixes # # drivers/usb/input/hid-debug.h # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +8 -8 # Whitespace fixes # # drivers/usb/input/hid-core.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +2 -2 # Whitespace fixes # # drivers/usb/input/ati_remote.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +110 -111 # Whitespace fixes # # drivers/usb/input/aiptek.c # 2005/03/12 03:06:06-05:00 dtor_core@ameritech.net +9 -9 # Whitespace fixes # # ChangeSet # 2005/03/12 03:05:52-05:00 dtor_core@ameritech.net # Input: whitespace fixes in driver/input/joystick # # Signed-off-by: Dmitry Torokhov # # drivers/input/joystick/turbografx.c # 2005/03/12 03:05:43-05:00 dtor_core@ameritech.net +9 -9 # Whitespace fixes # # drivers/input/joystick/tmdc.c # 2005/03/12 03:05:43-05:00 dtor_core@ameritech.net +1 -1 # Whitespace fixes # # drivers/input/joystick/spaceorb.c # 2005/03/12 03:05:43-05:00 dtor_core@ameritech.net +1 -1 # Whitespace fixes # # drivers/input/joystick/spaceball.c # 2005/03/12 03:05:43-05:00 dtor_core@ameritech.net +2 -2 # Whitespace fixes # # drivers/input/joystick/grip_mp.c # 2005/03/12 03:05:43-05:00 dtor_core@ameritech.net +1 -1 # Whitespace fixes # # drivers/input/joystick/gf2k.c # 2005/03/12 03:05:43-05:00 dtor_core@ameritech.net +1 -1 # Whitespace fixes # # drivers/input/joystick/gamecon.c # 2005/03/12 03:05:43-05:00 dtor_core@ameritech.net +5 -5 # Whitespace fixes # # drivers/input/joystick/adi.c # 2005/03/12 03:05:43-05:00 dtor_core@ameritech.net +2 -2 # Whitespace fixes # # drivers/input/joystick/a3d.c # 2005/03/12 03:05:43-05:00 dtor_core@ameritech.net +1 -1 # Whitespace fixes # # ChangeSet # 2005/03/12 03:05:23-05:00 dtor_core@ameritech.net # Input: whitespace fixes in drivers/input/touchscreen # # Signed-off-by: Dmitry Torokhov # # drivers/input/touchscreen/mk712.c # 2005/03/12 03:05:14-05:00 dtor_core@ameritech.net +1 -1 # Whitespace fixes # # drivers/input/touchscreen/h3600_ts_input.c # 2005/03/12 03:05:14-05:00 dtor_core@ameritech.net +92 -92 # Whitespace fixes # # drivers/input/touchscreen/elo.c # 2005/03/12 03:05:14-05:00 dtor_core@ameritech.net +1 -1 # Whitespace fixes # # ChangeSet # 2005/03/12 03:04:10-05:00 dtor_core@ameritech.net # Input: whitespace fixes in drivers/input/keyboard # # Signed-off-by: Dmitry Torokhov # # drivers/input/keyboard/maple_keyb.c # 2005/03/12 03:04:01-05:00 dtor_core@ameritech.net +1 -1 # Whitespace fixes # # drivers/input/keyboard/locomokbd.c # 2005/03/12 03:04:01-05:00 dtor_core@ameritech.net +14 -14 # Import patch input-kbd-whitespace.patch # # drivers/input/keyboard/lkkbd.c # 2005/03/12 03:04:01-05:00 dtor_core@ameritech.net +4 -4 # Whitespace fixes # # drivers/input/keyboard/atkbd.c # 2005/03/12 03:04:01-05:00 dtor_core@ameritech.net +3 -3 # Whitespace fixes # # ChangeSet # 2005/03/12 03:03:35-05:00 dtor_core@ameritech.net # Input: whitespace fixes in drivers/input/mouse # # Signed-off-by: Dmitry Torokhov # # drivers/input/mouse/vsxxxaa.c # 2005/03/12 03:03:26-05:00 dtor_core@ameritech.net +2 -2 # Whitespace fixes # # drivers/input/mouse/rpcmouse.c # 2005/03/12 03:03:26-05:00 dtor_core@ameritech.net +1 -1 # Whitespace fixes # # drivers/input/mouse/psmouse.h # 2005/03/12 03:03:26-05:00 dtor_core@ameritech.net +1 -1 # Whitespace fixes # # drivers/input/mouse/pc110pad.c # 2005/03/12 03:03:26-05:00 dtor_core@ameritech.net +7 -7 # Whitespace fixes # # drivers/input/mouse/maplemouse.c # 2005/03/12 03:03:26-05:00 dtor_core@ameritech.net +2 -2 # Whitespace fixes # # drivers/input/mouse/logibm.c # 2005/03/12 03:03:26-05:00 dtor_core@ameritech.net +5 -5 # Whitespace fixes # # drivers/input/mouse/inport.c # 2005/03/12 03:03:26-05:00 dtor_core@ameritech.net +9 -9 # Whitespace fixes # # drivers/input/mouse/alps.c # 2005/03/12 03:03:26-05:00 dtor_core@ameritech.net +9 -11 # Whitespace fixes # # ChangeSet # 2005/03/11 13:27:57-08:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-input # # sound/pci/cs4281.c # 2005/03/11 13:27:53-08:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2005/03/11 21:54:54+01:00 vojtech@suse.cz # input: Fix a warning in hid-core. # # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hid-core.c # 2005/03/11 21:54:41+01:00 vojtech@suse.cz +1 -1 # input: Fix a warning in hid-core. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/11 21:51:57+01:00 garloff@suse.de # input: Avoid double unregistering of i8042 PnP driver. This can happen # when no i8042 controller (not PnP, not legacy) is present. # # From: Kurt Garloff # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042-x86ia64io.h # 2005/03/11 21:51:45+01:00 garloff@suse.de +6 -2 # input: Avoid double unregistering of i8042 PnP driver. This can happen # when no i8042 controller (not PnP, not legacy) is present. # # From: Kurt Garloff # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/11 20:40:25+01:00 vojtech@suse.cz # Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input # # sound/pci/cs4281.c # 2005/03/11 20:40:18+01:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2005/03/10 23:07:22+01:00 vojtech@suse.cz # Manual merge # # drivers/usb/input/hid-core.c # 2005/03/10 23:07:17+01:00 vojtech@suse.cz +0 -1 # Manual merge # # sound/oss/esssolo1.c # 2005/03/10 23:04:28+01:00 vojtech@suse.cz +0 -0 # Auto merged # # sound/oss/es1370.c # 2005/03/10 23:04:28+01:00 vojtech@suse.cz +0 -0 # Auto merged # # sound/oss/cmpci.c # 2005/03/10 23:04:28+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/wacom.c # 2005/03/10 23:04:28+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/powermate.c # 2005/03/10 23:04:28+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/mtouchusb.c # 2005/03/10 23:04:28+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/ati_remote.c # 2005/03/10 23:04:28+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/char/keyboard.c # 2005/03/10 23:04:28+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2005/03/10 23:04:28+01:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2005/03/10 23:04:28+01:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2005/03/10 22:50:54+01:00 vojtech@suse.cz # input: Remove (now) unusued variable in i8042.c # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2005/03/10 22:50:43+01:00 vojtech@suse.cz +0 -2 # input: Remove (now) unusued variable in i8042.c # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/10 22:15:15+01:00 vojtech@suse.cz # input: Crystal SoundFusion (cs461x) gameport support isn't needed # either, since ALSA handles it nicely. # # Signed-off-by: Vojtech Pavlik # # drivers/input/gameport/Makefile # 2005/03/10 22:15:04+01:00 vojtech@suse.cz +0 -1 # input: Crystal SoundFusion (cs461x) gameport support isn't needed # either, since ALSA handles it nicely. # # Signed-off-by: Vojtech Pavlik # # drivers/input/gameport/Kconfig # 2005/03/10 22:15:04+01:00 vojtech@suse.cz +0 -3 # input: Crystal SoundFusion (cs461x) gameport support isn't needed # either, since ALSA handles it nicely. # # Signed-off-by: Vojtech Pavlik # # BitKeeper/deleted/.del-cs461x.c~c62857e597a2eea1 # 2005/03/10 22:13:39+01:00 vojtech@suse.cz +0 -0 # Delete: drivers/input/gameport/cs461x.c # # ChangeSet # 2005/03/10 22:07:18+01:00 vojtech@suse.cz # input: Kill Aureal Vortex 1/2 gameport driver. ALSA Aureal driver # offers the gameport part already. # # Signed-off-by: Vojtech Pavlik # # drivers/input/gameport/Makefile # 2005/03/10 22:07:07+01:00 vojtech@suse.cz +0 -1 # input: Kill Aureal Vortex 1/2 gameport driver. ALSA Aureal driver # offers the gameport part already. # # Signed-off-by: Vojtech Pavlik # # drivers/input/gameport/Kconfig # 2005/03/10 22:07:07+01:00 vojtech@suse.cz +0 -9 # input: Kill Aureal Vortex 1/2 gameport driver. ALSA Aureal driver # offers the gameport part already. # # Signed-off-by: Vojtech Pavlik # # BitKeeper/deleted/.del-vortex.c~f0f1102796f30b5 # 2005/03/10 22:05:02+01:00 vojtech@suse.cz +0 -0 # Delete: drivers/input/gameport/vortex.c # # ChangeSet # 2005/03/10 20:36:51+01:00 vojtech@suse.cz # input: Only write the CTR in i8042 resume function. Reading it is # wrong, since it may (will) contain nonsensical data. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042.c # 2005/03/10 20:36:36+01:00 vojtech@suse.cz +28 -20 # input: Only write the CTR in i8042 resume function. Reading it is # wrong, since it may (will) contain nonsensical data. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/10 17:36:23+01:00 vojtech@mivu.no # input: Probe PnP gameports first, ISA after that. # # Signed-off-by: Vojtech Pavlik # # drivers/input/gameport/ns558.c # 2005/03/10 17:36:16+01:00 vojtech@mivu.no +6 -6 # input: Probe PnP gameports first, ISA after that. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/10 17:17:56+01:00 hc@mivu.no # input: Add driver for ITM Touch USB touchscreens. # # From: Hans-Christian Egtvedt # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/itmtouch.c # 2005/03/10 17:17:49+01:00 hc@mivu.no +281 -0 # # drivers/usb/input/itmtouch.c # 2005/03/10 17:17:49+01:00 hc@mivu.no +0 -0 # BitKeeper file /home/vojtech/bk/input/drivers/usb/input/itmtouch.c # # drivers/usb/input/Makefile # 2005/03/10 17:17:49+01:00 hc@mivu.no +1 -0 # input: Add driver for ITM Touch USB touchscreens. # # From: Hans-Christian Egtvedt # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/Kconfig # 2005/03/10 17:17:49+01:00 hc@mivu.no +12 -0 # input: Add driver for ITM Touch USB touchscreens. # # From: Hans-Christian Egtvedt # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/10 17:03:17+01:00 dtor_core@ameritech.net # input: Tone down the severity of a printk() in i386/ia64 arch code # for i386, it's printed on many machines and usually is not # a cause for worry. # # Signed-off-by: Dmitry Torokhov # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042-x86ia64io.h # 2005/03/10 17:03:10+01:00 dtor_core@ameritech.net +1 -1 # input: Tone down the severity of a printk() in i386/ia64 arch code # for i386, it's printed on many machines and usually is not # a cause for worry. # # Signed-off-by: Dmitry Torokhov # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/10 16:58:39+01:00 bunk@stusta.de # input: This patch adds dummy gameport_register_port, gameport_unregister_port # and gameport_set_phys functions to gameport.h for the case when a driver # can't use gameport. # # This fixes the compilation of some OSS drivers with GAMEPORT=n without # the need to #if inside every single driver. # # This patch also removes the non-working and now obsolete SOUND_GAMEPORT. # # This patch is also an alternative solution for ALSA drivers with similar # problems (but #if's inside the drivers might have the advantage of # saving some more bytes of gameport is not available). # # The only user-visible change is that for GAMEPORT=m the affected OSS # drivers are now allowed to be built statically (but they won't have # gameport support). # # Signed-off-by: Adrian Bunk # # sound/oss/Kconfig # 2005/03/10 16:58:33+01:00 bunk@stusta.de +6 -6 # input: This patch adds dummy gameport_register_port, gameport_unregister_port # and gameport_set_phys functions to gameport.h for the case when a driver # can't use gameport. # # This fixes the compilation of some OSS drivers with GAMEPORT=n without # the need to #if inside every single driver. # # This patch also removes the non-working and now obsolete SOUND_GAMEPORT. # # This patch is also an alternative solution for ALSA drivers with similar # problems (but #if's inside the drivers might have the advantage of # saving some more bytes of gameport is not available). # # The only user-visible change is that for GAMEPORT=m the affected OSS # drivers are now allowed to be built statically (but they won't have # gameport support). # # Signed-off-by: Adrian Bunk # # include/linux/gameport.h # 2005/03/10 16:58:33+01:00 bunk@stusta.de +25 -3 # input: This patch adds dummy gameport_register_port, gameport_unregister_port # and gameport_set_phys functions to gameport.h for the case when a driver # can't use gameport. # # This fixes the compilation of some OSS drivers with GAMEPORT=n without # the need to #if inside every single driver. # # This patch also removes the non-working and now obsolete SOUND_GAMEPORT. # # This patch is also an alternative solution for ALSA drivers with similar # problems (but #if's inside the drivers might have the advantage of # saving some more bytes of gameport is not available). # # The only user-visible change is that for GAMEPORT=m the affected OSS # drivers are now allowed to be built statically (but they won't have # gameport support). # # Signed-off-by: Adrian Bunk # # drivers/input/gameport/Kconfig # 2005/03/10 16:58:33+01:00 bunk@stusta.de +0 -20 # input: This patch adds dummy gameport_register_port, gameport_unregister_port # and gameport_set_phys functions to gameport.h for the case when a driver # can't use gameport. # # This fixes the compilation of some OSS drivers with GAMEPORT=n without # the need to #if inside every single driver. # # This patch also removes the non-working and now obsolete SOUND_GAMEPORT. # # This patch is also an alternative solution for ALSA drivers with similar # problems (but #if's inside the drivers might have the advantage of # saving some more bytes of gameport is not available). # # The only user-visible change is that for GAMEPORT=m the affected OSS # drivers are now allowed to be built statically (but they won't have # gameport support). # # Signed-off-by: Adrian Bunk # # ChangeSet # 2005/03/10 16:40:59+01:00 vojtech@suse.cz # input: Make hid-core issue a SET_IDLE request before GET_REPORT, like Windows # does. This should make life easier for devices that were tested with # Windows only. # # Signed-off-by: Vojtech Pavlik # # drivers/usb/input/hid-core.c # 2005/03/10 16:40:52+01:00 vojtech@suse.cz +9 -4 # input: Make hid-core issue a SET_IDLE request before GET_REPORT, like Windows # does. This should make life easier for devices that were tested with # Windows only. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/10 16:32:50+01:00 vojtech@suse.cz # input: Fix a warning in evdev's 32-bit emulation code. # # Signed-off-by: Vojtech Pavlik # # drivers/input/evdev.c # 2005/03/10 16:32:44+01:00 vojtech@suse.cz +2 -0 # input: Fix a warning in evdev's 32-bit emulation code. # # ChangeSet # 2005/03/10 16:32:11+01:00 rpurdie@rpsys.net # input: Corgi keyboard driver - correct two keys which are much more useful # as function keys instead of special keys. # # Signed-off-by: Richard Purdie # Signed-off-by: Vojtech Pavlik # # drivers/input/keyboard/corgikbd.c # 2005/03/10 16:32:06+01:00 rpurdie@rpsys.net +4 -2 # input: Corgi keyboard driver - correct two keys which are much more useful # as function keys instead of special keys. # # Signed-off-by: Richard Purdie # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/10 15:50:10+01:00 vojtech@suse.cz # Manual merge # # drivers/usb/input/hid-core.c # 2005/03/10 15:50:05+01:00 vojtech@suse.cz +1 -3 # Manual merge # # sound/oss/esssolo1.c # 2005/03/10 15:46:05+01:00 vojtech@suse.cz +0 -0 # Auto merged # # sound/oss/es1370.c # 2005/03/10 15:46:05+01:00 vojtech@suse.cz +0 -0 # Auto merged # # sound/oss/cmpci.c # 2005/03/10 15:46:05+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/wacom.c # 2005/03/10 15:46:04+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/powermate.c # 2005/03/10 15:46:04+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/mtouchusb.c # 2005/03/10 15:46:04+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/usb/input/ati_remote.c # 2005/03/10 15:46:04+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/char/keyboard.c # 2005/03/10 15:46:04+01:00 vojtech@suse.cz +0 -0 # Auto merged # # drivers/Makefile # 2005/03/10 15:46:04+01:00 vojtech@suse.cz +0 -0 # Auto merged # # Documentation/kernel-parameters.txt # 2005/03/10 15:46:04+01:00 vojtech@suse.cz +0 -0 # Auto merged # # ChangeSet # 2005/03/10 10:50:47+01:00 jk@blackdown.de # input: Add support for 32-bit emulation on 64-bit platforms for evdev. # # Signed-off-by: Juergen Kreileder # Signed-off-by: Vojtech Pavlik # # drivers/input/evdev.c # 2005/03/10 10:50:42+01:00 jk@blackdown.de +266 -2 # input: Add support for 32-bit emulation on 64-bit platforms for evdev. # # Signed-off-by: Juergen Kreileder # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/10 10:47:48+01:00 jeremy@goop.org # input: This patch implements compat_ioctl for joydev. I've tested it with a # Logitech WingMan Rumblepad on an x86-64 machine, and on an ia32 machine to # make sure I didn't break anything. # # Signed-off-by: Jeremy Fitzhardinge # Signed-off-by: Andrew Morton # Signed-off-by: Vojtech Pavlik # # include/linux/joystick.h # 2005/03/10 10:47:41+01:00 jeremy@goop.org +25 -8 # input: This patch implements compat_ioctl for joydev. I've tested it with a # Logitech WingMan Rumblepad on an x86-64 machine, and on an ia32 machine to # make sure I didn't break anything. # # Signed-off-by: Jeremy Fitzhardinge # Signed-off-by: Andrew Morton # Signed-off-by: Vojtech Pavlik # # drivers/input/joydev.c # 2005/03/10 10:47:41+01:00 jeremy@goop.org +91 -25 # input: This patch implements compat_ioctl for joydev. I've tested it with a # Logitech WingMan Rumblepad on an x86-64 machine, and on an ia32 machine to # make sure I didn't break anything. # # Signed-off-by: Jeremy Fitzhardinge # Signed-off-by: Andrew Morton # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/09 07:50:58+01:00 vojtech@suse.cz # input: Add a missing KERN_INFO message designation, fix behavior # when only a keyboard part of the controller is detected. # # Signed-off-by: Vojtech Pavlik # # drivers/input/serio/i8042-x86ia64io.h # 2005/03/09 07:50:47+01:00 vojtech@suse.cz +2 -2 # input: Add a missing KERN_INFO message designation, fix behavior # when only a keyboard part of the controller is detected. # # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/08 11:23:47+01:00 bunk@stusta.de # input: This patch fixes typos in gameport support of cs4281 ALSA # driver in the SUPPORT_JOYSTICK=n case. # # Signed-off-by: Adrian Bunk # Signed-off-by: Vojtech Pavlik # # sound/pci/cs4281.c # 2005/03/08 11:23:40+01:00 bunk@stusta.de +2 -2 # input: This patch fixes typos in gameport support of cs4281 ALSA # driver in the SUPPORT_JOYSTICK=n case. # # Signed-off-by: Adrian Bunk # Signed-off-by: Vojtech Pavlik # # ChangeSet # 2005/03/08 11:21:27+01:00 akpm@osdl.org # input: Fix a warning in psmouse-base.c # # Signed-off-by: Andrew Morton # Signed-off-by: Vojtech Pavlik # # drivers/input/mouse/psmouse-base.c # 2005/03/08 11:10:21+01:00 akpm@osdl.org +1 -1 # input: Fix a warning in psmouse-base.c # # Signed-off-by: Andrew Morton # Signed-off-by: Vojtech Pavlik # diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c --- a/drivers/input/evdev.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/evdev.c 2005-03-16 00:08:29 -08:00 @@ -21,6 +21,7 @@ #include #include #include +#include struct evdev { int exist; @@ -145,6 +146,41 @@ return 0; } +#ifdef CONFIG_COMPAT +struct input_event_compat { + struct compat_timeval time; + __u16 type; + __u16 code; + __s32 value; +}; + +#ifdef CONFIG_X86_64 +# define COMPAT_TEST test_thread_flag(TIF_IA32) +#elif defined(CONFIG_IA64) +# define COMPAT_TEST IS_IA32_PROCESS(ia64_task_regs(current)) +#elif defined(CONFIG_ARCH_S390) +# define COMPAT_TEST test_thread_flag(TIF_31BIT) +#else +# define COMPAT_TEST test_thread_flag(TIF_32BIT) +#endif + +static ssize_t evdev_write_compat(struct file * file, const char __user * buffer, size_t count, loff_t *ppos) +{ + struct evdev_list *list = file->private_data; + struct input_event_compat event; + int retval = 0; + + while (retval < count) { + if (copy_from_user(&event, buffer + retval, sizeof(struct input_event_compat))) + return -EFAULT; + input_event(list->evdev->handle.dev, event.type, event.code, event.value); + retval += sizeof(struct input_event_compat); + } + + return retval; +} +#endif + static ssize_t evdev_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos) { struct evdev_list *list = file->private_data; @@ -153,6 +189,11 @@ if (!list->evdev->exist) return -ENODEV; +#ifdef CONFIG_COMPAT + if (COMPAT_TEST) + return evdev_write_compat(file, buffer, count, ppos); +#endif + while (retval < count) { if (copy_from_user(&event, buffer + retval, sizeof(struct input_event))) @@ -164,11 +205,56 @@ return retval; } +#ifdef CONFIG_COMPAT +static ssize_t evdev_read_compat(struct file * file, char __user * buffer, size_t count, loff_t *ppos) +{ + struct evdev_list *list = file->private_data; + int retval; + + if (count < sizeof(struct input_event_compat)) + return -EINVAL; + + if (list->head == list->tail && list->evdev->exist && (file->f_flags & O_NONBLOCK)) + return -EAGAIN; + + retval = wait_event_interruptible(list->evdev->wait, + list->head != list->tail || (!list->evdev->exist)); + + if (retval) + return retval; + + if (!list->evdev->exist) + return -ENODEV; + + while (list->head != list->tail && retval + sizeof(struct input_event_compat) <= count) { + struct input_event *event = (struct input_event *) list->buffer + list->tail; + struct input_event_compat event_compat; + event_compat.time.tv_sec = event->time.tv_sec; + event_compat.time.tv_usec = event->time.tv_usec; + event_compat.type = event->type; + event_compat.code = event->code; + event_compat.value = event->value; + + if (copy_to_user(buffer + retval, &event_compat, + sizeof(struct input_event_compat))) return -EFAULT; + list->tail = (list->tail + 1) & (EVDEV_BUFFER_SIZE - 1); + retval += sizeof(struct input_event_compat); + } + + return retval; +} +#endif + static ssize_t evdev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos) { struct evdev_list *list = file->private_data; int retval; +#ifdef CONFIG_COMPAT + if (COMPAT_TEST) + return evdev_read_compat(file, buffer, count, ppos); +#endif + if (count < sizeof(struct input_event)) return -EINVAL; @@ -203,7 +289,7 @@ (list->evdev->exist ? 0 : (POLLHUP | POLLERR)); } -static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) +static long evdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct evdev_list *list = file->private_data; struct evdev *evdev = list->evdev; @@ -389,6 +475,183 @@ return -EINVAL; } +#ifdef CONFIG_COMPAT + +#define BITS_PER_LONG_COMPAT (sizeof(compat_long_t) * 8) +#define NBITS_COMPAT(x) ((((x)-1)/BITS_PER_LONG_COMPAT)+1) +#define OFF_COMPAT(x) ((x)%BITS_PER_LONG_COMPAT) +#define BIT_COMPAT(x) (1UL<> OFF_COMPAT(bit)) & 1) + +static long evdev_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) +{ + struct evdev_list *list = file->private_data; + struct evdev *evdev = list->evdev; + struct input_dev *dev = evdev->handle.dev; + struct input_absinfo abs; + void __user *p = compat_ptr(arg); +#ifdef __BIG_ENDIAN + int i; +#endif + + if (!evdev->exist) return -ENODEV; + + switch (cmd) { + + case EVIOCGVERSION: + case EVIOCGID: + case EVIOCGKEYCODE: + case EVIOCSKEYCODE: + case EVIOCSFF: + case EVIOCRMFF: + case EVIOCGEFFECTS: + case EVIOCGRAB: + return evdev_ioctl(file, cmd, (unsigned long) p); + + default: + + if (_IOC_TYPE(cmd) != 'E' || _IOC_DIR(cmd) != _IOC_READ) + return -EINVAL; + + if ((_IOC_NR(cmd) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0,0))) { + + long *bits; + int len; + + switch (_IOC_NR(cmd) & EV_MAX) { + case 0: bits = dev->evbit; len = EV_MAX; break; + case EV_KEY: bits = dev->keybit; len = KEY_MAX; break; + case EV_REL: bits = dev->relbit; len = REL_MAX; break; + case EV_ABS: bits = dev->absbit; len = ABS_MAX; break; + case EV_MSC: bits = dev->mscbit; len = MSC_MAX; break; + case EV_LED: bits = dev->ledbit; len = LED_MAX; break; + case EV_SND: bits = dev->sndbit; len = SND_MAX; break; + case EV_FF: bits = dev->ffbit; len = FF_MAX; break; + default: return -EINVAL; + } + len = NBITS_COMPAT(len) * sizeof(compat_long_t); + if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); +#ifdef __BIG_ENDIAN + for (i = 0; i < len / sizeof(compat_long_t); i++) + if (copy_to_user((compat_long_t*) p + i, + (compat_long_t*) bits + i + 1 - ((i % 2) << 1), + sizeof(compat_long_t))) + return -EFAULT; + return len; +#else + return copy_to_user(p, bits, len) ? -EFAULT : len; +#endif + } + + if (_IOC_NR(cmd) == _IOC_NR(EVIOCGKEY(0))) { + int len; + len = NBITS_COMPAT(KEY_MAX) * sizeof(compat_long_t); + if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); +#ifdef __BIG_ENDIAN + for (i = 0; i < len / sizeof(compat_long_t); i++) + if (copy_to_user((compat_long_t*) p + i, + (compat_long_t*) dev->key + i + 1 - ((i % 2) << 1), + sizeof(compat_long_t))) + return -EFAULT; + return len; +#else + return copy_to_user(p, dev->key, len) ? -EFAULT : len; +#endif + } + + if (_IOC_NR(cmd) == _IOC_NR(EVIOCGLED(0))) { + int len; + len = NBITS_COMPAT(LED_MAX) * sizeof(compat_long_t); + if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); +#ifdef __BIG_ENDIAN + for (i = 0; i < len / sizeof(compat_long_t); i++) + if (copy_to_user((compat_long_t*) p + i, + (compat_long_t*) dev->led + i + 1 - ((i % 2) << 1), + sizeof(compat_long_t))) + return -EFAULT; + return len; +#else + return copy_to_user(p, dev->led, len) ? -EFAULT : len; +#endif + } + + if (_IOC_NR(cmd) == _IOC_NR(EVIOCGSND(0))) { + int len; + len = NBITS_COMPAT(SND_MAX) * sizeof(compat_long_t); + if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); +#ifdef __BIG_ENDIAN + for (i = 0; i < len / sizeof(compat_long_t); i++) + if (copy_to_user((compat_long_t*) p + i, + (compat_long_t*) dev->snd + i + 1 - ((i % 2) << 1), + sizeof(compat_long_t))) + return -EFAULT; + return len; +#else + return copy_to_user(p, dev->snd, len) ? -EFAULT : len; +#endif + } + + if (_IOC_NR(cmd) == _IOC_NR(EVIOCGNAME(0))) { + int len; + if (!dev->name) return -ENOENT; + len = strlen(dev->name) + 1; + if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); + return copy_to_user(p, dev->name, len) ? -EFAULT : len; + } + + if (_IOC_NR(cmd) == _IOC_NR(EVIOCGPHYS(0))) { + int len; + if (!dev->phys) return -ENOENT; + len = strlen(dev->phys) + 1; + if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); + return copy_to_user(p, dev->phys, len) ? -EFAULT : len; + } + + if (_IOC_NR(cmd) == _IOC_NR(EVIOCGUNIQ(0))) { + int len; + if (!dev->uniq) return -ENOENT; + len = strlen(dev->uniq) + 1; + if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd); + return copy_to_user(p, dev->uniq, len) ? -EFAULT : len; + } + + if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) { + + int t = _IOC_NR(cmd) & ABS_MAX; + + abs.value = dev->abs[t]; + abs.minimum = dev->absmin[t]; + abs.maximum = dev->absmax[t]; + abs.fuzz = dev->absfuzz[t]; + abs.flat = dev->absflat[t]; + + if (copy_to_user(p, &abs, sizeof(struct input_absinfo))) + return -EFAULT; + + return 0; + } + + if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) { + + int t = _IOC_NR(cmd) & ABS_MAX; + + if (copy_from_user(&abs, p, sizeof(struct input_absinfo))) + return -EFAULT; + + dev->abs[t] = abs.value; + dev->absmin[t] = abs.minimum; + dev->absmax[t] = abs.maximum; + dev->absfuzz[t] = abs.fuzz; + dev->absflat[t] = abs.flat; + + return 0; + } + } + return -EINVAL; +} +#endif + static struct file_operations evdev_fops = { .owner = THIS_MODULE, .read = evdev_read, @@ -396,7 +659,10 @@ .poll = evdev_poll, .open = evdev_open, .release = evdev_release, - .ioctl = evdev_ioctl, + .unlocked_ioctl = evdev_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = evdev_ioctl_compat, +#endif .fasync = evdev_fasync, .flush = evdev_flush }; diff -Nru a/drivers/input/gameport/Kconfig b/drivers/input/gameport/Kconfig --- a/drivers/input/gameport/Kconfig 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/gameport/Kconfig 2005-03-16 00:08:29 -08:00 @@ -48,39 +48,7 @@ To compile this driver as a module, choose M here: the module will be called emu10k1-gp. -config GAMEPORT_VORTEX - tristate "Aureal Vortex, Vortex 2 gameport support" - help - Say Y here if you have an Aureal Vortex 1 or 2 card and want - to use its gameport. - - To compile this driver as a module, choose M here: the - module will be called vortex. - config GAMEPORT_FM801 tristate "ForteMedia FM801 gameport support" -config GAMEPORT_CS461X - tristate "Crystal SoundFusion gameport support" - endif - -# Yes, SOUND_GAMEPORT looks a bit odd. Yes, it ends up being turned on -# in every .config. Please don't touch it. It is here to handle an -# unusual dependency between GAMEPORT and sound drivers. -# -# Some sound drivers call gameport functions. If GAMEPORT is -# not selected, empty stubs are provided for the functions and all is -# well. -# If GAMEPORT is built in, everything is fine. -# If GAMEPORT is a module, however, it would need to be loaded for the -# sound driver to be able to link properly. Therefore, the sound -# driver must be a module as well in that case. Since there's no way -# to express that directly in Kconfig, we use SOUND_GAMEPORT to -# express it. SOUND_GAMEPORT boils down to "if GAMEPORT is 'm', -# anything that depends on SOUND_GAMEPORT must be 'm' as well. if -# GAMEPORT is 'y' or 'n', it can be anything". -config SOUND_GAMEPORT - tristate - default m if GAMEPORT=m - default y diff -Nru a/drivers/input/gameport/Makefile b/drivers/input/gameport/Makefile --- a/drivers/input/gameport/Makefile 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/gameport/Makefile 2005-03-16 00:08:29 -08:00 @@ -5,9 +5,7 @@ # Each configuration option enables a list of files. obj-$(CONFIG_GAMEPORT) += gameport.o -obj-$(CONFIG_GAMEPORT_CS461X) += cs461x.o obj-$(CONFIG_GAMEPORT_EMU10K1) += emu10k1-gp.o obj-$(CONFIG_GAMEPORT_FM801) += fm801-gp.o obj-$(CONFIG_GAMEPORT_L4) += lightning.o obj-$(CONFIG_GAMEPORT_NS558) += ns558.o -obj-$(CONFIG_GAMEPORT_VORTEX) += vortex.o diff -Nru a/drivers/input/gameport/cs461x.c b/drivers/input/gameport/cs461x.c --- a/drivers/input/gameport/cs461x.c 2005-03-16 00:08:29 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,322 +0,0 @@ -/* - The all defines and part of code (such as cs461x_*) are - contributed from ALSA 0.5.8 sources. - See http://www.alsa-project.org/ for sources - - Tested on Linux 686 2.4.0-test9, ALSA 0.5.8a and CS4610 -*/ - -#include - -#include -#include -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Victor Krapivin"); -MODULE_LICENSE("GPL"); - -/* - These options are experimental - -#define CS461X_FULL_MAP -*/ - - -#ifndef PCI_VENDOR_ID_CIRRUS -#define PCI_VENDOR_ID_CIRRUS 0x1013 -#endif -#ifndef PCI_DEVICE_ID_CIRRUS_4610 -#define PCI_DEVICE_ID_CIRRUS_4610 0x6001 -#endif -#ifndef PCI_DEVICE_ID_CIRRUS_4612 -#define PCI_DEVICE_ID_CIRRUS_4612 0x6003 -#endif -#ifndef PCI_DEVICE_ID_CIRRUS_4615 -#define PCI_DEVICE_ID_CIRRUS_4615 0x6004 -#endif - -/* Registers */ - -#define BA0_JSPT 0x00000480 -#define BA0_JSCTL 0x00000484 -#define BA0_JSC1 0x00000488 -#define BA0_JSC2 0x0000048C -#define BA0_JSIO 0x000004A0 - -/* Bits for JSPT */ - -#define JSPT_CAX 0x00000001 -#define JSPT_CAY 0x00000002 -#define JSPT_CBX 0x00000004 -#define JSPT_CBY 0x00000008 -#define JSPT_BA1 0x00000010 -#define JSPT_BA2 0x00000020 -#define JSPT_BB1 0x00000040 -#define JSPT_BB2 0x00000080 - -/* Bits for JSCTL */ - -#define JSCTL_SP_MASK 0x00000003 -#define JSCTL_SP_SLOW 0x00000000 -#define JSCTL_SP_MEDIUM_SLOW 0x00000001 -#define JSCTL_SP_MEDIUM_FAST 0x00000002 -#define JSCTL_SP_FAST 0x00000003 -#define JSCTL_ARE 0x00000004 - -/* Data register pairs masks */ - -#define JSC1_Y1V_MASK 0x0000FFFF -#define JSC1_X1V_MASK 0xFFFF0000 -#define JSC1_Y1V_SHIFT 0 -#define JSC1_X1V_SHIFT 16 -#define JSC2_Y2V_MASK 0x0000FFFF -#define JSC2_X2V_MASK 0xFFFF0000 -#define JSC2_Y2V_SHIFT 0 -#define JSC2_X2V_SHIFT 16 - -/* JS GPIO */ - -#define JSIO_DAX 0x00000001 -#define JSIO_DAY 0x00000002 -#define JSIO_DBX 0x00000004 -#define JSIO_DBY 0x00000008 -#define JSIO_AXOE 0x00000010 -#define JSIO_AYOE 0x00000020 -#define JSIO_BXOE 0x00000040 -#define JSIO_BYOE 0x00000080 - -/* - The card initialization code is obfuscated; the module cs461x - need to be loaded after ALSA modules initialized and something - played on the CS 4610 chip (see sources for details of CS4610 - initialization code from ALSA) -*/ - -/* Card specific definitions */ - -#define CS461X_BA0_SIZE 0x2000 -#define CS461X_BA1_DATA0_SIZE 0x3000 -#define CS461X_BA1_DATA1_SIZE 0x3800 -#define CS461X_BA1_PRG_SIZE 0x7000 -#define CS461X_BA1_REG_SIZE 0x0100 - -#define BA1_SP_DMEM0 0x00000000 -#define BA1_SP_DMEM1 0x00010000 -#define BA1_SP_PMEM 0x00020000 -#define BA1_SP_REG 0x00030000 - -#define BA1_DWORD_SIZE (13 * 1024 + 512) -#define BA1_MEMORY_COUNT 3 - -/* - Only one CS461x card is still suppoted; the code requires - redesign to avoid this limitatuion. -*/ - -static unsigned long ba0_addr; -static unsigned int __iomem *ba0; - -#ifdef CS461X_FULL_MAP -static unsigned long ba1_addr; -static union ba1_t { - struct { - unsigned int __iomem *data0; - unsigned int __iomem *data1; - unsigned int __iomem *pmem; - unsigned int __iomem *reg; - } name; - unsigned int __iomem *idx[4]; -} ba1; - -static void cs461x_poke(unsigned long reg, unsigned int val) -{ - writel(val, &ba1.idx[(reg >> 16) & 3][(reg >> 2) & 0x3fff]); -} - -static unsigned int cs461x_peek(unsigned long reg) -{ - return readl(&ba1.idx[(reg >> 16) & 3][(reg >> 2) & 0x3fff]); -} - -#endif - -static void cs461x_pokeBA0(unsigned long reg, unsigned int val) -{ - writel(val, &ba0[reg >> 2]); -} - -static unsigned int cs461x_peekBA0(unsigned long reg) -{ - return readl(&ba0[reg >> 2]); -} - -static int cs461x_free(struct pci_dev *pdev) -{ - struct gameport *port = pci_get_drvdata(pdev); - - if (port) - gameport_unregister_port(port); - - if (ba0) iounmap(ba0); -#ifdef CS461X_FULL_MAP - if (ba1.name.data0) iounmap(ba1.name.data0); - if (ba1.name.data1) iounmap(ba1.name.data1); - if (ba1.name.pmem) iounmap(ba1.name.pmem); - if (ba1.name.reg) iounmap(ba1.name.reg); -#endif - return 0; -} - -static void cs461x_gameport_trigger(struct gameport *gameport) -{ - cs461x_pokeBA0(BA0_JSPT, 0xFF); //outb(gameport->io, 0xFF); -} - -static unsigned char cs461x_gameport_read(struct gameport *gameport) -{ - return cs461x_peekBA0(BA0_JSPT); //inb(gameport->io); -} - -static int cs461x_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons) -{ - unsigned js1, js2, jst; - - js1 = cs461x_peekBA0(BA0_JSC1); - js2 = cs461x_peekBA0(BA0_JSC2); - jst = cs461x_peekBA0(BA0_JSPT); - - *buttons = (~jst >> 4) & 0x0F; - - axes[0] = ((js1 & JSC1_Y1V_MASK) >> JSC1_Y1V_SHIFT) & 0xFFFF; - axes[1] = ((js1 & JSC1_X1V_MASK) >> JSC1_X1V_SHIFT) & 0xFFFF; - axes[2] = ((js2 & JSC2_Y2V_MASK) >> JSC2_Y2V_SHIFT) & 0xFFFF; - axes[3] = ((js2 & JSC2_X2V_MASK) >> JSC2_X2V_SHIFT) & 0xFFFF; - - for(jst=0;jst<4;++jst) - if(axes[jst]==0xFFFF) axes[jst] = -1; - return 0; -} - -static int cs461x_gameport_open(struct gameport *gameport, int mode) -{ - switch (mode) { - case GAMEPORT_MODE_COOKED: - case GAMEPORT_MODE_RAW: - return 0; - default: - return -1; - } - return 0; -} - -static struct pci_device_id cs461x_pci_tbl[] = { - { PCI_VENDOR_ID_CIRRUS, 0x6001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Cirrus CS4610 */ - { PCI_VENDOR_ID_CIRRUS, 0x6003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Cirrus CS4612 */ - { PCI_VENDOR_ID_CIRRUS, 0x6005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Cirrus CS4615 */ - { 0, } -}; -MODULE_DEVICE_TABLE(pci, cs461x_pci_tbl); - -static int __devinit cs461x_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - int rc; - struct gameport* port; - - rc = pci_enable_device(pdev); - if (rc) { - printk(KERN_ERR "cs461x: Cannot enable PCI gameport (bus %d, devfn %d) error=%d\n", - pdev->bus->number, pdev->devfn, rc); - return rc; - } - - ba0_addr = pci_resource_start(pdev, 0); -#ifdef CS461X_FULL_MAP - ba1_addr = pci_resource_start(pdev, 1); -#endif - if (ba0_addr == 0 || ba0_addr == ~0 -#ifdef CS461X_FULL_MAP - || ba1_addr == 0 || ba1_addr == ~0 -#endif - ) { - printk(KERN_ERR "cs461x: wrong address - ba0 = 0x%lx\n", ba0_addr); -#ifdef CS461X_FULL_MAP - printk(KERN_ERR "cs461x: wrong address - ba1 = 0x%lx\n", ba1_addr); -#endif - cs461x_free(pdev); - return -ENOMEM; - } - - ba0 = ioremap(ba0_addr, CS461X_BA0_SIZE); -#ifdef CS461X_FULL_MAP - ba1.name.data0 = ioremap(ba1_addr + BA1_SP_DMEM0, CS461X_BA1_DATA0_SIZE); - ba1.name.data1 = ioremap(ba1_addr + BA1_SP_DMEM1, CS461X_BA1_DATA1_SIZE); - ba1.name.pmem = ioremap(ba1_addr + BA1_SP_PMEM, CS461X_BA1_PRG_SIZE); - ba1.name.reg = ioremap(ba1_addr + BA1_SP_REG, CS461X_BA1_REG_SIZE); - - if (ba0 == NULL || ba1.name.data0 == NULL || - ba1.name.data1 == NULL || ba1.name.pmem == NULL || - ba1.name.reg == NULL) { - cs461x_free(pdev); - return -ENOMEM; - } -#else - if (ba0 == NULL) { - cs461x_free(pdev); - return -ENOMEM; - } -#endif - - if (!(port = gameport_allocate_port())) { - printk(KERN_ERR "cs461x: Memory allocation failed\n"); - cs461x_free(pdev); - return -ENOMEM; - } - - pci_set_drvdata(pdev, port); - - port->open = cs461x_gameport_open; - port->trigger = cs461x_gameport_trigger; - port->read = cs461x_gameport_read; - port->cooked_read = cs461x_gameport_cooked_read; - - gameport_set_name(port, "CS416x"); - gameport_set_phys(port, "pci%s/gameport0", pci_name(pdev)); - port->dev.parent = &pdev->dev; - - cs461x_pokeBA0(BA0_JSIO, 0xFF); // ? - cs461x_pokeBA0(BA0_JSCTL, JSCTL_SP_MEDIUM_SLOW); - - gameport_register_port(port); - - return 0; -} - -static void __devexit cs461x_pci_remove(struct pci_dev *pdev) -{ - cs461x_free(pdev); -} - -static struct pci_driver cs461x_pci_driver = { - .name = "CS461x_gameport", - .id_table = cs461x_pci_tbl, - .probe = cs461x_pci_probe, - .remove = __devexit_p(cs461x_pci_remove), -}; - -static int __init cs461x_init(void) -{ - return pci_register_driver(&cs461x_pci_driver); -} - -static void __exit cs461x_exit(void) -{ - pci_unregister_driver(&cs461x_pci_driver); -} - -module_init(cs461x_init); -module_exit(cs461x_exit); - diff -Nru a/drivers/input/gameport/ns558.c b/drivers/input/gameport/ns558.c --- a/drivers/input/gameport/ns558.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/gameport/ns558.c 2005-03-16 00:08:29 -08:00 @@ -258,17 +258,17 @@ { int i = 0; + if (pnp_register_driver(&ns558_pnp_driver) >= 0) + pnp_registered = 1; + /* - * Probe ISA ports first so that PnP gets to choose free port addresses - * not occupied by the ISA ports. + * Probe ISA ports after PnP, so that PnP ports that are already + * enabled get detected as PnP. This may be suboptimal in multi-device + * configurations, but saves hassle with simple setups. */ while (ns558_isa_portlist[i]) ns558_isa_probe(ns558_isa_portlist[i++]); - - if (pnp_register_driver(&ns558_pnp_driver) >= 0) - pnp_registered = 1; - return (list_empty(&ns558_list) && !pnp_registered) ? -ENODEV : 0; } diff -Nru a/drivers/input/gameport/vortex.c b/drivers/input/gameport/vortex.c --- a/drivers/input/gameport/vortex.c 2005-03-16 00:08:29 -08:00 +++ /dev/null Wed Dec 31 16:00:00 196900 @@ -1,186 +0,0 @@ -/* - * $Id: vortex.c,v 1.5 2002/07/01 15:39:30 vojtech Exp $ - * - * Copyright (c) 2000-2001 Vojtech Pavlik - * - * Based on the work of: - * Raymond Ingles - */ - -/* - * Trident 4DWave and Aureal Vortex gameport driver for Linux - */ - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: - * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Vojtech Pavlik "); -MODULE_DESCRIPTION("Aureal Vortex and Vortex2 gameport driver"); -MODULE_LICENSE("GPL"); - -#define VORTEX_GCR 0x0c /* Gameport control register */ -#define VORTEX_LEG 0x08 /* Legacy port location */ -#define VORTEX_AXD 0x10 /* Axes start */ -#define VORTEX_DATA_WAIT 20 /* 20 ms */ - -struct vortex { - struct gameport *gameport; - struct pci_dev *dev; - unsigned char __iomem *base; - unsigned char __iomem *io; -}; - -static unsigned char vortex_read(struct gameport *gameport) -{ - struct vortex *vortex = gameport->port_data; - return readb(vortex->io + VORTEX_LEG); -} - -static void vortex_trigger(struct gameport *gameport) -{ - struct vortex *vortex = gameport->port_data; - writeb(0xff, vortex->io + VORTEX_LEG); -} - -static int vortex_cooked_read(struct gameport *gameport, int *axes, int *buttons) -{ - struct vortex *vortex = gameport->port_data; - int i; - - *buttons = (~readb(vortex->base + VORTEX_LEG) >> 4) & 0xf; - - for (i = 0; i < 4; i++) { - axes[i] = readw(vortex->io + VORTEX_AXD + i * sizeof(u32)); - if (axes[i] == 0x1fff) axes[i] = -1; - } - - return 0; -} - -static int vortex_open(struct gameport *gameport, int mode) -{ - struct vortex *vortex = gameport->port_data; - - switch (mode) { - case GAMEPORT_MODE_COOKED: - writeb(0x40, vortex->io + VORTEX_GCR); - msleep(VORTEX_DATA_WAIT); - return 0; - case GAMEPORT_MODE_RAW: - writeb(0x00, vortex->io + VORTEX_GCR); - return 0; - default: - return -1; - } - - return 0; -} - -static int __devinit vortex_probe(struct pci_dev *dev, const struct pci_device_id *id) -{ - struct vortex *vortex; - struct gameport *port; - int i; - - vortex = kcalloc(1, sizeof(struct vortex), GFP_KERNEL); - port = gameport_allocate_port(); - if (!vortex || !port) { - printk(KERN_ERR "vortex: Memory allocation failed.\n"); - kfree(vortex); - gameport_free_port(port); - return -ENOMEM; - } - - for (i = 0; i < 6; i++) - if (~pci_resource_flags(dev, i) & IORESOURCE_IO) - break; - - pci_enable_device(dev); - - vortex->dev = dev; - vortex->gameport = port; - vortex->base = ioremap(pci_resource_start(vortex->dev, i), - pci_resource_len(vortex->dev, i)); - vortex->io = vortex->base + id->driver_data; - - pci_set_drvdata(dev, vortex); - - port->port_data = vortex; - port->fuzz = 64; - - gameport_set_name(port, "AU88x0"); - gameport_set_phys(port, "pci%s/gameport0", pci_name(dev)); - port->dev.parent = &dev->dev; - port->read = vortex_read; - port->trigger = vortex_trigger; - port->cooked_read = vortex_cooked_read; - port->open = vortex_open; - - gameport_register_port(port); - - return 0; -} - -static void __devexit vortex_remove(struct pci_dev *dev) -{ - struct vortex *vortex = pci_get_drvdata(dev); - - gameport_unregister_port(vortex->gameport); - iounmap(vortex->base); - kfree(vortex); -} - -static struct pci_device_id vortex_id_table[] = { - { 0x12eb, 0x0001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0x11000 }, - { 0x12eb, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0x28800 }, - { 0 } -}; - -static struct pci_driver vortex_driver = { - .name = "vortex_gameport", - .id_table = vortex_id_table, - .probe = vortex_probe, - .remove = __devexit_p(vortex_remove), -}; - -static int __init vortex_init(void) -{ - return pci_register_driver(&vortex_driver); -} - -static void __exit vortex_exit(void) -{ - pci_unregister_driver(&vortex_driver); -} - -module_init(vortex_init); -module_exit(vortex_exit); diff -Nru a/drivers/input/input.c b/drivers/input/input.c --- a/drivers/input/input.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/input.c 2005-03-16 00:08:29 -08:00 @@ -219,10 +219,24 @@ int input_open_device(struct input_handle *handle) { + struct input_dev *dev = handle->dev; + int err; + + err = down_interruptible(&dev->sem); + if (err) + return err; + handle->open++; - if (handle->dev->open) - return handle->dev->open(handle->dev); - return 0; + + if (!dev->users++ && dev->open) + err = dev->open(dev); + + if (err) + handle->open--; + + up(&dev->sem); + + return err; } int input_flush_device(struct input_handle* handle, struct file* file) @@ -235,10 +249,17 @@ void input_close_device(struct input_handle *handle) { + struct input_dev *dev = handle->dev; + input_release_device(handle); - if (handle->dev->close) - handle->dev->close(handle->dev); + + down(&dev->sem); + + if (!--dev->users && dev->close) + dev->close(dev); handle->open--; + + up(&dev->sem); } static void input_link_handle(struct input_handle *handle) @@ -414,6 +435,8 @@ struct input_device_id *id; set_bit(EV_SYN, dev->evbit); + + init_MUTEX(&dev->sem); /* * If delay and period are pre-set by the driver, then autorepeating diff -Nru a/drivers/input/joydev.c b/drivers/input/joydev.c --- a/drivers/input/joydev.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joydev.c 2005-03-16 00:08:29 -08:00 @@ -285,48 +285,33 @@ (POLLIN | POLLRDNORM) : 0) | (list->joydev->exist ? 0 : (POLLHUP | POLLERR)); } -static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) +static int joydev_ioctl_common(struct joydev *joydev, unsigned int cmd, void __user *argp) { - struct joydev_list *list = file->private_data; - struct joydev *joydev = list->joydev; struct input_dev *dev = joydev->handle.dev; - void __user *argp = (void __user *)arg; int i, j; - if (!joydev->exist) return -ENODEV; - switch (cmd) { case JS_SET_CAL: return copy_from_user(&joydev->glue.JS_CORR, argp, - sizeof(struct JS_DATA_TYPE)) ? -EFAULT : 0; + sizeof(joydev->glue.JS_CORR)) ? -EFAULT : 0; case JS_GET_CAL: return copy_to_user(argp, &joydev->glue.JS_CORR, - sizeof(struct JS_DATA_TYPE)) ? -EFAULT : 0; + sizeof(joydev->glue.JS_CORR)) ? -EFAULT : 0; case JS_SET_TIMEOUT: - return get_user(joydev->glue.JS_TIMEOUT, (int __user *) arg); + return get_user(joydev->glue.JS_TIMEOUT, (s32 __user *) argp); case JS_GET_TIMEOUT: - return put_user(joydev->glue.JS_TIMEOUT, (int __user *) arg); - case JS_SET_TIMELIMIT: - return get_user(joydev->glue.JS_TIMELIMIT, (long __user *) arg); - case JS_GET_TIMELIMIT: - return put_user(joydev->glue.JS_TIMELIMIT, (long __user *) arg); - case JS_SET_ALL: - return copy_from_user(&joydev->glue, argp, - sizeof(struct JS_DATA_SAVE_TYPE)) ? -EFAULT : 0; - case JS_GET_ALL: - return copy_to_user(argp, &joydev->glue, - sizeof(struct JS_DATA_SAVE_TYPE)) ? -EFAULT : 0; + return put_user(joydev->glue.JS_TIMEOUT, (s32 __user *) argp); case JSIOCGVERSION: - return put_user(JS_VERSION, (__u32 __user *) arg); + return put_user(JS_VERSION, (__u32 __user *) argp); case JSIOCGAXES: - return put_user(joydev->nabs, (__u8 __user *) arg); + return put_user(joydev->nabs, (__u8 __user *) argp); case JSIOCGBUTTONS: - return put_user(joydev->nkey, (__u8 __user *) arg); + return put_user(joydev->nkey, (__u8 __user *) argp); case JSIOCSCORR: if (copy_from_user(joydev->corr, argp, - sizeof(struct js_corr) * joydev->nabs)) + sizeof(joydev->corr[0]) * joydev->nabs)) return -EFAULT; for (i = 0; i < joydev->nabs; i++) { j = joydev->abspam[i]; @@ -335,7 +320,7 @@ return 0; case JSIOCGCORR: return copy_to_user(argp, joydev->corr, - sizeof(struct js_corr) * joydev->nabs) ? -EFAULT : 0; + sizeof(joydev->corr[0]) * joydev->nabs) ? -EFAULT : 0; case JSIOCSAXMAP: if (copy_from_user(joydev->abspam, argp, sizeof(__u8) * (ABS_MAX + 1))) return -EFAULT; @@ -371,6 +356,84 @@ return -EINVAL; } +#ifdef CONFIG_COMPAT +static long joydev_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg) +{ + struct joydev_list *list = file->private_data; + struct joydev *joydev = list->joydev; + void __user *argp = (void __user *)arg; + s32 tmp32; + struct JS_DATA_SAVE_TYPE_32 ds32; + int err; + + if (!joydev->exist) return -ENODEV; + switch(cmd) { + case JS_SET_TIMELIMIT: + err = get_user(tmp32, (s32 __user *) arg); + if (err == 0) + joydev->glue.JS_TIMELIMIT = tmp32; + break; + case JS_GET_TIMELIMIT: + tmp32 = joydev->glue.JS_TIMELIMIT; + err = put_user(tmp32, (s32 __user *) arg); + break; + + case JS_SET_ALL: + err = copy_from_user(&ds32, argp, + sizeof(ds32)) ? -EFAULT : 0; + if (err == 0) { + joydev->glue.JS_TIMEOUT = ds32.JS_TIMEOUT; + joydev->glue.BUSY = ds32.BUSY; + joydev->glue.JS_EXPIRETIME = ds32.JS_EXPIRETIME; + joydev->glue.JS_TIMELIMIT = ds32.JS_TIMELIMIT; + joydev->glue.JS_SAVE = ds32.JS_SAVE; + joydev->glue.JS_CORR = ds32.JS_CORR; + } + break; + + case JS_GET_ALL: + ds32.JS_TIMEOUT = joydev->glue.JS_TIMEOUT; + ds32.BUSY = joydev->glue.BUSY; + ds32.JS_EXPIRETIME = joydev->glue.JS_EXPIRETIME; + ds32.JS_TIMELIMIT = joydev->glue.JS_TIMELIMIT; + ds32.JS_SAVE = joydev->glue.JS_SAVE; + ds32.JS_CORR = joydev->glue.JS_CORR; + + err = copy_to_user(argp, &ds32, + sizeof(ds32)) ? -EFAULT : 0; + break; + + default: + err = joydev_ioctl_common(joydev, cmd, argp); + } + return err; +} +#endif /* CONFIG_COMPAT */ + +static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) +{ + struct joydev_list *list = file->private_data; + struct joydev *joydev = list->joydev; + void __user *argp = (void __user *)arg; + + if (!joydev->exist) return -ENODEV; + + switch(cmd) { + case JS_SET_TIMELIMIT: + return get_user(joydev->glue.JS_TIMELIMIT, (long __user *) arg); + case JS_GET_TIMELIMIT: + return put_user(joydev->glue.JS_TIMELIMIT, (long __user *) arg); + case JS_SET_ALL: + return copy_from_user(&joydev->glue, argp, + sizeof(joydev->glue)) ? -EFAULT : 0; + case JS_GET_ALL: + return copy_to_user(argp, &joydev->glue, + sizeof(joydev->glue)) ? -EFAULT : 0; + default: + return joydev_ioctl_common(joydev, cmd, argp); + } +} + static struct file_operations joydev_fops = { .owner = THIS_MODULE, .read = joydev_read, @@ -379,6 +442,9 @@ .open = joydev_open, .release = joydev_release, .ioctl = joydev_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = joydev_compat_ioctl, +#endif .fasync = joydev_fasync, }; diff -Nru a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c --- a/drivers/input/joystick/a3d.c 2005-03-16 00:08:28 -08:00 +++ b/drivers/input/joystick/a3d.c 2005-03-16 00:08:29 -08:00 @@ -185,7 +185,7 @@ a3d->reads++; if (a3d_read_packet(a3d->gameport, a3d->length, data) != a3d->length || data[0] != a3d->mode || a3d_csum(data, a3d->length)) - a3d->bads++; + a3d->bads++; else a3d_read(a3d, data); } diff -Nru a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c --- a/drivers/input/joystick/adi.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/adi.c 2005-03-16 00:08:29 -08:00 @@ -82,7 +82,7 @@ static char adi_wmf_abs[] = { ABS_WHEEL, ABS_GAS, ABS_BRAKE, ABS_HAT0X, ABS_HAT0Y, ABS_HAT1X, ABS_HAT1Y, ABS_HAT2X, ABS_HAT2Y }; static short adi_wmgpe_key[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_START, BTN_MODE, BTN_SELECT }; -static short adi_wmi_key[] = { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE, BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_EXTRA }; +static short adi_wmi_key[] = { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_TOP2, BTN_BASE, BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_EXTRA }; static short adi_wmed3d_key[] = { BTN_TRIGGER, BTN_THUMB, BTN_THUMB2, BTN_TOP, BTN_TOP2, BTN_BASE, BTN_BASE2 }; static short adi_cm2_key[] = { BTN_1, BTN_2, BTN_3, BTN_4, BTN_5, BTN_6, BTN_7, BTN_8 }; @@ -183,7 +183,7 @@ int i; struct adi *adi = port->adi; - adi[0].idx = adi[1].idx = 0; + adi[0].idx = adi[1].idx = 0; if (adi[0].ret <= 0 || adi[1].ret <= 0) return; if (adi[0].data[0] & 0x20 || ~adi[1].data[0] & 0x20) return; diff -Nru a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c --- a/drivers/input/joystick/amijoy.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/amijoy.c 2005-03-16 00:08:29 -08:00 @@ -51,7 +51,8 @@ __obsolete_setup("amijoy="); -static int amijoy_used[2] = { 0, 0 }; +static int amijoy_used; +static DECLARE_MUTEX(amijoy_sem); static struct input_dev amijoy_dev[2]; static char *amijoy_phys[2] = { "amijoy/input0", "amijoy/input1" }; @@ -84,26 +85,30 @@ static int amijoy_open(struct input_dev *dev) { - int *used = dev->private; + int err; - if ((*used)++) - return 0; + err = down_interruptible(&amijoy_sem); + if (err) + return err; - if (request_irq(IRQ_AMIGA_VERTB, amijoy_interrupt, 0, "amijoy", amijoy_interrupt)) { - (*used)--; + if (!amijoy_used && request_irq(IRQ_AMIGA_VERTB, amijoy_interrupt, 0, "amijoy", amijoy_interrupt)) { printk(KERN_ERR "amijoy.c: Can't allocate irq %d\n", IRQ_AMIGA_VERTB); - return -EBUSY; + err = -EBUSY; + goto out; } - return 0; + amijoy_used++; +out: + up(&amijoy_sem); + return err; } static void amijoy_close(struct input_dev *dev) { - int *used = dev->private; - - if (!--(*used)) + down(&amijoysem); + if (!--amijoy_used) free_irq(IRQ_AMIGA_VERTB, amijoy_interrupt); + up(&amijoy_sem); } static int __init amijoy_init(void) @@ -137,8 +142,6 @@ amijoy_dev[i].id.vendor = 0x0001; amijoy_dev[i].id.product = 0x0003; amijoy_dev[i].id.version = 0x0100; - - amijoy_dev[i].private = amijoy_used + i; input_register_device(amijoy_dev + i); printk(KERN_INFO "input: %s at joy%ddat\n", amijoy_name, i); diff -Nru a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c --- a/drivers/input/joystick/db9.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/db9.c 2005-03-16 00:08:29 -08:00 @@ -87,7 +87,7 @@ #define DB9_NORMAL 0x0a #define DB9_NOSELECT 0x08 -#define DB9_MAX_DEVICES 2 +#define DB9_MAX_DEVICES 2 #define DB9_GENESIS6_DELAY 14 #define DB9_REFRESH_TIME HZ/100 @@ -98,6 +98,7 @@ struct pardevice *pd; int mode; int used; + struct semaphore sem; char phys[2][32]; }; @@ -503,6 +504,11 @@ { struct db9 *db9 = dev->private; struct parport *port = db9->pd->port; + int err; + + err = down_interruptible(&db9->sem); + if (err) + return err; if (!db9->used++) { parport_claim(db9->pd); @@ -514,6 +520,7 @@ mod_timer(&db9->timer, jiffies + DB9_REFRESH_TIME); } + up(&db9->sem); return 0; } @@ -522,12 +529,14 @@ struct db9 *db9 = dev->private; struct parport *port = db9->pd->port; + down(&db9->sem); if (!--db9->used) { - del_timer(&db9->timer); + del_timer_sync(&db9->timer); parport_write_control(port, 0x00); parport_data_forward(port); parport_release(db9->pd); } + up(&db9->sem); } static struct db9 __init *db9_probe(int *config, int nargs) @@ -563,12 +572,12 @@ } } - if (!(db9 = kmalloc(sizeof(struct db9), GFP_KERNEL))) { + if (!(db9 = kcalloc(1, sizeof(struct db9), GFP_KERNEL))) { parport_put_port(pp); return NULL; } - memset(db9, 0, sizeof(struct db9)); + init_MUTEX(&db9->sem); db9->mode = config[1]; init_timer(&db9->timer); db9->timer.data = (long) db9; diff -Nru a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c --- a/drivers/input/joystick/gamecon.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/gamecon.c 2005-03-16 00:08:29 -08:00 @@ -1,12 +1,12 @@ /* * NES, SNES, N64, MultiSystem, PSX gamepad driver for Linux * - * Copyright (c) 1999-2004 Vojtech Pavlik - * Copyright (c) 2004 Peter Nelson + * Copyright (c) 1999-2004 Vojtech Pavlik + * Copyright (c) 2004 Peter Nelson * * Based on the work of: - * Andree Borrmann John Dahlstrom - * David Kuder Nathan Hand + * Andree Borrmann John Dahlstrom + * David Kuder Nathan Hand */ /* @@ -81,6 +81,7 @@ struct timer_list timer; unsigned char pads[GC_MAX + 1]; int used; + struct semaphore sem; char phys[5][32]; }; @@ -433,7 +434,7 @@ gc_psx_read_packet(gc, data_psx, data); for (i = 0; i < 5; i++) { - switch (data[i]) { + switch (data[i]) { case GC_PSX_RUMBLE: @@ -503,22 +504,33 @@ static int gc_open(struct input_dev *dev) { struct gc *gc = dev->private; + int err; + + err = down_interruptible(&gc->sem); + if (err) + return err; + if (!gc->used++) { parport_claim(gc->pd); parport_write_control(gc->pd->port, 0x04); mod_timer(&gc->timer, jiffies + GC_REFRESH_TIME); } + + up(&gc->sem); return 0; } static void gc_close(struct input_dev *dev) { struct gc *gc = dev->private; + + down(&gc->sem); if (!--gc->used) { - del_timer(&gc->timer); + del_timer_sync(&gc->timer); parport_write_control(gc->pd->port, 0x00); parport_release(gc->pd); } + up(&gc->sem); } static struct gc __init *gc_probe(int *config, int nargs) @@ -542,11 +554,12 @@ return NULL; } - if (!(gc = kmalloc(sizeof(struct gc), GFP_KERNEL))) { + if (!(gc = kcalloc(1, sizeof(struct gc), GFP_KERNEL))) { parport_put_port(pp); return NULL; } - memset(gc, 0, sizeof(struct gc)); + + init_MUTEX(&gc->sem); gc->pd = parport_register_device(pp, "gamecon", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); diff -Nru a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c --- a/drivers/input/joystick/gf2k.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/gf2k.c 2005-03-16 00:08:29 -08:00 @@ -329,7 +329,7 @@ for (i = 0; i < gf2k_axes[gf2k->id]; i++) { gf2k->dev.absmax[gf2k_abs[i]] = (i < 2) ? gf2k->dev.abs[gf2k_abs[i]] * 2 - 32 : - gf2k->dev.abs[gf2k_abs[0]] + gf2k->dev.abs[gf2k_abs[1]] - 32; + gf2k->dev.abs[gf2k_abs[0]] + gf2k->dev.abs[gf2k_abs[1]] - 32; gf2k->dev.absmin[gf2k_abs[i]] = 32; gf2k->dev.absfuzz[gf2k_abs[i]] = 8; gf2k->dev.absflat[gf2k_abs[i]] = (i < 2) ? 24 : 0; diff -Nru a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c --- a/drivers/input/joystick/grip_mp.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/grip_mp.c 2005-03-16 00:08:29 -08:00 @@ -171,7 +171,7 @@ *packet = 0; raw_data = gameport_read(gameport); if (raw_data & 1) - return IO_RETRY; + return IO_RETRY; for (i = 0; i < 64; i++) { raw_data = gameport_read(gameport); diff -Nru a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c --- a/drivers/input/joystick/iforce/iforce-main.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/iforce/iforce-main.c 2005-03-16 00:08:29 -08:00 @@ -78,6 +78,7 @@ { 0x061c, 0xc0a4, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, //? { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //? { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? + { 0x06f8, 0x0004, "Gullemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //? { 0x0000, 0x0000, "Unknown I-Force Device [%04x:%04x]", btn_joystick, abs_joystick, ff_iforce } }; diff -Nru a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c --- a/drivers/input/joystick/iforce/iforce-usb.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/iforce/iforce-usb.c 2005-03-16 00:08:29 -08:00 @@ -229,6 +229,7 @@ { USB_DEVICE(0x061c, 0xc0a4) }, /* ACT LABS Force RS */ { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */ { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */ + { USB_DEVICE(0x06f8, 0xa302) }, /* Guillemot Jet Leader 3D */ { } /* Terminating entry */ }; diff -Nru a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c --- a/drivers/input/joystick/spaceball.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/spaceball.c 2005-03-16 00:08:29 -08:00 @@ -4,8 +4,8 @@ * Copyright (c) 1999-2001 Vojtech Pavlik * * Based on the work of: - * David Thompson - * Joseph Krahn + * David Thompson + * Joseph Krahn */ /* diff -Nru a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c --- a/drivers/input/joystick/spaceorb.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/spaceorb.c 2005-03-16 00:08:29 -08:00 @@ -4,7 +4,7 @@ * Copyright (c) 1999-2001 Vojtech Pavlik * * Based on the work of: - * David Thompson + * David Thompson */ /* diff -Nru a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c --- a/drivers/input/joystick/tmdc.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/tmdc.c 2005-03-16 00:08:29 -08:00 @@ -79,7 +79,7 @@ { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_START, BTN_SELECT, BTN_TL, BTN_TR }; static short tmdc_btn_joy[TMDC_BTN] = { BTN_TRIGGER, BTN_THUMB, BTN_TOP, BTN_TOP2, BTN_BASE, BTN_BASE2, BTN_THUMB2, BTN_PINKIE, - BTN_BASE3, BTN_BASE4, BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z }; + BTN_BASE3, BTN_BASE4, BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z }; static short tmdc_btn_fm[TMDC_BTN] = { BTN_TRIGGER, BTN_C, BTN_B, BTN_A, BTN_THUMB, BTN_X, BTN_Y, BTN_Z, BTN_TOP, BTN_TOP2 }; static short tmdc_btn_at[TMDC_BTN] = diff -Nru a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c --- a/drivers/input/joystick/turbografx.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/joystick/turbografx.c 2005-03-16 00:08:29 -08:00 @@ -84,6 +84,7 @@ char phys[7][32]; int sticks; int used; + struct semaphore sem; } *tgfx_base[3]; /* @@ -99,7 +100,7 @@ for (i = 0; i < 7; i++) if (tgfx->sticks & (1 << i)) { - dev = tgfx->dev + i; + dev = tgfx->dev + i; parport_write_data(tgfx->pd->port, ~(1 << i)); data1 = parport_read_status(tgfx->pd->port) ^ 0x7f; @@ -122,23 +123,34 @@ static int tgfx_open(struct input_dev *dev) { - struct tgfx *tgfx = dev->private; - if (!tgfx->used++) { + struct tgfx *tgfx = dev->private; + int err; + + err = down_interruptible(&tgfx->sem); + if (err) + return err; + + if (!tgfx->used++) { parport_claim(tgfx->pd); parport_write_control(tgfx->pd->port, 0x04); - mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); + mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); } - return 0; + + up(&tgfx->sem); + return 0; } static void tgfx_close(struct input_dev *dev) { - struct tgfx *tgfx = dev->private; - if (!--tgfx->used) { - del_timer(&tgfx->timer); + struct tgfx *tgfx = dev->private; + + down(&tgfx->sem); + if (!--tgfx->used) { + del_timer_sync(&tgfx->timer); parport_write_control(tgfx->pd->port, 0x00); - parport_release(tgfx->pd); + parport_release(tgfx->pd); } + up(&tgfx->sem); } /* @@ -166,11 +178,12 @@ return NULL; } - if (!(tgfx = kmalloc(sizeof(struct tgfx), GFP_KERNEL))) { + if (!(tgfx = kcalloc(1, sizeof(struct tgfx), GFP_KERNEL))) { parport_put_port(pp); return NULL; } - memset(tgfx, 0, sizeof(struct tgfx)); + + init_MUTEX(&tgfx->sem); tgfx->pd = parport_register_device(pp, "turbografx", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); diff -Nru a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c --- a/drivers/input/keyboard/atkbd.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/keyboard/atkbd.c 2005-03-16 00:08:29 -08:00 @@ -227,7 +227,7 @@ { \ return atkbd_attr_set_helper(d, b, s, atkbd_set_##_name); \ } \ -static struct device_attribute atkbd_attr_##_name = \ +static struct device_attribute atkbd_attr_##_name = \ __ATTR(_name, S_IWUSR | S_IRUGO, atkbd_do_show_##_name, atkbd_do_set_##_name); ATKBD_DEFINE_ATTR(extra); @@ -388,7 +388,7 @@ value = atkbd->release ? 0 : (1 + (!atkbd->softrepeat && test_bit(atkbd->keycode[code], atkbd->dev.key))); - switch (value) { /* Workaround Toshiba laptop multiple keypress */ + switch (value) { /* Workaround Toshiba laptop multiple keypress */ case 0: atkbd->last = 0; break; @@ -892,7 +892,7 @@ if (atkbd->write) { param[0] = (test_bit(LED_SCROLLL, atkbd->dev.led) ? 1 : 0) | (test_bit(LED_NUML, atkbd->dev.led) ? 2 : 0) - | (test_bit(LED_CAPSL, atkbd->dev.led) ? 4 : 0); + | (test_bit(LED_CAPSL, atkbd->dev.led) ? 4 : 0); if (atkbd_probe(atkbd)) return -1; diff -Nru a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c --- a/drivers/input/keyboard/corgikbd.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/keyboard/corgikbd.c 2005-03-16 00:08:29 -08:00 @@ -39,6 +39,7 @@ #define CORGI_KEY_CALENDER KEY_F1 #define CORGI_KEY_ADDRESS KEY_F2 #define CORGI_KEY_FN KEY_F3 +#define CORGI_KEY_CANCEL KEY_F4 #define CORGI_KEY_OFF KEY_SUSPEND #define CORGI_KEY_EXOK KEY_F5 #define CORGI_KEY_EXCANCEL KEY_F6 @@ -46,6 +47,7 @@ #define CORGI_KEY_EXJOGUP KEY_F8 #define CORGI_KEY_JAP1 KEY_LEFTCTRL #define CORGI_KEY_JAP2 KEY_LEFTALT +#define CORGI_KEY_MAIL KEY_F10 #define CORGI_KEY_OK KEY_F11 #define CORGI_KEY_MENU KEY_F12 #define CORGI_HINGE_0 KEY_KP0 @@ -59,8 +61,8 @@ KEY_TAB, KEY_Q, KEY_E, KEY_T, KEY_G, KEY_U, KEY_J, KEY_K, 0, 0, 0, 0, 0, 0, 0, 0, /* 33-48 */ CORGI_KEY_CALENDER, KEY_W, KEY_S, KEY_F, KEY_V, KEY_H, KEY_M, KEY_L, 0, KEY_RIGHTSHIFT, 0, 0, 0, 0, 0, 0, /* 49-64 */ CORGI_KEY_ADDRESS, KEY_A, KEY_D, KEY_C, KEY_B, KEY_N, KEY_DOT, 0, KEY_ENTER, 0, KEY_LEFTSHIFT, 0, 0, 0, 0, 0, /* 65-80 */ - KEY_MAIL, KEY_Z, KEY_X, KEY_MINUS, KEY_SPACE, KEY_COMMA, 0, KEY_UP, 0, 0, 0, CORGI_KEY_FN, 0, 0, 0, 0, /* 81-96 */ - KEY_SYSRQ, CORGI_KEY_JAP1, CORGI_KEY_JAP2, KEY_CANCEL, CORGI_KEY_OK, CORGI_KEY_MENU, KEY_LEFT, KEY_DOWN, KEY_RIGHT, 0, 0, 0, 0, 0, 0, 0, /* 97-112 */ + CORGI_KEY_MAIL, KEY_Z, KEY_X, KEY_MINUS, KEY_SPACE, KEY_COMMA, 0, KEY_UP, 0, 0, 0, CORGI_KEY_FN, 0, 0, 0, 0, /* 81-96 */ + KEY_SYSRQ, CORGI_KEY_JAP1, CORGI_KEY_JAP2, CORGI_KEY_CANCEL, CORGI_KEY_OK, CORGI_KEY_MENU, KEY_LEFT, KEY_DOWN, KEY_RIGHT, 0, 0, 0, 0, 0, 0, 0, /* 97-112 */ CORGI_KEY_OFF, CORGI_KEY_EXOK, CORGI_KEY_EXCANCEL, CORGI_KEY_EXJOGDOWN, CORGI_KEY_EXJOGUP, 0, 0, 0, 0, 0, 0, 0, /* 113-124 */ CORGI_HINGE_0, CORGI_HINGE_1, CORGI_HINGE_2 /* 125-127 */ }; diff -Nru a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c --- a/drivers/input/keyboard/lkkbd.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/keyboard/lkkbd.c 2005-03-16 00:08:29 -08:00 @@ -15,10 +15,10 @@ * information given below, I will _not_ be liable! * * RJ10 pinout: To DE9: Or DB25: - * 1 - RxD <----> Pin 3 (TxD) <-> Pin 2 (TxD) - * 2 - GND <----> Pin 5 (GND) <-> Pin 7 (GND) - * 4 - TxD <----> Pin 2 (RxD) <-> Pin 3 (RxD) - * 3 - +12V (from HDD drive connector), DON'T connect to DE9 or DB25!!! + * 1 - RxD <----> Pin 3 (TxD) <-> Pin 2 (TxD) + * 2 - GND <----> Pin 5 (GND) <-> Pin 7 (GND) + * 4 - TxD <----> Pin 2 (RxD) <-> Pin 3 (RxD) + * 3 - +12V (from HDD drive connector), DON'T connect to DE9 or DB25!!! * * Pin numbers for DE9 and DB25 are noted on the plug (quite small:). For * RJ10, it's like this: diff -Nru a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c --- a/drivers/input/keyboard/locomokbd.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/keyboard/locomokbd.c 2005-03-16 00:08:29 -08:00 @@ -42,7 +42,7 @@ MODULE_DESCRIPTION("LoCoMo keyboard driver"); MODULE_LICENSE("GPL"); -#define LOCOMOKBD_NUMKEYS 128 +#define LOCOMOKBD_NUMKEYS 128 #define KEY_ACTIVITY KEY_F16 #define KEY_CONTACT KEY_F18 @@ -61,7 +61,7 @@ KEY_G, KEY_F, KEY_X, KEY_S, 0, 0, 0, 0, 0, 0, /* 90 - 99 */ 0, 0, KEY_DOT, 0, KEY_COMMA, KEY_N, KEY_B, KEY_C, KEY_Z, KEY_A, /* 100 - 109 */ KEY_LEFTSHIFT, KEY_TAB, KEY_LEFTCTRL, 0, 0, 0, 0, 0, 0, 0, /* 110 - 119 */ - KEY_M, KEY_SPACE, KEY_V, KEY_APOSTROPHE, KEY_SLASH, 0, 0, 0 /* 120 - 128 */ + KEY_M, KEY_SPACE, KEY_V, KEY_APOSTROPHE, KEY_SLASH, 0, 0, 0 /* 120 - 128 */ }; #define KB_ROWS 16 @@ -82,7 +82,7 @@ struct locomo_dev *ldev; unsigned long base; spinlock_t lock; - + struct timer_list timer; }; @@ -95,7 +95,7 @@ static inline void locomokbd_activate_all(unsigned long membase) { unsigned long r; - + locomo_writel(0, membase + LOCOMO_KSC); r = locomo_readl(membase + LOCOMO_KIC); r &= 0xFEFF; @@ -127,7 +127,7 @@ */ /* Scan the hardware keyboard and push any changes up through the input layer */ -static void locomokbd_scankeyboard(struct locomokbd *locomokbd, struct pt_regs *regs) +static void locomokbd_scankeyboard(struct locomokbd *locomokbd, struct pt_regs *regs) { unsigned int row, col, rowd, scancode; unsigned long flags; @@ -138,7 +138,7 @@ if (regs) input_regs(&locomokbd->input, regs); - + locomokbd_charge_all(membase); num_pressed = 0; @@ -146,9 +146,9 @@ locomokbd_activate_col(membase, col); udelay(KB_DELAY); - + rowd = ~locomo_readl(membase + LOCOMO_KIB); - for (row = 0; row < KB_ROWS; row++ ) { + for (row = 0; row < KB_ROWS; row++) { scancode = SCANCODE(col, row); if (rowd & KB_ROWMASK(row)) { num_pressed += 1; @@ -170,7 +170,7 @@ spin_unlock_irqrestore(&locomokbd->lock, flags); } -/* +/* * LoCoMo keyboard interrupt handler. */ static irqreturn_t locomokbd_interrupt(int irq, void *dev_id, struct pt_regs *regs) @@ -205,8 +205,8 @@ memset(locomokbd, 0, sizeof(struct locomokbd)); /* try and claim memory region */ - if (!request_mem_region((unsigned long) dev->mapbase, - dev->length, + if (!request_mem_region((unsigned long) dev->mapbase, + dev->length, LOCOMO_DRIVER_NAME(dev))) { ret = -EBUSY; printk(KERN_ERR "locomokbd: Can't acquire access to io memory for keyboard\n"); @@ -225,7 +225,7 @@ locomokbd->timer.data = (unsigned long) locomokbd; locomokbd->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REP); - + init_input_dev(&locomokbd->input); locomokbd->input.keycode = locomokbd->keycode; locomokbd->input.keycodesize = sizeof(unsigned char); @@ -271,11 +271,11 @@ static int locomokbd_remove(struct locomo_dev *dev) { struct locomokbd *locomokbd = locomo_get_drvdata(dev); - + free_irq(dev->irq[0], locomokbd); del_timer_sync(&locomokbd->timer); - + input_unregister_device(&locomokbd->input); locomo_set_drvdata(dev, NULL); diff -Nru a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c --- a/drivers/input/keyboard/maple_keyb.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/keyboard/maple_keyb.c 2005-03-16 00:08:29 -08:00 @@ -1,6 +1,6 @@ /* * $Id: maple_keyb.c,v 1.4 2004/03/22 01:18:15 lethal Exp $ - * SEGA Dreamcast keyboard driver + * SEGA Dreamcast keyboard driver * Based on drivers/usb/usbkbd.c */ @@ -40,7 +40,6 @@ struct input_dev dev; unsigned char new[8]; unsigned char old[8]; - int open; }; @@ -95,22 +94,6 @@ } } - -static int dc_kbd_open(struct input_dev *dev) -{ - struct dc_kbd *kbd = dev->private; - kbd->open++; - return 0; -} - - -static void dc_kbd_close(struct input_dev *dev) -{ - struct dc_kbd *kbd = dev->private; - kbd->open--; -} - - static int dc_kbd_connect(struct maple_device *dev) { int i; @@ -133,9 +116,6 @@ clear_bit(0, kbd->dev.keybit); kbd->dev.private = kbd; - kbd->dev.open = dc_kbd_open; - kbd->dev.close = dc_kbd_close; - kbd->dev.event = NULL; kbd->dev.name = dev->product_name; kbd->dev.id.bustype = BUS_MAPLE; diff -Nru a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c --- a/drivers/input/mouse/alps.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/mouse/alps.c 2005-03-16 00:08:29 -08:00 @@ -61,11 +61,11 @@ /* * ALPS abolute Mode - new format - * - * byte 0: 1 ? ? ? 1 ? ? ? + * + * byte 0: 1 ? ? ? 1 ? ? ? * byte 1: 0 x6 x5 x4 x3 x2 x1 x0 * byte 2: 0 x10 x9 x8 x7 ? fin ges - * byte 3: 0 y9 y8 y7 1 M R L + * byte 3: 0 y9 y8 y7 1 M R L * byte 4: 0 y6 y5 y4 y3 y2 y1 y0 * byte 5: 0 z6 z5 z4 z3 z2 z1 z0 * @@ -85,7 +85,7 @@ input_regs(dev, regs); if ((packet[0] & 0xc8) == 0x08) { /* 3-byte PS/2 packet */ - input_report_key(dev2, BTN_LEFT, packet[0] & 1); + input_report_key(dev2, BTN_LEFT, packet[0] & 1); input_report_key(dev2, BTN_RIGHT, packet[0] & 2); input_report_key(dev2, BTN_MIDDLE, packet[0] & 4); input_report_rel(dev2, REL_X, @@ -434,8 +434,8 @@ priv->dev2.id.bustype = BUS_I8042; priv->dev2.id.vendor = 0x0002; priv->dev2.id.product = PSMOUSE_ALPS; - priv->dev2.id.version = 0x0000; - + priv->dev2.id.version = 0x0000; + priv->dev2.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); priv->dev2.relbit[LONG(REL_X)] |= BIT(REL_X) | BIT(REL_Y); priv->dev2.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); @@ -459,17 +459,15 @@ int alps_detect(struct psmouse *psmouse, int set_properties) { int version; - struct alps_model_info *model; + struct alps_model_info *model; if (!(model = alps_get_model(psmouse, &version))) return -1; if (set_properties) { psmouse->vendor = "ALPS"; - if (model->flags & ALPS_DUALPOINT) - psmouse->name = "DualPoint TouchPad"; - else - psmouse->name = "GlidePoint"; + psmouse->name = model->flags & ALPS_DUALPOINT ? + "DualPoint TouchPad" : "GlidePoint"; psmouse->model = version; } return 0; diff -Nru a/drivers/input/mouse/amimouse.c b/drivers/input/mouse/amimouse.c --- a/drivers/input/mouse/amimouse.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/mouse/amimouse.c 2005-03-16 00:08:29 -08:00 @@ -33,7 +33,6 @@ MODULE_DESCRIPTION("Amiga mouse driver"); MODULE_LICENSE("GPL"); -static int amimouse_used = 0; static int amimouse_lastx, amimouse_lasty; static struct input_dev amimouse_dev; @@ -81,16 +80,12 @@ { unsigned short joy0dat; - if (amimouse_used++) - return 0; - joy0dat = custom.joy0dat; amimouse_lastx = joy0dat & 0xff; amimouse_lasty = joy0dat >> 8; if (request_irq(IRQ_AMIGA_VERTB, amimouse_interrupt, 0, "amimouse", amimouse_interrupt)) { - amimouse_used--; printk(KERN_ERR "amimouse.c: Can't allocate irq %d\n", IRQ_AMIGA_VERTB); return -EBUSY; } @@ -100,8 +95,7 @@ static void amimouse_close(struct input_dev *dev) { - if (!--amimouse_used) - free_irq(IRQ_AMIGA_VERTB, amimouse_interrupt); + free_irq(IRQ_AMIGA_VERTB, amimouse_interrupt); } static int __init amimouse_init(void) diff -Nru a/drivers/input/mouse/inport.c b/drivers/input/mouse/inport.c --- a/drivers/input/mouse/inport.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/mouse/inport.c 2005-03-16 00:08:29 -08:00 @@ -17,18 +17,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -87,29 +87,23 @@ __obsolete_setup("inport_irq="); -static int inport_used; - static irqreturn_t inport_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int inport_open(struct input_dev *dev) { - if (!inport_used++) { - if (request_irq(inport_irq, inport_interrupt, 0, "inport", NULL)) - return -EBUSY; - outb(INPORT_REG_MODE, INPORT_CONTROL_PORT); - outb(INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT); - } + if (request_irq(inport_irq, inport_interrupt, 0, "inport", NULL)) + return -EBUSY; + outb(INPORT_REG_MODE, INPORT_CONTROL_PORT); + outb(INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT); return 0; } static void inport_close(struct input_dev *dev) { - if (!--inport_used) { - outb(INPORT_REG_MODE, INPORT_CONTROL_PORT); - outb(INPORT_MODE_BASE, INPORT_DATA_PORT); - free_irq(inport_irq, NULL); - } + outb(INPORT_REG_MODE, INPORT_CONTROL_PORT); + outb(INPORT_MODE_BASE, INPORT_DATA_PORT); + free_irq(inport_irq, NULL); } static struct input_dev inport_dev = { @@ -120,11 +114,11 @@ .close = inport_close, .name = INPORT_NAME, .phys = "isa023c/input0", - .id = { - .bustype = BUS_ISA, - .vendor = INPORT_VENDOR, - .product = 0x0001, - .version = 0x0100, + .id = { + .bustype = BUS_ISA, + .vendor = INPORT_VENDOR, + .product = 0x0001, + .version = 0x0100, }, }; diff -Nru a/drivers/input/mouse/logibm.c b/drivers/input/mouse/logibm.c --- a/drivers/input/mouse/logibm.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/mouse/logibm.c 2005-03-16 00:08:29 -08:00 @@ -18,18 +18,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -77,16 +77,11 @@ __obsolete_setup("logibm_irq="); -static int logibm_used = 0; - static irqreturn_t logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int logibm_open(struct input_dev *dev) { - if (logibm_used++) - return 0; if (request_irq(logibm_irq, logibm_interrupt, 0, "logibm", NULL)) { - logibm_used--; printk(KERN_ERR "logibm.c: Can't allocate irq %d\n", logibm_irq); return -EBUSY; } @@ -96,8 +91,6 @@ static void logibm_close(struct input_dev *dev) { - if (--logibm_used) - return; outb(LOGIBM_DISABLE_IRQ, LOGIBM_CONTROL_PORT); free_irq(logibm_irq, NULL); } @@ -167,7 +160,7 @@ outb(LOGIBM_DISABLE_IRQ, LOGIBM_CONTROL_PORT); input_register_device(&logibm_dev); - + printk(KERN_INFO "input: Logitech bus mouse at %#x irq %d\n", LOGIBM_BASE, logibm_irq); return 0; diff -Nru a/drivers/input/mouse/maplemouse.c b/drivers/input/mouse/maplemouse.c --- a/drivers/input/mouse/maplemouse.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/mouse/maplemouse.c 2005-03-16 00:08:29 -08:00 @@ -1,6 +1,6 @@ /* * $Id: maplemouse.c,v 1.2 2004/03/22 01:18:15 lethal Exp $ - * SEGA Dreamcast mouse driver + * SEGA Dreamcast mouse driver * Based on drivers/usb/usbmouse.c */ @@ -15,80 +15,51 @@ MODULE_AUTHOR("YAEGASHI Takeshi "); MODULE_DESCRIPTION("SEGA Dreamcast mouse driver"); -struct dc_mouse { - struct input_dev dev; - int open; -}; - - static void dc_mouse_callback(struct mapleq *mq) { int buttons, relx, rely, relz; struct maple_device *mapledev = mq->dev; - struct dc_mouse *mouse = mapledev->private_data; - struct input_dev *dev = &mouse->dev; + struct input_dev *dev = mapledev->private_data; unsigned char *res = mq->recvbuf; buttons = ~res[8]; - relx=*(unsigned short *)(res+12)-512; - rely=*(unsigned short *)(res+14)-512; - relz=*(unsigned short *)(res+16)-512; - - input_report_key(dev, BTN_LEFT, buttons&4); - input_report_key(dev, BTN_MIDDLE, buttons&9); - input_report_key(dev, BTN_RIGHT, buttons&2); + relx = *(unsigned short *)(res + 12) - 512; + rely = *(unsigned short *)(res + 14) - 512; + relz = *(unsigned short *)(res + 16) - 512; + + input_report_key(dev, BTN_LEFT, buttons & 4); + input_report_key(dev, BTN_MIDDLE, buttons & 9); + input_report_key(dev, BTN_RIGHT, buttons & 2); input_report_rel(dev, REL_X, relx); input_report_rel(dev, REL_Y, rely); input_report_rel(dev, REL_WHEEL, relz); input_sync(dev); } - -static int dc_mouse_open(struct input_dev *dev) -{ - struct dc_mouse *mouse = dev->private; - mouse->open++; - return 0; -} - - -static void dc_mouse_close(struct input_dev *dev) -{ - struct dc_mouse *mouse = dev->private; - mouse->open--; -} - - static int dc_mouse_connect(struct maple_device *dev) { unsigned long data = be32_to_cpu(dev->devinfo.function_data[0]); - struct dc_mouse *mouse; + struct input_dev *input_dev; - if (!(mouse = kmalloc(sizeof(struct dc_mouse), GFP_KERNEL))) + if (!(input_dev = kmalloc(sizeof(struct input_dev), GFP_KERNEL))) return -1; - memset(mouse, 0, sizeof(struct dc_mouse)); - - dev->private_data = mouse; - mouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL); - mouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); - mouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL); + dev->private_data = input_dev; - init_input_dev(&mouse->dev); + memset(input_dev, 0, sizeof(struct dc_mouse)); + init_input_dev(input_dev); + input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); + input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); + input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL); - mouse->dev.private = mouse; - mouse->dev.open = dc_mouse_open; - mouse->dev.close = dc_mouse_close; - mouse->dev.event = NULL; + input_dev->name = dev->product_name; + input_dev->id.bustype = BUS_MAPLE; - mouse->dev.name = dev->product_name; - mouse->dev.id.bustype = BUS_MAPLE; - - input_register_device(&mouse->dev); + input_register_device(input_dev); maple_getcond_callback(dev, dc_mouse_callback, 1, MAPLE_FUNC_MOUSE); - printk(KERN_INFO "input: mouse(0x%lx): %s\n", data, mouse->dev.name); + printk(KERN_INFO "input: mouse(0x%lx): %s\n", data, input_dev->name); return 0; } @@ -96,10 +67,10 @@ static void dc_mouse_disconnect(struct maple_device *dev) { - struct dc_mouse *mouse = dev->private_data; + struct input_dev *input_dev = dev->private_data; - input_unregister_device(&mouse->dev); - kfree(mouse); + input_unregister_device(input_dev); + kfree(input_dev); } diff -Nru a/drivers/input/mouse/pc110pad.c b/drivers/input/mouse/pc110pad.c --- a/drivers/input/mouse/pc110pad.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/mouse/pc110pad.c 2005-03-16 00:08:29 -08:00 @@ -4,7 +4,7 @@ * Copyright (c) 2000-2001 Vojtech Pavlik * * Based on the work of: - * Alan Cox Robin O'Leary + * Alan Cox Robin O'Leary */ /* @@ -56,7 +56,6 @@ static struct input_dev pc110pad_dev; static int pc110pad_data[3]; static int pc110pad_count; -static int pc110pad_used; static char *pc110pad_name = "IBM PC110 TouchPad"; static char *pc110pad_phys = "isa15e0/input0"; @@ -74,7 +73,7 @@ if (pc110pad_count < 3) return IRQ_HANDLED; - + input_regs(&pc110pad_dev, regs); input_report_key(&pc110pad_dev, BTN_TOUCH, pc110pad_data[0] & 0x01); @@ -90,15 +89,11 @@ static void pc110pad_close(struct input_dev *dev) { - if (!--pc110pad_used) - outb(PC110PAD_OFF, pc110pad_io + 2); + outb(PC110PAD_OFF, pc110pad_io + 2); } static int pc110pad_open(struct input_dev *dev) { - if (pc110pad_used++) - return 0; - pc110pad_interrupt(0,NULL,NULL); pc110pad_interrupt(0,NULL,NULL); pc110pad_interrupt(0,NULL,NULL); @@ -145,7 +140,7 @@ pc110pad_dev.absmax[ABS_X] = 0x1ff; pc110pad_dev.absmax[ABS_Y] = 0x0ff; - + pc110pad_dev.open = pc110pad_open; pc110pad_dev.close = pc110pad_close; @@ -156,17 +151,17 @@ pc110pad_dev.id.product = 0x0001; pc110pad_dev.id.version = 0x0100; - input_register_device(&pc110pad_dev); + input_register_device(&pc110pad_dev); printk(KERN_INFO "input: %s at %#x irq %d\n", pc110pad_name, pc110pad_io, pc110pad_irq); - + return 0; } - + static void __exit pc110pad_exit(void) { - input_unregister_device(&pc110pad_dev); + input_unregister_device(&pc110pad_dev); outb(PC110PAD_OFF, pc110pad_io + 2); diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c --- a/drivers/input/mouse/psmouse-base.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/mouse/psmouse-base.c 2005-03-16 00:08:29 -08:00 @@ -518,13 +518,16 @@ /* * First, we check if it's a mouse. It should send 0x00 or 0x03 * in case of an IntelliMouse in 4-byte mode or 0x04 for IM Explorer. + * Sunrex K8561 IR Keyboard/Mouse reports 0xff on second and subsequent + * ID queries, probably due to a firmware bug. */ param[0] = 0xa5; if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETID)) return -1; - if (param[0] != 0x00 && param[0] != 0x03 && param[0] != 0x04) + if (param[0] != 0x00 && param[0] != 0x03 && + param[0] != 0x04 && param[0] != 0xff) return -1; /* @@ -972,7 +975,7 @@ return -EINVAL; if (!strncmp(val, "any", 3)) { - *((unsigned int *)kp->arg) = -1UL; + *((unsigned int *)kp->arg) = -1U; return 0; } diff -Nru a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h --- a/drivers/input/mouse/psmouse.h 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/mouse/psmouse.h 2005-03-16 00:08:29 -08:00 @@ -99,7 +99,7 @@ { \ return psmouse_attr_set_helper(d, b, s, psmouse_attr_set_##_name); \ } \ -static struct device_attribute psmouse_attr_##_name = \ +static struct device_attribute psmouse_attr_##_name = \ __ATTR(_name, S_IWUSR | S_IRUGO, \ psmouse_do_show_##_name, psmouse_do_set_##_name); diff -Nru a/drivers/input/mouse/rpcmouse.c b/drivers/input/mouse/rpcmouse.c --- a/drivers/input/mouse/rpcmouse.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/mouse/rpcmouse.c 2005-03-16 00:08:29 -08:00 @@ -59,7 +59,7 @@ b = (short) (__raw_readl(0xe0310000) ^ 0x70); dx = x - rpcmouse_lastx; - dy = y - rpcmouse_lasty; + dy = y - rpcmouse_lasty; rpcmouse_lastx = x; rpcmouse_lasty = y; diff -Nru a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c --- a/drivers/input/mouse/vsxxxaa.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/mouse/vsxxxaa.c 2005-03-16 00:08:29 -08:00 @@ -1,7 +1,7 @@ /* * Driver for DEC VSXXX-AA mouse (hockey-puck mouse, ball or two rollers) - * DEC VSXXX-GA mouse (rectangular mouse, with ball) - * DEC VSXXX-AB tablet (digitizer with hair cross or stylus) + * DEC VSXXX-GA mouse (rectangular mouse, with ball) + * DEC VSXXX-AB tablet (digitizer with hair cross or stylus) * * Copyright (C) 2003-2004 by Jan-Benedict Glaw * diff -Nru a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h --- a/drivers/input/serio/i8042-x86ia64io.h 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/serio/i8042-x86ia64io.h 2005-03-16 00:08:29 -08:00 @@ -215,11 +215,15 @@ static void i8042_pnp_exit(void) { - if (i8042_pnp_kbd_registered) + if (i8042_pnp_kbd_registered) { + i8042_pnp_kbd_registered = 0; pnp_unregister_driver(&i8042_pnp_kbd_driver); + } - if (i8042_pnp_aux_registered) + if (i8042_pnp_aux_registered) { + i8042_pnp_aux_registered = 0; pnp_unregister_driver(&i8042_pnp_aux_driver); + } } static int i8042_pnp_init(void) @@ -227,7 +231,7 @@ int result_kbd, result_aux; if (i8042_nopnp) { - printk("i8042: PNP detection disabled\n"); + printk(KERN_INFO "i8042: PNP detection disabled\n"); return 0; } @@ -241,7 +245,7 @@ #if defined(__ia64__) return -ENODEV; #else - printk(KERN_WARNING "PNP: No PS/2 controller found. Probing ports directly.\n"); + printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n"); return 0; #endif } @@ -265,7 +269,7 @@ i8042_pnp_kbd_irq = i8042_kbd_irq; } - if (result_aux > 0 && !i8042_pnp_aux_irq) { + if (!i8042_pnp_aux_irq) { printk(KERN_WARNING "PNP: PS/2 controller doesn't have AUX irq; using default %#x\n", i8042_aux_irq); i8042_pnp_aux_irq = i8042_aux_irq; } diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c --- a/drivers/input/serio/i8042.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/serio/i8042.c 2005-03-16 00:08:29 -08:00 @@ -698,6 +698,26 @@ i8042_interrupt(0, NULL, NULL); } +static int i8042_ctl_test(void) +{ + unsigned char param; + + if (!i8042_reset) + return 0; + + if (i8042_command(¶m, I8042_CMD_CTL_TEST)) { + printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n"); + return -1; + } + + if (param != I8042_RET_CTL_TEST) { + printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n", + param, I8042_RET_CTL_TEST); + return -1; + } + + return 0; +} /* * i8042_controller init initializes the i8042 controller, and, @@ -719,21 +739,8 @@ return -1; } - if (i8042_reset) { - - unsigned char param; - - if (i8042_command(¶m, I8042_CMD_CTL_TEST)) { - printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n"); - return -1; - } - - if (param != I8042_RET_CTL_TEST) { - printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n", - param, I8042_RET_CTL_TEST); - return -1; - } - } + if (i8042_ctl_test()) + return -1; /* * Save the CTR for restoral on unload / reboot. @@ -802,15 +809,11 @@ */ static void i8042_controller_reset(void) { - unsigned char param; - /* * Reset the controller if requested. */ - if (i8042_reset) - if (i8042_command(¶m, I8042_CMD_CTL_TEST)) - printk(KERN_ERR "i8042.c: i8042 controller reset timeout.\n"); + i8042_ctl_test(); /* * Disable MUX mode if present. @@ -922,8 +925,11 @@ if (level != RESUME_ENABLE) return 0; - if (i8042_controller_init()) { - printk(KERN_ERR "i8042: resume failed\n"); + if (i8042_ctl_test()) + return -1; + + if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { + printk(KERN_ERR "i8042: Can't write CTR\n"); return -1; } diff -Nru a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c --- a/drivers/input/touchscreen/elo.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/touchscreen/elo.c 2005-03-16 00:08:29 -08:00 @@ -226,7 +226,7 @@ input_set_abs_params(&elo->dev, ABS_Y, 96, 4000, 0, 0); input_set_abs_params(&elo->dev, ABS_PRESSURE, 0, 255, 0, 0); break; - + case 1: /* 6-byte protocol */ input_set_abs_params(&elo->dev, ABS_PRESSURE, 0, 15, 0, 0); diff -Nru a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c --- a/drivers/input/touchscreen/h3600_ts_input.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/touchscreen/h3600_ts_input.c 2005-03-16 00:08:29 -08:00 @@ -89,9 +89,9 @@ #define H3600_SCANCODE_Q 4 /* 4 -> Q button */ #define H3600_SCANCODE_START 5 /* 5 -> start menu */ #define H3600_SCANCODE_UP 6 /* 6 -> up */ -#define H3600_SCANCODE_RIGHT 7 /* 7 -> right */ -#define H3600_SCANCODE_LEFT 8 /* 8 -> left */ -#define H3600_SCANCODE_DOWN 9 /* 9 -> down */ +#define H3600_SCANCODE_RIGHT 7 /* 7 -> right */ +#define H3600_SCANCODE_LEFT 8 /* 8 -> left */ +#define H3600_SCANCODE_DOWN 9 /* 9 -> down */ static char *h3600_name = "H3600 TouchScreen"; @@ -113,7 +113,7 @@ static irqreturn_t action_button_handler(int irq, void *dev_id, struct pt_regs *regs) { - int down = (GPLR & GPIO_BITSY_ACTION_BUTTON) ? 0 : 1; + int down = (GPLR & GPIO_BITSY_ACTION_BUTTON) ? 0 : 1; struct input_dev *dev = (struct input_dev *) dev_id; input_regs(dev, regs); @@ -125,7 +125,7 @@ static irqreturn_t npower_button_handler(int irq, void *dev_id, struct pt_regs *regs) { - int down = (GPLR & GPIO_BITSY_NPOWER_BUTTON) ? 0 : 1; + int down = (GPLR & GPIO_BITSY_NPOWER_BUTTON) ? 0 : 1; struct input_dev *dev = (struct input_dev *) dev_id; /* @@ -145,8 +145,8 @@ static int flite_brightness = 25; enum flite_pwr { - FLITE_PWR_OFF = 0, - FLITE_PWR_ON = 1 + FLITE_PWR_OFF = 0, + FLITE_PWR_ON = 1 }; /* @@ -157,9 +157,9 @@ struct h3600_dev *ts = dev->private; /* Must be in this order */ - ts->serio->write(ts->serio, 1); + ts->serio->write(ts->serio, 1); ts->serio->write(ts->serio, pwr); - ts->serio->write(ts->serio, brightness); + ts->serio->write(ts->serio, brightness); return 0; } @@ -169,26 +169,26 @@ { struct input_dev *dev = (struct input_dev *) data; - switch (req) { - case PM_SUSPEND: /* enter D1-D3 */ - suspended = 1; - h3600_flite_power(dev, FLITE_PWR_OFF); - break; - case PM_BLANK: - if (!suspended) - h3600_flite_power(dev, FLITE_PWR_OFF); - break; - case PM_RESUME: /* enter D0 */ - /* same as unblank */ - case PM_UNBLANK: - if (suspended) { - //initSerial(); - suspended = 0; - } - h3600_flite_power(dev, FLITE_PWR_ON); - break; - } - return 0; + switch (req) { + case PM_SUSPEND: /* enter D1-D3 */ + suspended = 1; + h3600_flite_power(dev, FLITE_PWR_OFF); + break; + case PM_BLANK: + if (!suspended) + h3600_flite_power(dev, FLITE_PWR_OFF); + break; + case PM_RESUME: /* enter D0 */ + /* same as unblank */ + case PM_UNBLANK: + if (suspended) { + //initSerial(); + suspended = 0; + } + h3600_flite_power(dev, FLITE_PWR_ON); + break; + } + return 0; } #endif @@ -199,25 +199,25 @@ */ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) { - struct input_dev *dev = &ts->dev; + struct input_dev *dev = &ts->dev; static int touched = 0; int key, down = 0; input_regs(dev, regs); - switch (ts->event) { - /* - Buttons - returned as a single byte - 7 6 5 4 3 2 1 0 - S x x x N N N N - - S switch state ( 0=pressed 1=released) - x Unused. - NNNN switch number 0-15 - - Note: This is true for non interrupt generated key events. - */ - case KEYBD_ID: + switch (ts->event) { + /* + Buttons - returned as a single byte + 7 6 5 4 3 2 1 0 + S x x x N N N N + + S switch state ( 0=pressed 1=released) + x Unused. + NNNN switch number 0-15 + + Note: This is true for non interrupt generated key events. + */ + case KEYBD_ID: down = (ts->buf[0] & 0x80) ? 0 : 1; switch (ts->buf[0] & 0x7f) { @@ -229,40 +229,40 @@ break; case H3600_SCANCODE_CONTACTS: key = KEY_PROG2; - break; + break; case H3600_SCANCODE_Q: key = KEY_Q; - break; + break; case H3600_SCANCODE_START: key = KEY_PROG3; - break; + break; case H3600_SCANCODE_UP: key = KEY_UP; - break; + break; case H3600_SCANCODE_RIGHT: key = KEY_RIGHT; - break; + break; case H3600_SCANCODE_LEFT: key = KEY_LEFT; - break; + break; case H3600_SCANCODE_DOWN: key = KEY_DOWN; - break; + break; default: key = 0; } - if (key) - input_report_key(dev, key, down); - break; - /* - * Native touchscreen event data is formatted as shown below:- - * - * +-------+-------+-------+-------+ - * | Xmsb | Xlsb | Ymsb | Ylsb | - * +-------+-------+-------+-------+ - * byte 0 1 2 3 - */ - case TOUCHS_ID: + if (key) + input_report_key(dev, key, down); + break; + /* + * Native touchscreen event data is formatted as shown below:- + * + * +-------+-------+-------+-------+ + * | Xmsb | Xlsb | Ymsb | Ylsb | + * +-------+-------+-------+-------+ + * byte 0 1 2 3 + */ + case TOUCHS_ID: if (!touched) { input_report_key(dev, BTN_TOUCH, 1); touched = 1; @@ -272,19 +272,19 @@ unsigned short x, y; x = ts->buf[0]; x <<= 8; x += ts->buf[1]; - y = ts->buf[2]; y <<= 8; y += ts->buf[3]; + y = ts->buf[2]; y <<= 8; y += ts->buf[3]; - input_report_abs(dev, ABS_X, x); - input_report_abs(dev, ABS_Y, y); + input_report_abs(dev, ABS_X, x); + input_report_abs(dev, ABS_Y, y); } else { - input_report_key(dev, BTN_TOUCH, 0); + input_report_key(dev, BTN_TOUCH, 0); touched = 0; } - break; + break; default: /* Send a non input event elsewhere */ break; - } + } input_sync(dev); } @@ -293,7 +293,7 @@ * h3600ts_event() handles events from the input module. */ static int h3600ts_event(struct input_dev *dev, unsigned int type, - unsigned int code, int value) + unsigned int code, int value) { struct h3600_dev *ts = dev->private; @@ -332,41 +332,41 @@ static irqreturn_t h3600ts_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs) { - struct h3600_dev *ts = serio_get_drvdata(serio); + struct h3600_dev *ts = serio_get_drvdata(serio); /* - * We have a new frame coming in. - */ + * We have a new frame coming in. + */ switch (state) { case STATE_SOF: - if (data == CHAR_SOF) - state = STATE_ID; + if (data == CHAR_SOF) + state = STATE_ID; break; - case STATE_ID: + case STATE_ID: ts->event = (data & 0xf0) >> 4; ts->len = (data & 0xf); ts->idx = 0; if (ts->event >= MAX_ID) { state = STATE_SOF; - break; + break; } ts->chksum = data; - state = (ts->len > 0) ? STATE_DATA : STATE_EOF; + state = (ts->len > 0) ? STATE_DATA : STATE_EOF; break; case STATE_DATA: ts->chksum += data; ts->buf[ts->idx]= data; - if(++ts->idx == ts->len) - state = STATE_EOF; + if (++ts->idx == ts->len) + state = STATE_EOF; break; case STATE_EOF: - state = STATE_SOF; - if (data == CHAR_EOF || data == ts->chksum) + state = STATE_SOF; + if (data == CHAR_EOF || data == ts->chksum) h3600ts_process_packet(ts, regs); - break; - default: - printk("Error3\n"); - break; + break; + default: + printk("Error3\n"); + break; } return IRQ_HANDLED; @@ -390,10 +390,10 @@ init_input_dev(&ts->dev); /* Device specific stuff */ - set_GPIO_IRQ_edge(GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES); - set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE); + set_GPIO_IRQ_edge(GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES); + set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE); - if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler, + if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler, SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_action", &ts->dev)) { printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); @@ -401,7 +401,7 @@ return -EBUSY; } - if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, + if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_suspend", &ts->dev)) { free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev); @@ -433,7 +433,7 @@ sprintf(ts->phys, "%s/input0", serio->phys); - ts->dev.event = h3600ts_event; + ts->dev.event = h3600ts_event; ts->dev.private = ts; ts->dev.name = h3600_name; ts->dev.phys = ts->phys; @@ -446,8 +446,8 @@ err = serio_open(serio, drv); if (err) { - free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts); - free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts); + free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts); + free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts); serio_set_drvdata(serio, NULL); kfree(ts); return err; diff -Nru a/drivers/input/touchscreen/mk712.c b/drivers/input/touchscreen/mk712.c --- a/drivers/input/touchscreen/mk712.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/input/touchscreen/mk712.c 2005-03-16 00:08:29 -08:00 @@ -17,7 +17,7 @@ * found in Gateway AOL Connected Touchpad computers. * * Documentation for ICS MK712 can be found at: - * http://www.icst.com/pdf/mk712.pdf + * http://www.icst.com/pdf/mk712.pdf */ /* @@ -77,7 +77,6 @@ #define MK712_READ_ONE_POINT 0x20 #define MK712_POWERUP 0x40 -static int mk712_used = 0; static struct input_dev mk712_dev; static DEFINE_SPINLOCK(mk712_lock); @@ -130,17 +129,14 @@ spin_lock_irqsave(&mk712_lock, flags); - if (!mk712_used++) { + outb(0, mk712_io + MK712_CONTROL); /* Reset */ - outb(0, mk712_io + MK712_CONTROL); /* Reset */ + outb(MK712_ENABLE_INT | MK712_INT_ON_CONVERSION_COMPLETE | + MK712_INT_ON_CHANGE_IN_TOUCH_STATUS | + MK712_ENABLE_PERIODIC_CONVERSIONS | + MK712_POWERUP, mk712_io + MK712_CONTROL); - outb(MK712_ENABLE_INT | MK712_INT_ON_CONVERSION_COMPLETE | - MK712_INT_ON_CHANGE_IN_TOUCH_STATUS | - MK712_ENABLE_PERIODIC_CONVERSIONS | - MK712_POWERUP, mk712_io + MK712_CONTROL); - - outb(10, mk712_io + MK712_RATE); /* 187 points per second */ - } + outb(10, mk712_io + MK712_RATE); /* 187 points per second */ spin_unlock_irqrestore(&mk712_lock, flags); @@ -153,8 +149,7 @@ spin_lock_irqsave(&mk712_lock, flags); - if (!--mk712_used) - outb(0, mk712_io + MK712_CONTROL); + outb(0, mk712_io + MK712_CONTROL); spin_unlock_irqrestore(&mk712_lock, flags); } diff -Nru a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig --- a/drivers/usb/input/Kconfig 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/Kconfig 2005-03-16 00:08:29 -08:00 @@ -190,6 +190,18 @@ To compile this driver as a module, choose M here: the module will be called mtouchusb. +config USB_ITMTOUCH + tristate "ITM Touch USB Touchscreen Driver" + depends on USB && INPUT + ---help--- + Say Y here if you want to use a ITM Touch USB + Touchscreen controller. + + This touchscreen is used in LG 1510SF monitors. + + To compile this driver as a module, choose M here: the + module will be called itmtouch. + config USB_EGALAX tristate "eGalax TouchKit USB Touchscreen Driver" depends on USB && INPUT diff -Nru a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile --- a/drivers/usb/input/Makefile 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/Makefile 2005-03-16 00:08:29 -08:00 @@ -33,6 +33,7 @@ obj-$(CONFIG_USB_KBTAB) += kbtab.o obj-$(CONFIG_USB_MOUSE) += usbmouse.o obj-$(CONFIG_USB_MTOUCH) += mtouchusb.o +obj-$(CONFIG_USB_ITMTOUCH) += itmtouch.o obj-$(CONFIG_USB_EGALAX) += touchkitusb.o obj-$(CONFIG_USB_POWERMATE) += powermate.o obj-$(CONFIG_USB_WACOM) += wacom.o diff -Nru a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c --- a/drivers/usb/input/aiptek.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/aiptek.c 2005-03-16 00:08:29 -08:00 @@ -1,7 +1,7 @@ /* * Native support for the Aiptek HyperPen USB Tablets * (4000U/5000U/6000U/8000U/12000U) - * + * * Copyright (c) 2001 Chris Atenasio * Copyright (c) 2002-2004 Bryan W. Headley * @@ -31,7 +31,7 @@ * - Added support for the sysfs interface, deprecating the * procfs interface for 2.5.x kernel. Also added support for * Wheel command. Bryan W. Headley July-15-2003. - * v1.2 - Reworked jitter timer as a kernel thread. + * v1.2 - Reworked jitter timer as a kernel thread. * Bryan W. Headley November-28-2003/Jan-10-2004. * v1.3 - Repaired issue of kernel thread going nuts on single-processor * machines, introduced programmableDelay as a command line @@ -49,10 +49,10 @@ * NOTE: * This kernel driver is augmented by the "Aiptek" XFree86 input * driver for your X server, as well as the Gaiptek GUI Front-end - * "Tablet Manager". - * These three products are highly interactive with one another, + * "Tablet Manager". + * These three products are highly interactive with one another, * so therefore it's easier to document them all as one subsystem. - * Please visit the project's "home page", located at, + * Please visit the project's "home page", located at, * http://aiptektablet.sourceforge.net. * * This program is free software; you can redistribute it and/or modify @@ -156,7 +156,7 @@ * Command/Data Description Return Bytes Return Value * 0x10/0x00 SwitchToMouse 0 * 0x10/0x01 SwitchToTablet 0 - * 0x18/0x04 SetResolution 0 + * 0x18/0x04 SetResolution 0 * 0x12/0xFF AutoGainOn 0 * 0x17/0x00 FilterOn 0 * 0x01/0x00 GetXExtension 2 MaxX @@ -247,7 +247,7 @@ #define AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE 2 #define AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED 3 - /* Time to wait (in ms) to help mask hand jittering + /* Time to wait (in ms) to help mask hand jittering * when pressing the stylus buttons. */ #define AIPTEK_JITTER_DELAY_DEFAULT 50 @@ -324,7 +324,6 @@ struct aiptek_settings curSetting; /* tablet's current programmable */ struct aiptek_settings newSetting; /* ... and new param settings */ unsigned int ifnum; /* interface number for IO */ - int openCount; /* module use counter */ int diagnostic; /* tablet diagnostic codes */ unsigned long eventCount; /* event count */ int inDelay; /* jitter: in jitter delay? */ @@ -791,7 +790,7 @@ * specific Aiptek model numbers, because there has been overlaps, * use, and reuse of id's in existing models. Certain models have * been known to use more than one ID, indicative perhaps of - * manufacturing revisions. In any event, we consider these + * manufacturing revisions. In any event, we consider these * IDs to not be model-specific nor unique. */ struct usb_device_id aiptek_ids[] = { @@ -814,15 +813,9 @@ { struct aiptek *aiptek = inputdev->private; - if (aiptek->openCount++ > 0) { - return 0; - } - aiptek->urb->dev = aiptek->usbdev; - if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) { - aiptek->openCount--; + if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) return -EIO; - } return 0; } @@ -834,13 +827,11 @@ { struct aiptek *aiptek = inputdev->private; - if (--aiptek->openCount == 0) { - usb_kill_urb(aiptek->urb); - } + usb_kill_urb(aiptek->urb); } /*********************************************************************** - * aiptek_set_report and aiptek_get_report() are borrowed from Linux 2.4.x, + * aiptek_set_report and aiptek_get_report() are borrowed from Linux 2.4.x, * where they were known as usb_set_report and usb_get_report. */ static int @@ -2251,7 +2242,6 @@ AIPTEK_PACKET_LENGTH, aiptek->data, aiptek->data_dma); kfree(aiptek); - aiptek = NULL; } } diff -Nru a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c --- a/drivers/usb/input/ati_remote.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/ati_remote.c 2005-03-16 00:08:29 -08:00 @@ -1,15 +1,15 @@ -/* +/* * USB ATI Remote support * * Version 2.2.0 Copyright (c) 2004 Torrey Hoffman * Version 2.1.1 Copyright (c) 2002 Vladimir Dergachev * * This 2.2.0 version is a rewrite / cleanup of the 2.1.1 driver, including - * porting to the 2.6 kernel interfaces, along with other modification + * porting to the 2.6 kernel interfaces, along with other modification * to better match the style of the existing usb/input drivers. However, the * protocol and hardware handling is essentially unchanged from 2.1.1. - * - * The 2.1.1 driver was derived from the usbati_remote and usbkbd drivers by + * + * The 2.1.1 driver was derived from the usbati_remote and usbkbd drivers by * Vojtech Pavlik. * * Changes: @@ -23,64 +23,64 @@ * Added support for the "Lola" remote contributed by: * Seth Cohn * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Hardware & software notes * - * These remote controls are distributed by ATI as part of their - * "All-In-Wonder" video card packages. The receiver self-identifies as a + * These remote controls are distributed by ATI as part of their + * "All-In-Wonder" video card packages. The receiver self-identifies as a * "USB Receiver" with manufacturer "X10 Wireless Technology Inc". * - * The "Lola" remote is available from X10. See: + * The "Lola" remote is available from X10. See: * http://www.x10.com/products/lola_sg1.htm * The Lola is similar to the ATI remote but has no mouse support, and slightly * different keys. * - * It is possible to use multiple receivers and remotes on multiple computers + * It is possible to use multiple receivers and remotes on multiple computers * simultaneously by configuring them to use specific channels. - * - * The RF protocol used by the remote supports 16 distinct channels, 1 to 16. - * Actually, it may even support more, at least in some revisions of the + * + * The RF protocol used by the remote supports 16 distinct channels, 1 to 16. + * Actually, it may even support more, at least in some revisions of the * hardware. * * Each remote can be configured to transmit on one channel as follows: - * - Press and hold the "hand icon" button. - * - When the red LED starts to blink, let go of the "hand icon" button. - * - When it stops blinking, input the channel code as two digits, from 01 + * - Press and hold the "hand icon" button. + * - When the red LED starts to blink, let go of the "hand icon" button. + * - When it stops blinking, input the channel code as two digits, from 01 * to 16, and press the hand icon again. - * + * * The timing can be a little tricky. Try loading the module with debug=1 * to have the kernel print out messages about the remote control number * and mask. Note: debugging prints remote numbers as zero-based hexadecimal. * * The driver has a "channel_mask" parameter. This bitmask specifies which - * channels will be ignored by the module. To mask out channels, just add + * channels will be ignored by the module. To mask out channels, just add * all the 2^channel_number values together. * * For instance, set channel_mask = 2^4 = 16 (binary 10000) to make ati_remote - * ignore signals coming from remote controls transmitting on channel 4, but + * ignore signals coming from remote controls transmitting on channel 4, but * accept all other channels. * - * Or, set channel_mask = 65533, (0xFFFD), and all channels except 1 will be + * Or, set channel_mask = 65533, (0xFFFD), and all channels except 1 will be * ignored. * - * The default is 0 (respond to all channels). Bit 0 and bits 17-32 of this + * The default is 0 (respond to all channels). Bit 0 and bits 17-32 of this * parameter are unused. * */ @@ -99,13 +99,13 @@ /* * Module and Version Information, Module Parameters */ - -#define ATI_REMOTE_VENDOR_ID 0x0bc7 -#define ATI_REMOTE_PRODUCT_ID 0x004 -#define LOLA_REMOTE_PRODUCT_ID 0x002 + +#define ATI_REMOTE_VENDOR_ID 0x0bc7 +#define ATI_REMOTE_PRODUCT_ID 0x004 +#define LOLA_REMOTE_PRODUCT_ID 0x002 #define MEDION_REMOTE_PRODUCT_ID 0x006 -#define DRIVER_VERSION "2.2.1" +#define DRIVER_VERSION "2.2.1" #define DRIVER_AUTHOR "Torrey Hoffman " #define DRIVER_DESC "ATI/X10 RF USB Remote Control" @@ -113,18 +113,18 @@ #define DATA_BUFSIZE 63 /* size of URB data buffers */ #define ATI_INPUTNUM 1 /* Which input device to register as */ -static unsigned long channel_mask = 0; +static unsigned long channel_mask; module_param(channel_mask, ulong, 0444); MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore"); -static int debug = 0; +static int debug; module_param(debug, int, 0444); MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); #define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) #undef err #define err(format, arg...) printk(KERN_ERR format , ## arg) - + static struct usb_device_id ati_remote_table[] = { { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID) }, { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID) }, @@ -148,7 +148,7 @@ /* Acceleration curve for directional control pad */ static char accel[] = { 1, 2, 4, 6, 9, 13, 20 }; -/* Duplicate event filtering time. +/* Duplicate event filtering time. * Sequential, identical KIND_FILTERED inputs with less than * FILTER_TIME jiffies between them are considered as repeat * events. The hardware generates 5 events for the first keypress @@ -161,10 +161,10 @@ static DECLARE_MUTEX(disconnect_sem); struct ati_remote { - struct input_dev idev; + struct input_dev idev; struct usb_device *udev; struct usb_interface *interface; - + struct urb *irq_urb; struct urb *out_urb; struct usb_endpoint_descriptor *endpoint_in; @@ -174,13 +174,11 @@ dma_addr_t inbuf_dma; dma_addr_t outbuf_dma; - int open; /* open counter */ - unsigned char old_data[2]; /* Detect duplicate events */ unsigned long old_jiffies; unsigned long acc_jiffies; /* handle acceleration */ unsigned int repeat_count; - + char name[NAME_BUFSIZE]; char phys[NAME_BUFSIZE]; @@ -206,14 +204,14 @@ int type; unsigned int code; int value; -} ati_remote_tbl[] = +} ati_remote_tbl[] = { /* Directional control pad axes */ {KIND_ACCEL, 0x35, 0x70, EV_REL, REL_X, -1}, /* left */ {KIND_ACCEL, 0x36, 0x71, EV_REL, REL_X, 1}, /* right */ {KIND_ACCEL, 0x37, 0x72, EV_REL, REL_Y, -1}, /* up */ {KIND_ACCEL, 0x38, 0x73, EV_REL, REL_Y, 1}, /* down */ - /* Directional control pad diagonals */ + /* Directional control pad diagonals */ {KIND_LU, 0x39, 0x74, EV_REL, 0, 0}, /* left up */ {KIND_RU, 0x3a, 0x75, EV_REL, 0, 0}, /* right up */ {KIND_LD, 0x3c, 0x77, EV_REL, 0, 0}, /* left down */ @@ -225,7 +223,7 @@ {KIND_LITERAL, 0x41, 0x7c, EV_KEY, BTN_RIGHT, 1},/* right btn down */ {KIND_LITERAL, 0x42, 0x7d, EV_KEY, BTN_RIGHT, 0},/* right btn up */ - /* Artificial "doubleclick" events are generated by the hardware. + /* Artificial "doubleclick" events are generated by the hardware. * They are mapped to the "side" and "extra" mouse buttons here. */ {KIND_FILTERED, 0x3f, 0x7a, EV_KEY, BTN_SIDE, 1}, /* left dblclick */ {KIND_FILTERED, 0x43, 0x7e, EV_KEY, BTN_EXTRA, 1},/* right dblclick */ @@ -273,15 +271,15 @@ {KIND_FILTERED, 0xea, 0x25, EV_KEY, KEY_PLAY, 1}, /* ( >) */ {KIND_FILTERED, 0xe9, 0x24, EV_KEY, KEY_REWIND, 1}, /* (<<) */ {KIND_FILTERED, 0xeb, 0x26, EV_KEY, KEY_FORWARD, 1}, /* (>>) */ - {KIND_FILTERED, 0xed, 0x28, EV_KEY, KEY_STOP, 1}, /* ([]) */ + {KIND_FILTERED, 0xed, 0x28, EV_KEY, KEY_STOP, 1}, /* ([]) */ {KIND_FILTERED, 0xee, 0x29, EV_KEY, KEY_PAUSE, 1}, /* ('') */ {KIND_FILTERED, 0xf0, 0x2b, EV_KEY, KEY_PREVIOUS, 1}, /* (<-) */ {KIND_FILTERED, 0xef, 0x2a, EV_KEY, KEY_NEXT, 1}, /* (>+) */ {KIND_FILTERED, 0xf2, 0x2D, EV_KEY, KEY_INFO, 1}, /* PLAYING */ {KIND_FILTERED, 0xf3, 0x2E, EV_KEY, KEY_HOME, 1}, /* TOP */ {KIND_FILTERED, 0xf4, 0x2F, EV_KEY, KEY_END, 1}, /* END */ - {KIND_FILTERED, 0xf5, 0x30, EV_KEY, KEY_SELECT, 1}, /* SELECT */ - + {KIND_FILTERED, 0xf5, 0x30, EV_KEY, KEY_SELECT, 1}, /* SELECT */ + {KIND_END, 0x00, 0x00, EV_MAX + 1, 0, 0} }; @@ -315,7 +313,7 @@ if ((len == 1) && (data[0] != (unsigned char)0xff) && (data[0] != 0x00)) warn("Weird byte 0x%02x", data[0]); else if (len == 4) - warn("Weird key %02x %02x %02x %02x", + warn("Weird key %02x %02x %02x %02x", data[0], data[1], data[2], data[3]); else warn("Weird data, len=%d %02x %02x %02x %02x %02x %02x ...", @@ -328,25 +326,16 @@ static int ati_remote_open(struct input_dev *inputdev) { struct ati_remote *ati_remote = inputdev->private; - int retval = 0; - - down(&disconnect_sem); - - if (ati_remote->open++) - goto exit; /* On first open, submit the read urb which was set up previously. */ ati_remote->irq_urb->dev = ati_remote->udev; if (usb_submit_urb(ati_remote->irq_urb, GFP_KERNEL)) { - dev_err(&ati_remote->interface->dev, + dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb failed!\n", __FUNCTION__); - ati_remote->open--; - retval = -EIO; + return -EIO; } -exit: - up(&disconnect_sem); - return retval; + return 0; } /* @@ -355,9 +344,8 @@ static void ati_remote_close(struct input_dev *inputdev) { struct ati_remote *ati_remote = inputdev->private; - - if (!--ati_remote->open) - usb_kill_urb(ati_remote->irq_urb); + + usb_kill_urb(ati_remote->irq_urb); } /* @@ -366,13 +354,13 @@ static void ati_remote_irq_out(struct urb *urb, struct pt_regs *regs) { struct ati_remote *ati_remote = urb->context; - + if (urb->status) { dev_dbg(&ati_remote->interface->dev, "%s: status %d\n", __FUNCTION__, urb->status); return; } - + ati_remote->send_flags |= SEND_FLAG_COMPLETE; wmb(); wake_up(&ati_remote->wait); @@ -380,16 +368,16 @@ /* * ati_remote_sendpacket - * + * * Used to send device initialization strings */ static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigned char *data) { int retval = 0; - + /* Set up out_urb */ memcpy(ati_remote->out_urb->transfer_buffer + 1, data, LO(cmd)); - ((char *) ati_remote->out_urb->transfer_buffer)[0] = HI(cmd); + ((char *) ati_remote->out_urb->transfer_buffer)[0] = HI(cmd); ati_remote->out_urb->transfer_buffer_length = LO(cmd) + 1; ati_remote->out_urb->dev = ati_remote->udev; @@ -397,17 +385,17 @@ retval = usb_submit_urb(ati_remote->out_urb, GFP_ATOMIC); if (retval) { - dev_dbg(&ati_remote->interface->dev, + dev_dbg(&ati_remote->interface->dev, "sendpacket: usb_submit_urb failed: %d\n", retval); return retval; } wait_event_timeout(ati_remote->wait, ((ati_remote->out_urb->status != -EINPROGRESS) || - (ati_remote->send_flags & SEND_FLAG_COMPLETE)), + (ati_remote->send_flags & SEND_FLAG_COMPLETE)), HZ); usb_kill_urb(ati_remote->out_urb); - + return retval; } @@ -419,15 +407,15 @@ int i; for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) { - /* - * Decide if the table entry matches the remote input. + /* + * Decide if the table entry matches the remote input. */ if ((((ati_remote_tbl[i].data1 & 0x0f) == (d1 & 0x0f))) && - ((((ati_remote_tbl[i].data1 >> 4) - - (d1 >> 4) + rem) & 0x0f) == 0x0f) && + ((((ati_remote_tbl[i].data1 >> 4) - + (d1 >> 4) + rem) & 0x0f) == 0x0f) && (ati_remote_tbl[i].data2 == d2)) return i; - + } return -1; } @@ -435,16 +423,16 @@ /* * ati_remote_report_input */ -static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) +static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) { struct ati_remote *ati_remote = urb->context; unsigned char *data= ati_remote->inbuf; - struct input_dev *dev = &ati_remote->idev; + struct input_dev *dev = &ati_remote->idev; int index, acc; int remote_num; - + /* Deal with strange looking inputs */ - if ( (urb->actual_length != 4) || (data[0] != 0x14) || + if ( (urb->actual_length != 4) || (data[0] != 0x14) || ((data[3] & 0x0f) != 0x00) ) { ati_remote_dump(data, urb->actual_length); return; @@ -453,7 +441,7 @@ /* Mask unwanted remote channels. */ /* note: remote_num is 0-based, channel 1 on remote == 0 here */ remote_num = (data[3] >> 4) & 0x0f; - if (channel_mask & (1 << (remote_num + 1))) { + if (channel_mask & (1 << (remote_num + 1))) { dbginfo(&ati_remote->interface->dev, "Masked input from channel 0x%02x: data %02x,%02x, mask= 0x%02lx\n", remote_num, data[1], data[2], channel_mask); @@ -463,37 +451,36 @@ /* Look up event code index in translation table */ index = ati_remote_event_lookup(remote_num, data[1], data[2]); if (index < 0) { - dev_warn(&ati_remote->interface->dev, - "Unknown input from channel 0x%02x: data %02x,%02x\n", + dev_warn(&ati_remote->interface->dev, + "Unknown input from channel 0x%02x: data %02x,%02x\n", remote_num, data[1], data[2]); return; - } - dbginfo(&ati_remote->interface->dev, + } + dbginfo(&ati_remote->interface->dev, "channel 0x%02x; data %02x,%02x; index %d; keycode %d\n", remote_num, data[1], data[2], index, ati_remote_tbl[index].code); - + if (ati_remote_tbl[index].kind == KIND_LITERAL) { input_regs(dev, regs); input_event(dev, ati_remote_tbl[index].type, ati_remote_tbl[index].code, ati_remote_tbl[index].value); input_sync(dev); - + ati_remote->old_jiffies = jiffies; return; } - + if (ati_remote_tbl[index].kind == KIND_FILTERED) { /* Filter duplicate events which happen "too close" together. */ - if ((ati_remote->old_data[0] == data[1]) && - (ati_remote->old_data[1] == data[2]) && - ((ati_remote->old_jiffies + FILTER_TIME) > jiffies)) { + if ((ati_remote->old_data[0] == data[1]) && + (ati_remote->old_data[1] == data[2]) && + ((ati_remote->old_jiffies + FILTER_TIME) > jiffies)) { ati_remote->repeat_count++; - } - else { + } else { ati_remote->repeat_count = 0; } - + ati_remote->old_data[0] = data[1]; ati_remote->old_data[1] = data[2]; ati_remote->old_jiffies = jiffies; @@ -501,7 +488,7 @@ if ((ati_remote->repeat_count > 0) && (ati_remote->repeat_count < 5)) return; - + input_regs(dev, regs); input_event(dev, ati_remote_tbl[index].type, @@ -511,13 +498,13 @@ input_sync(dev); return; - } - - /* + } + + /* * Other event kinds are from the directional control pad, and have an * acceleration factor applied to them. Without this acceleration, the * control pad is mostly unusable. - * + * * If elapsed time since last event is > 1/4 second, user "stopped", * so reset acceleration. Otherwise, user is probably holding the control * pad down, so we increase acceleration, ramping up over two seconds to @@ -559,7 +546,7 @@ input_report_rel(dev, REL_Y, acc); break; default: - dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n", + dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n", ati_remote_tbl[index].kind); } input_sync(dev); @@ -586,12 +573,12 @@ case -ESHUTDOWN: dev_dbg(&ati_remote->interface->dev, "%s: urb error status, unlink? \n", __FUNCTION__); - return; + return; default: /* error */ - dev_dbg(&ati_remote->interface->dev, "%s: Nonzero urb status %d\n", + dev_dbg(&ati_remote->interface->dev, "%s: Nonzero urb status %d\n", __FUNCTION__, urb->status); } - + retval = usb_submit_urb(urb, SLAB_ATOMIC); if (retval) dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb()=%d\n", @@ -603,8 +590,6 @@ */ static void ati_remote_delete(struct ati_remote *ati_remote) { - if (!ati_remote) return; - if (ati_remote->irq_urb) usb_kill_urb(ati_remote->irq_urb); @@ -614,16 +599,16 @@ input_unregister_device(&ati_remote->idev); if (ati_remote->inbuf) - usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, + usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, ati_remote->inbuf, ati_remote->inbuf_dma); - + if (ati_remote->outbuf) - usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, + usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, ati_remote->inbuf, ati_remote->outbuf_dma); - + if (ati_remote->irq_urb) usb_free_urb(ati_remote->irq_urb); - + if (ati_remote->out_urb) usb_free_urb(ati_remote->out_urb); @@ -636,21 +621,21 @@ int i; idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); - idev->keybit[LONG(BTN_MOUSE)] = ( BIT(BTN_LEFT) | BIT(BTN_RIGHT) | + idev->keybit[LONG(BTN_MOUSE)] = ( BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_SIDE) | BIT(BTN_EXTRA) ); idev->relbit[0] = BIT(REL_X) | BIT(REL_Y); for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) if (ati_remote_tbl[i].type == EV_KEY) set_bit(ati_remote_tbl[i].code, idev->keybit); - + idev->private = ati_remote; idev->open = ati_remote_open; idev->close = ati_remote_close; - + idev->name = ati_remote->name; idev->phys = ati_remote->phys; - - idev->id.bustype = BUS_USB; + + idev->id.bustype = BUS_USB; idev->id.vendor = le16_to_cpu(ati_remote->udev->descriptor.idVendor); idev->id.product = le16_to_cpu(ati_remote->udev->descriptor.idProduct); idev->id.version = le16_to_cpu(ati_remote->udev->descriptor.bcdDevice); @@ -660,27 +645,27 @@ { struct usb_device *udev = ati_remote->udev; int pipe, maxp; - + init_waitqueue_head(&ati_remote->wait); /* Set up irq_urb */ pipe = usb_rcvintpipe(udev, ati_remote->endpoint_in->bEndpointAddress); maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp; - - usb_fill_int_urb(ati_remote->irq_urb, udev, pipe, ati_remote->inbuf, - maxp, ati_remote_irq_in, ati_remote, + + usb_fill_int_urb(ati_remote->irq_urb, udev, pipe, ati_remote->inbuf, + maxp, ati_remote_irq_in, ati_remote, ati_remote->endpoint_in->bInterval); ati_remote->irq_urb->transfer_dma = ati_remote->inbuf_dma; ati_remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - + /* Set up out_urb */ pipe = usb_sndintpipe(udev, ati_remote->endpoint_out->bEndpointAddress); maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); maxp = (maxp > DATA_BUFSIZE) ? DATA_BUFSIZE : maxp; - usb_fill_int_urb(ati_remote->out_urb, udev, pipe, ati_remote->outbuf, - maxp, ati_remote_irq_out, ati_remote, + usb_fill_int_urb(ati_remote->out_urb, udev, pipe, ati_remote->outbuf, + maxp, ati_remote_irq_out, ati_remote, ati_remote->endpoint_out->bInterval); ati_remote->out_urb->transfer_dma = ati_remote->outbuf_dma; ati_remote->out_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; @@ -688,11 +673,11 @@ /* send initialization strings */ if ((ati_remote_sendpacket(ati_remote, 0x8004, init1)) || (ati_remote_sendpacket(ati_remote, 0x8007, init2))) { - dev_err(&ati_remote->interface->dev, + dev_err(&ati_remote->interface->dev, "Initializing ati_remote hardware failed.\n"); return 1; } - + return 0; } @@ -769,7 +754,7 @@ if (!strlen(ati_remote->name)) sprintf(ati_remote->name, DRIVER_DESC "(%04x,%04x)", - le16_to_cpu(ati_remote->udev->descriptor.idVendor), + le16_to_cpu(ati_remote->udev->descriptor.idVendor), le16_to_cpu(ati_remote->udev->descriptor.idProduct)); /* Device Hardware Initialization - fills in ati_remote->idev from udev. */ @@ -781,11 +766,11 @@ ati_remote_input_init(ati_remote); input_register_device(&ati_remote->idev); - dev_info(&ati_remote->interface->dev, "Input registered: %s on %s\n", + dev_info(&ati_remote->interface->dev, "Input registered: %s on %s\n", ati_remote->name, path); usb_set_intfdata(interface, ati_remote); - + error: if (retval) ati_remote_delete(ati_remote); @@ -800,18 +785,14 @@ { struct ati_remote *ati_remote; - down(&disconnect_sem); - ati_remote = usb_get_intfdata(interface); usb_set_intfdata(interface, NULL); if (!ati_remote) { warn("%s - null device?\n", __FUNCTION__); return; } - - ati_remote_delete(ati_remote); - up(&disconnect_sem); + ati_remote_delete(ati_remote); } /* @@ -820,7 +801,7 @@ static int __init ati_remote_init(void) { int result; - + result = usb_register(&ati_remote_driver); if (result) err("usb_register error #%d\n", result); @@ -838,8 +819,8 @@ usb_deregister(&ati_remote_driver); } -/* - * module specification +/* + * module specification */ module_init(ati_remote_init); diff -Nru a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c --- a/drivers/usb/input/hid-core.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/hid-core.c 2005-03-16 00:08:29 -08:00 @@ -232,7 +232,7 @@ report->size += parser->global.report_size * parser->global.report_count; if (!parser->local.usage_index) /* Ignore padding fields */ - return 0; + return 0; usages = max_t(int, parser->local.usage_index, parser->global.report_count); @@ -766,7 +766,7 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) { report += (offset >> 5) << 2; offset &= 31; - return (le64_to_cpu(get_unaligned((__le64*)report)) >> offset) & ((1 << n) - 1); + return (le64_to_cpu(get_unaligned((__le64*)report)) >> offset) & ((1ULL << n) - 1); } static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value) @@ -1234,6 +1234,13 @@ return 0; } +static int hid_set_idle(struct usb_device *dev, int ifnum, int report, int idle) +{ + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + HID_REQ_SET_IDLE, USB_TYPE_CLASS | USB_RECIP_INTERFACE, (idle << 8) | report, + ifnum, NULL, 0, USB_CTRL_SET_TIMEOUT); +} + static int hid_get_class_descriptor(struct usb_device *dev, int ifnum, unsigned char type, void *buf, int size) { @@ -1302,10 +1309,6 @@ if (err) warn("timeout initializing reports\n"); - - usb_control_msg(hid->dev, usb_sndctrlpipe(hid->dev, 0), - HID_REQ_SET_IDLE, USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0, - hid->ifnum, NULL, 0, USB_CTRL_SET_TIMEOUT); } #define USB_VENDOR_ID_WACOM 0x056a @@ -1573,6 +1576,8 @@ return NULL; } + hid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0); + if ((n = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber, HID_DT_REPORT, rdesc, rsize)) < 0) { dbg("reading report descriptor failed"); kfree(rdesc); @@ -1618,7 +1623,7 @@ /* Change the polling interval of mice. */ if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) interval = hid_mousepoll_interval; - + if (endpoint->bEndpointAddress & USB_DIR_IN) { if (hid->urbin) continue; diff -Nru a/drivers/usb/input/hid-debug.h b/drivers/usb/input/hid-debug.h --- a/drivers/usb/input/hid-debug.h 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/hid-debug.h 2005-03-16 00:08:29 -08:00 @@ -67,7 +67,7 @@ {0, 0x44, "Vbry"}, {0, 0x45, "Vbrz"}, {0, 0x46, "Vno"}, - {0, 0x80, "SystemControl"}, + {0, 0x80, "SystemControl"}, {0, 0x81, "SystemPowerDown"}, {0, 0x82, "SystemSleep"}, {0, 0x83, "SystemWakeUp"}, @@ -347,7 +347,7 @@ static void hid_dump_field(struct hid_field *field, int n) { int j; - + if (field->physical) { tab(n); printk("Physical("); @@ -408,7 +408,7 @@ printk("%s", units[sys][i]); if(nibble != 1) { /* This is a _signed_ nibble(!) */ - + int val = nibble & 0x7; if(nibble & 0x08) val = -((0x7 & ~val) +1); @@ -443,7 +443,7 @@ struct list_head *list; unsigned i,k; static char *table[] = {"INPUT", "OUTPUT", "FEATURE"}; - + for (i = 0; i < HID_REPORT_TYPES; i++) { report_enum = device->report_enum + i; list = report_enum->report_list.next; @@ -664,8 +664,8 @@ static char *relatives[REL_MAX + 1] = { [REL_X] = "X", [REL_Y] = "Y", [REL_Z] = "Z", [REL_HWHEEL] = "HWheel", - [REL_DIAL] = "Dial", [REL_WHEEL] = "Wheel", - [REL_MISC] = "Misc", + [REL_DIAL] = "Dial", [REL_WHEEL] = "Wheel", + [REL_MISC] = "Misc", }; static char *absolutes[ABS_MAX + 1] = { @@ -690,9 +690,9 @@ }; static char *leds[LED_MAX + 1] = { - [LED_NUML] = "NumLock", [LED_CAPSL] = "CapsLock", + [LED_NUML] = "NumLock", [LED_CAPSL] = "CapsLock", [LED_SCROLLL] = "ScrollLock", [LED_COMPOSE] = "Compose", - [LED_KANA] = "Kana", [LED_SLEEP] = "Sleep", + [LED_KANA] = "Kana", [LED_SLEEP] = "Sleep", [LED_SUSPEND] = "Suspend", [LED_MUTE] = "Mute", [LED_MISC] = "Misc", }; diff -Nru a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c --- a/drivers/usb/input/hid-input.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/hid-input.c 2005-03-16 00:08:29 -08:00 @@ -164,7 +164,7 @@ case HID_GD_X: case HID_GD_Y: case HID_GD_Z: case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: - if (field->flags & HID_MAIN_ITEM_RELATIVE) + if (field->flags & HID_MAIN_ITEM_RELATIVE) map_rel(usage->hid & 0xf); else map_abs(usage->hid & 0xf); @@ -297,7 +297,7 @@ case HID_UP_MSVENDOR: goto ignore; - + case HID_UP_PID: set_bit(EV_FF, input->evbit); @@ -349,7 +349,7 @@ goto ignore; if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) && - (usage->type == EV_REL) && (usage->code == REL_WHEEL)) + (usage->type == EV_REL) && (usage->code == REL_WHEEL)) set_bit(REL_HWHEEL, bit); if (((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_5) && (usage->hid == 0x00090005)) @@ -365,11 +365,11 @@ a = field->logical_minimum = 0; b = field->logical_maximum = 255; } - + if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK) input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4); else input_set_abs_params(input, usage->code, a, b, 0, 0); - + } if (usage->hat_min < usage->hat_max || usage->hat_dir) { @@ -420,7 +420,7 @@ return; } - if (usage->hat_min < usage->hat_max || usage->hat_dir) { + if (usage->hat_min < usage->hat_max || usage->hat_dir) { int hat_dir = usage->hat_dir; if (!hat_dir) hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1; @@ -551,7 +551,7 @@ for (i = 0; i < hid->maxcollection; i++) if (hid->collection[i].type == HID_COLLECTION_APPLICATION || hid->collection[i].type == HID_COLLECTION_PHYSICAL) - if (IS_INPUT_APPLICATION(hid->collection[i].usage)) + if (IS_INPUT_APPLICATION(hid->collection[i].usage)) break; if (i == hid->maxcollection) @@ -592,7 +592,7 @@ for (j = 0; j < report->field[i]->maxusage; j++) hidinput_configure_usage(hidinput, report->field[i], report->field[i]->usage + j); - + if (hid->quirks & HID_QUIRK_MULTI_INPUT) { /* This will leave hidinput NULL, so that it * allocates another one if we have more inputs on diff -Nru a/drivers/usb/input/hid-lgff.c b/drivers/usb/input/hid-lgff.c --- a/drivers/usb/input/hid-lgff.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/hid-lgff.c 2005-03-16 00:08:29 -08:00 @@ -94,7 +94,7 @@ isn't really necessary */ unsigned long flags[1]; /* Contains various information about the - state of the driver for this device */ + state of the driver for this device */ struct timer_list timer; }; @@ -234,7 +234,7 @@ kfree(ret); return NULL; } - memset(ret->field[0]->value, 0, sizeof(s32[8])); + memset(ret->field[0]->value, 0, sizeof(s32[8])); return ret; } @@ -295,11 +295,11 @@ unsigned long flags; if (type != EV_FF) return -EINVAL; - if (!LGFF_CHECK_OWNERSHIP(code, lgff)) return -EACCES; + if (!LGFF_CHECK_OWNERSHIP(code, lgff)) return -EACCES; if (value < 0) return -EINVAL; spin_lock_irqsave(&lgff->lock, flags); - + if (value > 0) { if (test_bit(EFFECT_STARTED, effect->flags)) { spin_unlock_irqrestore(&lgff->lock, flags); @@ -345,7 +345,7 @@ and perform ioctls on the same fd all at the same time */ if ( current->pid == lgff->effects[i].owner && test_bit(EFFECT_USED, lgff->effects[i].flags)) { - + if (hid_lgff_erase(dev, i)) warn("erase effect %d failed", i); } @@ -378,7 +378,7 @@ struct lgff_effect new; int id; unsigned long flags; - + dbg("ioctl rumble"); if (!test_bit(effect->type, input->ffbit)) return -EINVAL; @@ -441,7 +441,7 @@ spin_lock_irqsave(&lgff->lock, flags); - for (i=0; ieffects +i; if (test_bit(EFFECT_PLAYING, effect->flags)) { @@ -491,7 +491,7 @@ set_bit(EFFECT_PLAYING, lgff->effects[i].flags); } } - } + } #define CLAMP(x) if (x < 0) x = 0; if (x > 0xff) x = 0xff @@ -524,5 +524,5 @@ add_timer(&lgff->timer); } - spin_unlock_irqrestore(&lgff->lock, flags); + spin_unlock_irqrestore(&lgff->lock, flags); } diff -Nru a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h --- a/drivers/usb/input/hid.h 2005-03-16 00:08:28 -08:00 +++ b/drivers/usb/input/hid.h 2005-03-16 00:08:28 -08:00 @@ -118,7 +118,7 @@ #define HID_MAIN_ITEM_CONSTANT 0x001 #define HID_MAIN_ITEM_VARIABLE 0x002 #define HID_MAIN_ITEM_RELATIVE 0x004 -#define HID_MAIN_ITEM_WRAP 0x008 +#define HID_MAIN_ITEM_WRAP 0x008 #define HID_MAIN_ITEM_NONLINEAR 0x010 #define HID_MAIN_ITEM_NO_PREFERRED 0x020 #define HID_MAIN_ITEM_NULL_STATE 0x040 @@ -172,14 +172,14 @@ #define HID_USAGE_PAGE 0xffff0000 #define HID_UP_UNDEFINED 0x00000000 -#define HID_UP_GENDESK 0x00010000 -#define HID_UP_KEYBOARD 0x00070000 -#define HID_UP_LED 0x00080000 -#define HID_UP_BUTTON 0x00090000 -#define HID_UP_ORDINAL 0x000a0000 +#define HID_UP_GENDESK 0x00010000 +#define HID_UP_KEYBOARD 0x00070000 +#define HID_UP_LED 0x00080000 +#define HID_UP_BUTTON 0x00090000 +#define HID_UP_ORDINAL 0x000a0000 #define HID_UP_CONSUMER 0x000c0000 -#define HID_UP_DIGITIZER 0x000d0000 -#define HID_UP_PID 0x000f0000 +#define HID_UP_DIGITIZER 0x000d0000 +#define HID_UP_PID 0x000f0000 #define HID_UP_HPVENDOR 0xff7f0000 #define HID_UP_MSVENDOR 0xff000000 @@ -406,7 +406,7 @@ dma_addr_t outbuf_dma; /* Output buffer dma */ spinlock_t outlock; /* Output fifo spinlock */ - unsigned claimed; /* Claimed by hidinput, hiddev? */ + unsigned claimed; /* Claimed by hidinput, hiddev? */ unsigned quirks; /* Various quirks the device can pull on us */ struct list_head inputs; /* The list of inputs */ diff -Nru a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c --- a/drivers/usb/input/hiddev.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/hiddev.c 2005-03-16 00:08:29 -08:00 @@ -95,7 +95,7 @@ return NULL; rinfo->report_id = ((struct hid_report *) list)->id; break; - + case HID_REPORT_ID_NEXT: list = (struct list_head *) report_enum->report_id_hash[rinfo->report_id & HID_REPORT_ID_MASK]; @@ -106,7 +106,7 @@ return NULL; rinfo->report_id = ((struct hid_report *) list)->id; break; - + default: return NULL; } @@ -158,7 +158,7 @@ if (uref->field_index != HID_FIELD_INDEX_NONE || (list->flags & HIDDEV_FLAG_REPORT) != 0) { list->buffer[list->head] = *uref; - list->head = (list->head + 1) & + list->head = (list->head + 1) & (HIDDEV_BUFFER_SIZE - 1); kill_fasync(&list->fasync, SIGIO, POLL_IN); } @@ -179,9 +179,9 @@ unsigned type = field->report_type; struct hiddev_usage_ref uref; - uref.report_type = + uref.report_type = (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : - ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : + ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); uref.report_id = field->report->id; uref.field_index = field->index; @@ -199,9 +199,9 @@ struct hiddev_usage_ref uref; memset(&uref, 0, sizeof(uref)); - uref.report_type = + uref.report_type = (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : - ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : + ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); uref.report_id = report->id; uref.field_index = HID_FIELD_INDEX_NONE; @@ -236,7 +236,7 @@ *listptr = (*listptr)->next; if (!--list->hiddev->open) { - if (list->hiddev->exist) + if (list->hiddev->exist) hid_close(list->hiddev->hid); else kfree(list->hiddev); @@ -303,7 +303,7 @@ if (list->head == list->tail) { add_wait_queue(&list->hiddev->wait, &wait); set_current_state(TASK_INTERRUPTIBLE); - + while (list->head == list->tail) { if (file->f_flags & O_NONBLOCK) { retval = -EAGAIN; @@ -317,7 +317,7 @@ retval = -EIO; break; } - + schedule(); } @@ -329,7 +329,7 @@ return retval; - while (list->head != list->tail && + while (list->head != list->tail && retval + event_size <= count) { if ((list->flags & HIDDEV_FLAG_UREF) == 0) { if (list->buffer[list->tail].field_index != @@ -405,10 +405,10 @@ return -EINVAL; for (i = 0; i < hid->maxcollection; i++) - if (hid->collection[i].type == + if (hid->collection[i].type == HID_COLLECTION_APPLICATION && arg-- == 0) break; - + if (i == hid->maxcollection) return -EINVAL; @@ -562,7 +562,7 @@ if (!uref_multi) return -ENOMEM; uref = &uref_multi->uref; - if (copy_from_user(uref, user_arg, sizeof(*uref))) + if (copy_from_user(uref, user_arg, sizeof(*uref))) goto fault; rinfo.report_type = uref->report_type; @@ -595,7 +595,7 @@ return -ENOMEM; uref = &uref_multi->uref; if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) { - if (copy_from_user(uref_multi, user_arg, + if (copy_from_user(uref_multi, user_arg, sizeof(*uref_multi))) goto fault; } else { @@ -603,7 +603,7 @@ goto fault; } - if (cmd != HIDIOCGUSAGE && + if (cmd != HIDIOCGUSAGE && cmd != HIDIOCGUSAGES && uref->report_type == HID_REPORT_TYPE_INPUT) goto inval; @@ -651,16 +651,16 @@ return field->usage[uref->usage_index].collection_index; case HIDIOCGUSAGES: for (i = 0; i < uref_multi->num_values; i++) - uref_multi->values[i] = + uref_multi->values[i] = field->value[uref->usage_index + i]; - if (copy_to_user(user_arg, uref_multi, + if (copy_to_user(user_arg, uref_multi, sizeof(*uref_multi))) goto fault; goto goodreturn; case HIDIOCSUSAGES: for (i = 0; i < uref_multi->num_values; i++) - field->value[uref->usage_index + i] = - uref_multi->values[i]; + field->value[uref->usage_index + i] = + uref_multi->values[i]; goto goodreturn; } @@ -670,7 +670,7 @@ fault: kfree(uref_multi); return -EFAULT; -inval: +inval: kfree(uref_multi); return -EINVAL; @@ -734,7 +734,7 @@ .name = "usb/hid/hiddev%d", .fops = &hiddev_fops, .mode = S_IFCHR | S_IRUGO | S_IWUSR, - .minor_base = HIDDEV_MINOR_BASE, + .minor_base = HIDDEV_MINOR_BASE, }; /* @@ -747,7 +747,7 @@ int retval; for (i = 0; i < hid->maxcollection; i++) - if (hid->collection[i].type == + if (hid->collection[i].type == HID_COLLECTION_APPLICATION && !IS_INPUT_APPLICATION(hid->collection[i].usage)) break; @@ -755,11 +755,11 @@ if (i == hid->maxcollection && (hid->quirks & HID_QUIRK_HIDDEV) == 0) return -1; - if (!(hiddev = kmalloc(sizeof(struct hiddev), GFP_KERNEL))) + if (!(hiddev = kmalloc(sizeof(struct hiddev), GFP_KERNEL))) return -1; memset(hiddev, 0, sizeof(struct hiddev)); - retval = usb_register_dev(hid->intf, &hiddev_class); + retval = usb_register_dev(hid->intf, &hiddev_class); if (retval) { err("Not able to get a minor for this device."); kfree(hiddev); @@ -768,12 +768,12 @@ init_waitqueue_head(&hiddev->wait); - hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; + hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; hiddev->hid = hid; hiddev->exist = 1; - hid->minor = hid->intf->minor; + hid->minor = hid->intf->minor; hid->hiddev = hiddev; return 0; @@ -818,7 +818,7 @@ /* We never attach in this manner, and rely on HID to connect us. This * is why there is no disconnect routine defined in the usb_driver either. */ -static int hiddev_usbd_probe(struct usb_interface *intf, +static int hiddev_usbd_probe(struct usb_interface *intf, const struct usb_device_id *hiddev_info) { return -ENODEV; diff -Nru a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/drivers/usb/input/itmtouch.c 2005-03-16 00:08:29 -08:00 @@ -0,0 +1,268 @@ +/****************************************************************************** + * itmtouch.c -- Driver for ITM touchscreen panel + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Based upon original work by Chris Collins . + * + * Kudos to ITM for providing me with the datasheet for the panel, + * even though it was a day later than I had finished writing this + * driver. + * + * It has meant that I've been able to correct my interpretation of the + * protocol packets however. + * + * CC -- 2003/9/29 + * + * History + * 1.0 & 1.1 2003 (CC) vojtech@suse.cz + * Original version for 2.4.x kernels + * + * 1.2 02/03/2005 (HCE) hc@mivu.no + * Complete rewrite to support Linux 2.6.10, thanks to mtouchusb.c for hints. + * Unfortunately no calibration support at this time. + * + * 1.2.1 09/03/2005 (HCE) hc@mivu.no + * Code cleanup and adjusting syntax to start matching kernel standards + * + *****************************************************************************/ + +#include + +#ifdef CONFIG_USB_DEBUG + #define DEBUG +#else + #undef DEBUG +#endif + +#include +#include +#include +#include +#include +#include + +/* only an 8 byte buffer necessary for a single packet */ +#define ITM_BUFSIZE 8 +#define PATH_SIZE 64 + +#define USB_VENDOR_ID_ITMINC 0x0403 +#define USB_PRODUCT_ID_TOUCHPANEL 0xf9e9 + +#define DRIVER_AUTHOR "Hans-Christian Egtvedt " +#define DRIVER_VERSION "v1.2.1" +#define DRIVER_DESC "USB ITM Inc Touch Panel Driver" +#define DRIVER_LICENSE "GPL" + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_LICENSE( DRIVER_LICENSE ); + +struct itmtouch_dev { + struct usb_device *usbdev; /* usb device */ + struct input_dev inputdev; /* input device */ + struct urb *readurb; /* urb */ + char rbuf[ITM_BUFSIZE]; /* data */ + int users; + char name[128]; + char phys[64]; +}; + +static struct usb_device_id itmtouch_ids [] = { + { USB_DEVICE(USB_VENDOR_ID_ITMINC, USB_PRODUCT_ID_TOUCHPANEL) }, + { } +}; + +static void itmtouch_irq(struct urb *urb, struct pt_regs *regs) +{ + struct itmtouch_dev * itmtouch = urb->context; + unsigned char *data = urb->transfer_buffer; + struct input_dev *dev = &itmtouch->inputdev; + int retval; + + switch (urb->status) { + case 0: + /* success */ + break; + case -ETIMEDOUT: + /* this urb is timing out */ + dbg("%s - urb timed out - was the device unplugged?", + __FUNCTION__); + return; + case -ECONNRESET: + case -ENOENT: + case -ESHUTDOWN: + /* this urb is terminated, clean up */ + dbg("%s - urb shutting down with status: %d", + __FUNCTION__, urb->status); + return; + default: + dbg("%s - nonzero urb status received: %d", + __FUNCTION__, urb->status); + goto exit; + } + + input_regs(dev, regs); + + /* if pressure has been released, then don't report X/Y */ + if (data[7] & 0x20) { + input_report_abs(dev, ABS_X, (data[0] & 0x1F) << 7 | (data[3] & 0x7F)); + input_report_abs(dev, ABS_Y, (data[1] & 0x1F) << 7 | (data[4] & 0x7F)); + } + + input_report_abs(dev, ABS_PRESSURE, (data[2] & 1) << 7 | (data[5] & 0x7F)); + input_report_key(dev, BTN_TOUCH, ~data[7] & 0x20); + input_sync(dev); + +exit: + retval = usb_submit_urb (urb, GFP_ATOMIC); + if (retval) + printk(KERN_ERR "%s - usb_submit_urb failed with result: %d", + __FUNCTION__, retval); +} + +static int itmtouch_open(struct input_dev *input) +{ + struct itmtouch_dev *itmtouch = input->private; + + itmtouch->readurb->dev = itmtouch->usbdev; + + if (usb_submit_urb(itmtouch->readurb, GFP_KERNEL)) + return -EIO; + + return 0; +} + +static void itmtouch_close(struct input_dev *input) +{ + struct itmtouch_dev *itmtouch = input->private; + + usb_kill_urb(itmtouch->readurb); +} + +static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id *id) +{ + struct itmtouch_dev *itmtouch; + struct usb_host_interface *interface; + struct usb_endpoint_descriptor *endpoint; + struct usb_device *udev = interface_to_usbdev(intf); + unsigned int pipe; + unsigned int maxp; + char path[PATH_SIZE]; + + interface = intf->cur_altsetting; + endpoint = &interface->endpoint[0].desc; + + if (!(itmtouch = kcalloc(1, sizeof(struct itmtouch_dev), GFP_KERNEL))) { + err("%s - Out of memory.", __FUNCTION__); + return -ENOMEM; + } + + itmtouch->usbdev = udev; + + itmtouch->inputdev.private = itmtouch; + itmtouch->inputdev.open = itmtouch_open; + itmtouch->inputdev.close = itmtouch_close; + + usb_make_path(udev, path, PATH_SIZE); + + itmtouch->inputdev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + itmtouch->inputdev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE); + itmtouch->inputdev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); + + itmtouch->inputdev.name = itmtouch->name; + itmtouch->inputdev.phys = itmtouch->phys; + itmtouch->inputdev.id.bustype = BUS_USB; + itmtouch->inputdev.id.vendor = udev->descriptor.idVendor; + itmtouch->inputdev.id.product = udev->descriptor.idProduct; + itmtouch->inputdev.id.version = udev->descriptor.bcdDevice; + itmtouch->inputdev.dev = &intf->dev; + + if (!strlen(itmtouch->name)) + sprintf(itmtouch->name, "USB ITM touchscreen"); + + /* device limits */ + /* as specified by the ITM datasheet, X and Y are 12bit, + * Z (pressure) is 8 bit. However, the fields are defined up + * to 14 bits for future possible expansion. + */ + input_set_abs_params(&itmtouch->inputdev, ABS_X, 0, 0x0FFF, 2, 0); + input_set_abs_params(&itmtouch->inputdev, ABS_Y, 0, 0x0FFF, 2, 0); + input_set_abs_params(&itmtouch->inputdev, ABS_PRESSURE, 0, 0xFF, 2, 0); + + /* initialise the URB so we can read from the transport stream */ + pipe = usb_rcvintpipe(itmtouch->usbdev, endpoint->bEndpointAddress); + maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); + + if (maxp > ITM_BUFSIZE) + maxp = ITM_BUFSIZE; + + itmtouch->readurb = usb_alloc_urb(0, GFP_KERNEL); + + if (!itmtouch->readurb) { + dbg("%s - usb_alloc_urb failed: itmtouch->readurb", __FUNCTION__); + kfree(itmtouch); + return -ENOMEM; + } + + usb_fill_int_urb(itmtouch->readurb, itmtouch->usbdev, pipe, itmtouch->rbuf, + maxp, itmtouch_irq, itmtouch, endpoint->bInterval); + + input_register_device(&itmtouch->inputdev); + + printk(KERN_INFO "itmtouch: %s registered on %s\n", itmtouch->name, path); + usb_set_intfdata(intf, itmtouch); + + return 0; +} + +static void itmtouch_disconnect(struct usb_interface *intf) +{ + struct itmtouch_dev *itmtouch = usb_get_intfdata(intf); + + usb_set_intfdata(intf, NULL); + + if (itmtouch) { + input_unregister_device(&itmtouch->inputdev); + usb_kill_urb(itmtouch->readurb); + usb_free_urb(itmtouch->readurb); + kfree(itmtouch); + } +} + +MODULE_DEVICE_TABLE(usb, itmtouch_ids); + +static struct usb_driver itmtouch_driver = { + .owner = THIS_MODULE, + .name = "itmtouch", + .probe = itmtouch_probe, + .disconnect = itmtouch_disconnect, + .id_table = itmtouch_ids, +}; + +static int __init itmtouch_init(void) +{ + info(DRIVER_DESC " " DRIVER_VERSION); + info(DRIVER_AUTHOR); + return usb_register(&itmtouch_driver); +} + +static void __exit itmtouch_exit(void) +{ + usb_deregister(&itmtouch_driver); +} + +module_init(itmtouch_init); +module_exit(itmtouch_exit); diff -Nru a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c --- a/drivers/usb/input/kbtab.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/kbtab.c 2005-03-16 00:08:29 -08:00 @@ -36,7 +36,6 @@ struct input_dev dev; struct usb_device *usbdev; struct urb *irq; - int open; int x, y; int button; int pressure; @@ -79,12 +78,12 @@ /*input_report_key(dev, BTN_TOUCH , data[0] & 0x01);*/ input_report_key(dev, BTN_RIGHT, data[0] & 0x02); - if( -1 == kb_pressure_click){ + if (-1 == kb_pressure_click) { input_report_abs(dev, ABS_PRESSURE, kbtab->pressure); } else { input_report_key(dev, BTN_LEFT, (kbtab->pressure > kb_pressure_click) ? 1 : 0); }; - + input_sync(dev); exit: @@ -105,14 +104,9 @@ { struct kbtab *kbtab = dev->private; - if (kbtab->open++) - return 0; - kbtab->irq->dev = kbtab->usbdev; - if (usb_submit_urb(kbtab->irq, GFP_KERNEL)) { - kbtab->open--; + if (usb_submit_urb(kbtab->irq, GFP_KERNEL)) return -EIO; - } return 0; } @@ -121,8 +115,7 @@ { struct kbtab *kbtab = dev->private; - if (!--kbtab->open) - usb_kill_urb(kbtab->irq); + usb_kill_urb(kbtab->irq); } static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *id) @@ -161,7 +154,7 @@ kbtab->dev.absmax[ABS_X] = 0x2000; kbtab->dev.absmax[ABS_Y] = 0x1750; kbtab->dev.absmax[ABS_PRESSURE] = 0xff; - + kbtab->dev.absfuzz[ABS_X] = 4; kbtab->dev.absfuzz[ABS_Y] = 4; diff -Nru a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c --- a/drivers/usb/input/mtouchusb.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/mtouchusb.c 2005-03-16 00:08:29 -08:00 @@ -42,9 +42,9 @@ #include #ifdef CONFIG_USB_DEBUG - #define DEBUG + #define DEBUG #else - #undef DEBUG + #undef DEBUG #endif #include @@ -93,275 +93,255 @@ MODULE_PARM_DESC(raw_coordinates, "report raw coordinate values (y, default) or hardware-calibrated coordinate values (n)"); struct mtouch_usb { - unsigned char *data; - dma_addr_t data_dma; - struct urb *irq; - struct usb_device *udev; - struct input_dev input; - int open; - char name[128]; - char phys[64]; + unsigned char *data; + dma_addr_t data_dma; + struct urb *irq; + struct usb_device *udev; + struct input_dev input; + char name[128]; + char phys[64]; }; -static struct usb_device_id mtouchusb_devices [] = { - { USB_DEVICE(0x0596, 0x0001) }, - { } +static struct usb_device_id mtouchusb_devices[] = { + { USB_DEVICE(0x0596, 0x0001) }, + { } }; static void mtouchusb_irq(struct urb *urb, struct pt_regs *regs) { - struct mtouch_usb *mtouch = urb->context; - int retval; + struct mtouch_usb *mtouch = urb->context; + int retval; - switch (urb->status) { - case 0: - /* success */ - break; - case -ETIMEDOUT: - /* this urb is timing out */ - dbg("%s - urb timed out - was the device unplugged?", - __FUNCTION__); - return; - case -ECONNRESET: - case -ENOENT: - case -ESHUTDOWN: - /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", - __FUNCTION__, urb->status); - return; - default: - dbg("%s - nonzero urb status received: %d", - __FUNCTION__, urb->status); - goto exit; - } - - input_regs(&mtouch->input, regs); - input_report_key(&mtouch->input, BTN_TOUCH, - MTOUCHUSB_GET_TOUCHED(mtouch->data)); - input_report_abs(&mtouch->input, ABS_X, - MTOUCHUSB_GET_XC(mtouch->data)); - input_report_abs(&mtouch->input, ABS_Y, + switch (urb->status) { + case 0: + /* success */ + break; + case -ETIMEDOUT: + /* this urb is timing out */ + dbg("%s - urb timed out - was the device unplugged?", + __FUNCTION__); + return; + case -ECONNRESET: + case -ENOENT: + case -ESHUTDOWN: + /* this urb is terminated, clean up */ + dbg("%s - urb shutting down with status: %d", + __FUNCTION__, urb->status); + return; + default: + dbg("%s - nonzero urb status received: %d", + __FUNCTION__, urb->status); + goto exit; + } + + input_regs(&mtouch->input, regs); + input_report_key(&mtouch->input, BTN_TOUCH, + MTOUCHUSB_GET_TOUCHED(mtouch->data)); + input_report_abs(&mtouch->input, ABS_X, MTOUCHUSB_GET_XC(mtouch->data)); + input_report_abs(&mtouch->input, ABS_Y, (raw_coordinates ? MTOUCHUSB_MAX_RAW_YC : MTOUCHUSB_MAX_CALIB_YC) - - MTOUCHUSB_GET_YC(mtouch->data)); - input_sync(&mtouch->input); + - MTOUCHUSB_GET_YC(mtouch->data)); + input_sync(&mtouch->input); exit: - retval = usb_submit_urb (urb, GFP_ATOMIC); - if (retval) - err ("%s - usb_submit_urb failed with result: %d", - __FUNCTION__, retval); + retval = usb_submit_urb(urb, GFP_ATOMIC); + if (retval) + err("%s - usb_submit_urb failed with result: %d", + __FUNCTION__, retval); } -static int mtouchusb_open (struct input_dev *input) +static int mtouchusb_open(struct input_dev *input) { - struct mtouch_usb *mtouch = input->private; + struct mtouch_usb *mtouch = input->private; - if (mtouch->open++) - return 0; + mtouch->irq->dev = mtouch->udev; - mtouch->irq->dev = mtouch->udev; + if (usb_submit_urb(mtouch->irq, GFP_ATOMIC)) + return -EIO; - if (usb_submit_urb (mtouch->irq, GFP_ATOMIC)) { - mtouch->open--; - return -EIO; - } - - return 0; + return 0; } -static void mtouchusb_close (struct input_dev *input) +static void mtouchusb_close(struct input_dev *input) { - struct mtouch_usb *mtouch = input->private; + struct mtouch_usb *mtouch = input->private; - if (!--mtouch->open) - usb_kill_urb (mtouch->irq); + usb_kill_urb(mtouch->irq); } static int mtouchusb_alloc_buffers(struct usb_device *udev, struct mtouch_usb *mtouch) { - dbg("%s - called", __FUNCTION__); + dbg("%s - called", __FUNCTION__); - mtouch->data = usb_buffer_alloc(udev, MTOUCHUSB_REPORT_DATA_SIZE, - SLAB_ATOMIC, &mtouch->data_dma); + mtouch->data = usb_buffer_alloc(udev, MTOUCHUSB_REPORT_DATA_SIZE, + SLAB_ATOMIC, &mtouch->data_dma); - if (!mtouch->data) - return -1; + if (!mtouch->data) + return -1; - return 0; + return 0; } static void mtouchusb_free_buffers(struct usb_device *udev, struct mtouch_usb *mtouch) { - dbg("%s - called", __FUNCTION__); + dbg("%s - called", __FUNCTION__); - if (mtouch->data) - usb_buffer_free(udev, MTOUCHUSB_REPORT_DATA_SIZE, - mtouch->data, mtouch->data_dma); + if (mtouch->data) + usb_buffer_free(udev, MTOUCHUSB_REPORT_DATA_SIZE, + mtouch->data, mtouch->data_dma); } static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_id *id) { - struct mtouch_usb *mtouch; - struct usb_host_interface *interface; - struct usb_endpoint_descriptor *endpoint; - struct usb_device *udev = interface_to_usbdev (intf); - char path[64]; - int nRet; - - dbg("%s - called", __FUNCTION__); - - dbg("%s - setting interface", __FUNCTION__); - interface = intf->cur_altsetting; - - dbg("%s - setting endpoint", __FUNCTION__); - endpoint = &interface->endpoint[0].desc; - - if (!(mtouch = kmalloc (sizeof (struct mtouch_usb), GFP_KERNEL))) { - err("%s - Out of memory.", __FUNCTION__); - return -ENOMEM; - } - - memset(mtouch, 0, sizeof(struct mtouch_usb)); - mtouch->udev = udev; - - dbg("%s - allocating buffers", __FUNCTION__); - if (mtouchusb_alloc_buffers(udev, mtouch)) { - mtouchusb_free_buffers(udev, mtouch); - kfree(mtouch); - return -ENOMEM; - } - - mtouch->input.private = mtouch; - mtouch->input.open = mtouchusb_open; - mtouch->input.close = mtouchusb_close; - - usb_make_path(udev, path, 64); - sprintf(mtouch->phys, "%s/input0", path); - - mtouch->input.name = mtouch->name; - mtouch->input.phys = mtouch->phys; - mtouch->input.id.bustype = BUS_USB; - mtouch->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor); - mtouch->input.id.product = le16_to_cpu(udev->descriptor.idProduct); - mtouch->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice); - mtouch->input.dev = &intf->dev; - - mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - mtouch->input.absbit[0] = BIT(ABS_X) | BIT(ABS_Y); - mtouch->input.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); - - /* Used to Scale Compensated Data and Flip Y */ - mtouch->input.absmin[ABS_X] = MTOUCHUSB_MIN_XC; - mtouch->input.absmax[ABS_X] = raw_coordinates ? \ - MTOUCHUSB_MAX_RAW_XC : MTOUCHUSB_MAX_CALIB_XC; - mtouch->input.absfuzz[ABS_X] = MTOUCHUSB_XC_FUZZ; - mtouch->input.absflat[ABS_X] = MTOUCHUSB_XC_FLAT; - mtouch->input.absmin[ABS_Y] = MTOUCHUSB_MIN_YC; - mtouch->input.absmax[ABS_Y] = raw_coordinates ? \ - MTOUCHUSB_MAX_RAW_YC : MTOUCHUSB_MAX_CALIB_YC; - mtouch->input.absfuzz[ABS_Y] = MTOUCHUSB_YC_FUZZ; - mtouch->input.absflat[ABS_Y] = MTOUCHUSB_YC_FLAT; + struct mtouch_usb *mtouch; + struct usb_host_interface *interface; + struct usb_endpoint_descriptor *endpoint; + struct usb_device *udev = interface_to_usbdev(intf); + char path[64]; + int nRet; + + dbg("%s - called", __FUNCTION__); + + dbg("%s - setting interface", __FUNCTION__); + interface = intf->cur_altsetting; + + dbg("%s - setting endpoint", __FUNCTION__); + endpoint = &interface->endpoint[0].desc; + + if (!(mtouch = kmalloc(sizeof(struct mtouch_usb), GFP_KERNEL))) { + err("%s - Out of memory.", __FUNCTION__); + return -ENOMEM; + } + + memset(mtouch, 0, sizeof(struct mtouch_usb)); + mtouch->udev = udev; + + dbg("%s - allocating buffers", __FUNCTION__); + if (mtouchusb_alloc_buffers(udev, mtouch)) { + mtouchusb_free_buffers(udev, mtouch); + kfree(mtouch); + return -ENOMEM; + } + + mtouch->input.private = mtouch; + mtouch->input.open = mtouchusb_open; + mtouch->input.close = mtouchusb_close; + + usb_make_path(udev, path, 64); + sprintf(mtouch->phys, "%s/input0", path); + + mtouch->input.name = mtouch->name; + mtouch->input.phys = mtouch->phys; + mtouch->input.id.bustype = BUS_USB; + mtouch->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor); + mtouch->input.id.product = le16_to_cpu(udev->descriptor.idProduct); + mtouch->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice); + mtouch->input.dev = &intf->dev; + + mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); + mtouch->input.absbit[0] = BIT(ABS_X) | BIT(ABS_Y); + mtouch->input.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); + + /* Used to Scale Compensated Data and Flip Y */ + mtouch->input.absmin[ABS_X] = MTOUCHUSB_MIN_XC; + mtouch->input.absmax[ABS_X] = raw_coordinates ? + MTOUCHUSB_MAX_RAW_XC : MTOUCHUSB_MAX_CALIB_XC; + mtouch->input.absfuzz[ABS_X] = MTOUCHUSB_XC_FUZZ; + mtouch->input.absflat[ABS_X] = MTOUCHUSB_XC_FLAT; + mtouch->input.absmin[ABS_Y] = MTOUCHUSB_MIN_YC; + mtouch->input.absmax[ABS_Y] = raw_coordinates ? + MTOUCHUSB_MAX_RAW_YC : MTOUCHUSB_MAX_CALIB_YC; + mtouch->input.absfuzz[ABS_Y] = MTOUCHUSB_YC_FUZZ; + mtouch->input.absflat[ABS_Y] = MTOUCHUSB_YC_FLAT; if (udev->manufacturer) strcat(mtouch->name, udev->manufacturer); if (udev->product) sprintf(mtouch->name, "%s %s", mtouch->name, udev->product); - if (!strlen(mtouch->name)) - sprintf(mtouch->name, "USB Touchscreen %04x:%04x", - mtouch->input.id.vendor, mtouch->input.id.product); - - nRet = usb_control_msg(mtouch->udev, - usb_rcvctrlpipe(udev, 0), - MTOUCHUSB_RESET, - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 1, - 0, - NULL, - 0, - USB_CTRL_SET_TIMEOUT); - dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d", - __FUNCTION__, nRet); - - dbg("%s - usb_alloc_urb: mtouch->irq", __FUNCTION__); - mtouch->irq = usb_alloc_urb(0, GFP_KERNEL); - if (!mtouch->irq) { - dbg("%s - usb_alloc_urb failed: mtouch->irq", __FUNCTION__); - mtouchusb_free_buffers(udev, mtouch); - kfree(mtouch); - return -ENOMEM; - } - - dbg("%s - usb_fill_int_urb", __FUNCTION__); - usb_fill_int_urb(mtouch->irq, - mtouch->udev, - usb_rcvintpipe(mtouch->udev, 0x81), - mtouch->data, - MTOUCHUSB_REPORT_DATA_SIZE, - mtouchusb_irq, - mtouch, - endpoint->bInterval); - - dbg("%s - input_register_device", __FUNCTION__); - input_register_device(&mtouch->input); - - nRet = usb_control_msg(mtouch->udev, - usb_rcvctrlpipe(udev, 0), - MTOUCHUSB_ASYNC_REPORT, - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 1, - 1, - NULL, - 0, - USB_CTRL_SET_TIMEOUT); - dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d", - __FUNCTION__, nRet); + if (!strlen(mtouch->name)) + sprintf(mtouch->name, "USB Touchscreen %04x:%04x", + mtouch->input.id.vendor, mtouch->input.id.product); + + nRet = usb_control_msg(mtouch->udev, usb_rcvctrlpipe(udev, 0), + MTOUCHUSB_RESET, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); + dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d", + __FUNCTION__, nRet); + + dbg("%s - usb_alloc_urb: mtouch->irq", __FUNCTION__); + mtouch->irq = usb_alloc_urb(0, GFP_KERNEL); + if (!mtouch->irq) { + dbg("%s - usb_alloc_urb failed: mtouch->irq", __FUNCTION__); + mtouchusb_free_buffers(udev, mtouch); + kfree(mtouch); + return -ENOMEM; + } + + dbg("%s - usb_fill_int_urb", __FUNCTION__); + usb_fill_int_urb(mtouch->irq, mtouch->udev, + usb_rcvintpipe(mtouch->udev, 0x81), + mtouch->data, MTOUCHUSB_REPORT_DATA_SIZE, + mtouchusb_irq, mtouch, endpoint->bInterval); + + dbg("%s - input_register_device", __FUNCTION__); + input_register_device(&mtouch->input); + + nRet = usb_control_msg(mtouch->udev, usb_rcvctrlpipe(udev, 0), + MTOUCHUSB_ASYNC_REPORT, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); + dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d", + __FUNCTION__, nRet); - printk(KERN_INFO "input: %s on %s\n", mtouch->name, path); - usb_set_intfdata(intf, mtouch); + printk(KERN_INFO "input: %s on %s\n", mtouch->name, path); + usb_set_intfdata(intf, mtouch); - return 0; + return 0; } static void mtouchusb_disconnect(struct usb_interface *intf) { - struct mtouch_usb *mtouch = usb_get_intfdata (intf); + struct mtouch_usb *mtouch = usb_get_intfdata(intf); - dbg("%s - called", __FUNCTION__); - usb_set_intfdata(intf, NULL); - if (mtouch) { - dbg("%s - mtouch is initialized, cleaning up", __FUNCTION__); - usb_kill_urb(mtouch->irq); - input_unregister_device(&mtouch->input); - usb_free_urb(mtouch->irq); - mtouchusb_free_buffers(interface_to_usbdev(intf), mtouch); - kfree(mtouch); - } + dbg("%s - called", __FUNCTION__); + usb_set_intfdata(intf, NULL); + if (mtouch) { + dbg("%s - mtouch is initialized, cleaning up", __FUNCTION__); + usb_kill_urb(mtouch->irq); + input_unregister_device(&mtouch->input); + usb_free_urb(mtouch->irq); + mtouchusb_free_buffers(interface_to_usbdev(intf), mtouch); + kfree(mtouch); + } } -MODULE_DEVICE_TABLE (usb, mtouchusb_devices); +MODULE_DEVICE_TABLE(usb, mtouchusb_devices); static struct usb_driver mtouchusb_driver = { - .owner = THIS_MODULE, - .name = "mtouchusb", - .probe = mtouchusb_probe, - .disconnect = mtouchusb_disconnect, - .id_table = mtouchusb_devices, + .owner = THIS_MODULE, + .name = "mtouchusb", + .probe = mtouchusb_probe, + .disconnect = mtouchusb_disconnect, + .id_table = mtouchusb_devices, }; -static int __init mtouchusb_init(void) { - dbg("%s - called", __FUNCTION__); - return usb_register(&mtouchusb_driver); +static int __init mtouchusb_init(void) +{ + dbg("%s - called", __FUNCTION__); + return usb_register(&mtouchusb_driver); } -static void __exit mtouchusb_cleanup(void) { - dbg("%s - called", __FUNCTION__); - usb_deregister(&mtouchusb_driver); +static void __exit mtouchusb_cleanup(void) +{ + dbg("%s - called", __FUNCTION__); + usb_deregister(&mtouchusb_driver); } module_init(mtouchusb_init); module_exit(mtouchusb_cleanup); -MODULE_AUTHOR( DRIVER_AUTHOR ); -MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); diff -Nru a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c --- a/drivers/usb/input/powermate.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/powermate.c 2005-03-16 00:08:29 -08:00 @@ -10,7 +10,7 @@ * back to the host when polled by the USB controller. * * Testing with the knob I have has shown that it measures approximately 94 "clicks" - * for one full rotation. Testing with my High Speed Rotation Actuator (ok, it was + * for one full rotation. Testing with my High Speed Rotation Actuator (ok, it was * a variable speed cordless electric drill) has shown that the device can measure * speeds of up to 7 clicks either clockwise or anticlockwise between pollings from * the host. If it counts more than 7 clicks before it is polled, it will wrap back @@ -120,9 +120,9 @@ /* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */ static void powermate_sync_state(struct powermate_device *pm) { - if (pm->requires_update == 0) + if (pm->requires_update == 0) return; /* no updates are required */ - if (pm->config->status == -EINPROGRESS) + if (pm->config->status == -EINPROGRESS) return; /* an update is already in progress; it'll issue this update when it completes */ if (pm->requires_update & UPDATE_PULSE_ASLEEP){ @@ -142,7 +142,7 @@ 2: multiply the speed the argument only has an effect for operations 0 and 2, and ranges between 1 (least effect) to 255 (maximum effect). - + thus, several states are equivalent and are coalesced into one state. we map this onto a range from 0 to 510, with: @@ -151,7 +151,7 @@ 256 -- 510 -- use multiple (510 = fastest). Only values of 'arg' quite close to 255 are particularly useful/spectacular. - */ + */ if (pm->pulse_speed < 255){ op = 0; // divide arg = 255 - pm->pulse_speed; @@ -199,14 +199,14 @@ if (urb->status) printk(KERN_ERR "powermate: config urb returned %d\n", urb->status); - + spin_lock_irqsave(&pm->lock, flags); powermate_sync_state(pm); spin_unlock_irqrestore(&pm->lock, flags); } /* Set the LED up as described and begin the sync with the hardware if required */ -static void powermate_pulse_led(struct powermate_device *pm, int static_brightness, int pulse_speed, +static void powermate_pulse_led(struct powermate_device *pm, int static_brightness, int pulse_speed, int pulse_table, int pulse_asleep, int pulse_awake) { unsigned long flags; @@ -229,7 +229,7 @@ /* mark state updates which are required */ if (static_brightness != pm->static_brightness){ pm->static_brightness = static_brightness; - pm->requires_update |= UPDATE_STATIC_BRIGHTNESS; + pm->requires_update |= UPDATE_STATIC_BRIGHTNESS; } if (pulse_asleep != pm->pulse_asleep){ pm->pulse_asleep = pulse_asleep; @@ -246,7 +246,7 @@ } powermate_sync_state(pm); - + spin_unlock_irqrestore(&pm->lock, flags); } @@ -257,19 +257,19 @@ struct powermate_device *pm = dev->private; if (type == EV_MSC && code == MSC_PULSELED){ - /* + /* bits 0- 7: 8 bits: LED brightness bits 8-16: 9 bits: pulsing speed modifier (0 ... 510); 0-254 = slower, 255 = standard, 256-510 = faster. bits 17-18: 2 bits: pulse table (0, 1, 2 valid) bit 19: 1 bit : pulse whilst asleep? bit 20: 1 bit : pulse constantly? - */ + */ int static_brightness = command & 0xFF; // bits 0-7 int pulse_speed = (command >> 8) & 0x1FF; // bits 8-16 int pulse_table = (command >> 17) & 0x3; // bits 17-18 int pulse_asleep = (command >> 19) & 0x1; // bit 19 int pulse_awake = (command >> 20) & 0x1; // bit 20 - + powermate_pulse_led(pm, static_brightness, pulse_speed, pulse_table, pulse_asleep, pulse_awake); } @@ -378,7 +378,7 @@ switch (le16_to_cpu(udev->descriptor.idProduct)) { case POWERMATE_PRODUCT_NEW: pm->input.name = pm_name_powermate; break; case POWERMATE_PRODUCT_OLD: pm->input.name = pm_name_soundknob; break; - default: + default: pm->input.name = pm_name_soundknob; printk(KERN_WARNING "powermate: unknown product id %04x\n", le16_to_cpu(udev->descriptor.idProduct)); @@ -402,11 +402,11 @@ usb_make_path(udev, path, 64); snprintf(pm->phys, 64, "%s/input0", path); printk(KERN_INFO "input: %s on %s\n", pm->input.name, pm->input.phys); - + /* force an update of everything */ pm->requires_update = UPDATE_PULSE_ASLEEP | UPDATE_PULSE_AWAKE | UPDATE_PULSE_MODE | UPDATE_STATIC_BRIGHTNESS; powermate_pulse_led(pm, 0x80, 255, 0, 1, 0); // set default pulse parameters - + usb_set_intfdata(intf, pm); return 0; } diff -Nru a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c --- a/drivers/usb/input/touchkitusb.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/touchkitusb.c 2005-03-16 00:08:29 -08:00 @@ -69,7 +69,6 @@ struct urb *irq; struct usb_device *udev; struct input_dev input; - int open; char name[128]; char phys[64]; }; @@ -134,15 +133,10 @@ { struct touchkit_usb *touchkit = input->private; - if (touchkit->open++) - return 0; - touchkit->irq->dev = touchkit->udev; - if (usb_submit_urb(touchkit->irq, GFP_ATOMIC)) { - touchkit->open--; + if (usb_submit_urb(touchkit->irq, GFP_ATOMIC)) return -EIO; - } return 0; } @@ -151,8 +145,7 @@ { struct touchkit_usb *touchkit = input->private; - if (!--touchkit->open) - usb_kill_urb(touchkit->irq); + usb_kill_urb(touchkit->irq); } static int touchkit_alloc_buffers(struct usb_device *udev, diff -Nru a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c --- a/drivers/usb/input/usbkbd.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/usbkbd.c 2005-03-16 00:08:29 -08:00 @@ -9,18 +9,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -72,7 +72,6 @@ unsigned char newleds; char name[128]; char phys[64]; - int open; unsigned char *new; struct usb_ctrlrequest *cr; @@ -165,7 +164,7 @@ if (urb->status) warn("led urb status %d received", urb->status); - + if (*(kbd->leds) == kbd->newleds) return; @@ -179,14 +178,9 @@ { struct usb_kbd *kbd = dev->private; - if (kbd->open++) - return 0; - kbd->irq->dev = kbd->usbdev; - if (usb_submit_urb(kbd->irq, GFP_KERNEL)) { - kbd->open--; + if (usb_submit_urb(kbd->irq, GFP_KERNEL)) return -EIO; - } return 0; } @@ -195,8 +189,7 @@ { struct usb_kbd *kbd = dev->private; - if (!--kbd->open) - usb_kill_urb(kbd->irq); + usb_kill_urb(kbd->irq); } static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd) @@ -229,7 +222,7 @@ usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma); } -static int usb_kbd_probe(struct usb_interface *iface, +static int usb_kbd_probe(struct usb_interface *iface, const struct usb_device_id *id) { struct usb_device * dev = interface_to_usbdev(iface); @@ -271,7 +264,7 @@ for (i = 0; i < 255; i++) set_bit(usb_kbd_keycode[i], kbd->dev.keybit); clear_bit(0, kbd->dev.keybit); - + kbd->dev.private = kbd; kbd->dev.event = usb_kbd_event; kbd->dev.open = usb_kbd_open; @@ -293,7 +286,7 @@ sprintf(kbd->phys, "%s/input0", path); kbd->dev.name = kbd->name; - kbd->dev.phys = kbd->phys; + kbd->dev.phys = kbd->phys; kbd->dev.id.bustype = BUS_USB; kbd->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); kbd->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); @@ -328,7 +321,7 @@ static void usb_kbd_disconnect(struct usb_interface *intf) { struct usb_kbd *kbd = usb_get_intfdata (intf); - + usb_set_intfdata(intf, NULL); if (kbd) { usb_kill_urb(kbd->irq); diff -Nru a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c --- a/drivers/usb/input/usbmouse.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/usbmouse.c 2005-03-16 00:08:29 -08:00 @@ -9,18 +9,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic @@ -51,7 +51,6 @@ struct usb_device *usbdev; struct input_dev dev; struct urb *irq; - int open; signed char *data; dma_addr_t data_dma; @@ -101,14 +100,9 @@ { struct usb_mouse *mouse = dev->private; - if (mouse->open++) - return 0; - mouse->irq->dev = mouse->usbdev; - if (usb_submit_urb(mouse->irq, GFP_KERNEL)) { - mouse->open--; + if (usb_submit_urb(mouse->irq, GFP_KERNEL)) return -EIO; - } return 0; } @@ -117,8 +111,7 @@ { struct usb_mouse *mouse = dev->private; - if (!--mouse->open) - usb_kill_urb(mouse->irq); + usb_kill_urb(mouse->irq); } static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_id * id) @@ -132,19 +125,19 @@ interface = intf->cur_altsetting; - if (interface->desc.bNumEndpoints != 1) + if (interface->desc.bNumEndpoints != 1) return -ENODEV; endpoint = &interface->endpoint[0].desc; - if (!(endpoint->bEndpointAddress & 0x80)) + if (!(endpoint->bEndpointAddress & 0x80)) return -ENODEV; - if ((endpoint->bmAttributes & 3) != 3) + if ((endpoint->bmAttributes & 3) != 3) return -ENODEV; pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe)); - if (!(mouse = kmalloc(sizeof(struct usb_mouse), GFP_KERNEL))) + if (!(mouse = kmalloc(sizeof(struct usb_mouse), GFP_KERNEL))) return -ENOMEM; memset(mouse, 0, sizeof(struct usb_mouse)); @@ -209,7 +202,7 @@ static void usb_mouse_disconnect(struct usb_interface *intf) { struct usb_mouse *mouse = usb_get_intfdata (intf); - + usb_set_intfdata(intf, NULL); if (mouse) { usb_kill_urb(mouse->irq); @@ -238,7 +231,7 @@ static int __init usb_mouse_init(void) { int retval = usb_register(&usb_mouse_driver); - if (retval == 0) + if (retval == 0) info(DRIVER_VERSION ":" DRIVER_DESC); return retval; } diff -Nru a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c --- a/drivers/usb/input/wacom.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/wacom.c 2005-03-16 00:08:29 -08:00 @@ -18,7 +18,7 @@ * v0.4 (sm) - Support for more Intuos models, menustrip * relative mode, proximity. * v0.5 (vp) - Big cleanup, nifty features removed, - * they belong in userspace + * they belong in userspace * v1.8 (vp) - Submit URB only when operating, moved to CVS, * use input_report_key instead of report_btn and * other cleanups @@ -102,7 +102,6 @@ struct urb *irq; struct wacom_features *features; int tool[2]; - int open; __u32 serial[2]; char phys[32]; }; @@ -149,7 +148,7 @@ prox = data[1] & 0x40; input_regs(dev, regs); - + if (prox) { pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); @@ -545,7 +544,7 @@ /* process general packets */ wacom_intuos_general(urb); - + if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) { /* 4D mouse or Lens cursor packets */ if (data[1] & 0x02) { /* Rotation packet */ @@ -555,7 +554,7 @@ } else { - if ((data[1] & 0x10) == 0) { /* 4D mouse packets */ + if ((data[1] & 0x10) == 0) { /* 4D mouse packets */ input_report_key(dev, BTN_LEFT, data[8] & 0x01); input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); @@ -567,11 +566,11 @@ input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); } else { - if (wacom->tool[idx] == BTN_TOOL_MOUSE) { /* 2D mouse packets */ + if (wacom->tool[idx] == BTN_TOOL_MOUSE) { /* 2D mouse packets */ input_report_key(dev, BTN_LEFT, data[8] & 0x04); input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); input_report_key(dev, BTN_RIGHT, data[8] & 0x10); - input_report_rel(dev, REL_WHEEL, + input_report_rel(dev, REL_WHEEL, (-(__u32)(data[8] & 0x01) + (__u32)((data[8] & 0x02) >> 1))); } else { /* Lens cursor packets */ @@ -584,7 +583,7 @@ } } } - + input_report_key(dev, wacom->tool[idx], 1); input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); input_sync(dev); @@ -705,20 +704,20 @@ { "Wacom Penpartner", 7, 5040, 3780, 255, 32, 0, wacom_penpartner_irq }, { "Wacom Graphire", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq }, { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq }, - { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, 1, wacom_graphire_irq }, + { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, 1, wacom_graphire_irq }, { "Wacom Graphire3", 8, 10208, 7424, 511, 32, 1, wacom_graphire_irq }, { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, 1, wacom_graphire_irq }, - { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq }, - { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, - { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq }, - { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, 2, wacom_intuos_irq }, - { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, 2, wacom_intuos_irq }, - { "Wacom PL400", 8, 5408, 4056, 255, 32, 3, wacom_pl_irq }, - { "Wacom PL500", 8, 6144, 4608, 255, 32, 3, wacom_pl_irq }, - { "Wacom PL600", 8, 6126, 4604, 255, 32, 3, wacom_pl_irq }, - { "Wacom PL600SX", 8, 6260, 5016, 255, 32, 3, wacom_pl_irq }, - { "Wacom PL550", 8, 6144, 4608, 511, 32, 3, wacom_pl_irq }, - { "Wacom PL800", 8, 7220, 5780, 511, 32, 3, wacom_pl_irq }, + { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq }, + { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, + { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq }, + { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, 2, wacom_intuos_irq }, + { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, 2, wacom_intuos_irq }, + { "Wacom PL400", 8, 5408, 4056, 255, 32, 3, wacom_pl_irq }, + { "Wacom PL500", 8, 6144, 4608, 255, 32, 3, wacom_pl_irq }, + { "Wacom PL600", 8, 6126, 4604, 255, 32, 3, wacom_pl_irq }, + { "Wacom PL600SX", 8, 6260, 5016, 255, 32, 3, wacom_pl_irq }, + { "Wacom PL550", 8, 6144, 4608, 511, 32, 3, wacom_pl_irq }, + { "Wacom PL800", 8, 7220, 5780, 511, 32, 3, wacom_pl_irq }, { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq }, { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq }, @@ -730,7 +729,7 @@ { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, 4, wacom_intuos3_irq }, { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, 4, wacom_intuos3_irq }, { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, - { } + { } }; static struct usb_device_id wacom_ids[] = { @@ -771,14 +770,9 @@ { struct wacom *wacom = dev->private; - if (wacom->open++) - return 0; - wacom->irq->dev = wacom->usbdev; - if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { - wacom->open--; + if (usb_submit_urb(wacom->irq, GFP_KERNEL)) return -EIO; - } return 0; } @@ -787,8 +781,7 @@ { struct wacom *wacom = dev->private; - if (!--wacom->open) - usb_kill_urb(wacom->irq); + usb_kill_urb(wacom->irq); } static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) @@ -828,7 +821,7 @@ wacom->dev.relbit[0] |= BIT(REL_WHEEL); wacom->dev.absbit[0] |= BIT(ABS_DISTANCE); wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); - wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2); + wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2); break; case 4: /* new functions for Intuos3 */ @@ -842,13 +835,13 @@ wacom->dev.mscbit[0] |= BIT(MSC_SERIAL); wacom->dev.relbit[0] |= BIT(REL_WHEEL); wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE) | BIT(BTN_SIDE) | BIT(BTN_EXTRA); - wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOOL_BRUSH) + wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOOL_BRUSH) | BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS) | BIT(BTN_STYLUS2); wacom->dev.absbit[0] |= BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) | BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE); break; case 3: - wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2) | BIT(BTN_TOOL_RUBBER); + wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2) | BIT(BTN_TOOL_RUBBER); break; } diff -Nru a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c --- a/drivers/usb/input/xpad.c 2005-03-16 00:08:29 -08:00 +++ b/drivers/usb/input/xpad.c 2005-03-16 00:08:29 -08:00 @@ -104,13 +104,12 @@ struct usb_xpad { struct input_dev dev; /* input device interface */ struct usb_device *udev; /* usb device */ - + struct urb *irq_in; /* urb for interrupt in report */ unsigned char *idata; /* input data */ dma_addr_t idata_dma; - + char phys[65]; /* physical device path */ - int open_count; /* reference count */ }; /* @@ -128,35 +127,35 @@ struct input_dev *dev = &xpad->dev; input_regs(dev, regs); - + /* left stick */ input_report_abs(dev, ABS_X, (__s16) (((__s16)data[13] << 8) | data[12])); input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[15] << 8) | data[14])); - + /* right stick */ input_report_abs(dev, ABS_RX, (__s16) (((__s16)data[17] << 8) | data[16])); input_report_abs(dev, ABS_RY, (__s16) (((__s16)data[19] << 8) | data[18])); - + /* triggers left/right */ input_report_abs(dev, ABS_Z, data[10]); input_report_abs(dev, ABS_RZ, data[11]); - + /* digital pad */ input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04)); input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01)); - + /* start/back buttons and stick press left/right */ input_report_key(dev, BTN_START, (data[2] & 0x10) >> 4); input_report_key(dev, BTN_BACK, (data[2] & 0x20) >> 5); input_report_key(dev, BTN_THUMBL, (data[2] & 0x40) >> 6); input_report_key(dev, BTN_THUMBR, data[2] >> 7); - + /* "analog" buttons A, B, X, Y */ input_report_key(dev, BTN_A, data[4]); input_report_key(dev, BTN_B, data[5]); input_report_key(dev, BTN_X, data[6]); input_report_key(dev, BTN_Y, data[7]); - + /* "analog" buttons black, white */ input_report_key(dev, BTN_C, data[8]); input_report_key(dev, BTN_Z, data[9]); @@ -168,7 +167,7 @@ { struct usb_xpad *xpad = urb->context; int retval; - + switch (urb->status) { case 0: /* success */ @@ -183,7 +182,7 @@ dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); goto exit; } - + xpad_process_packet(xpad, 0, xpad->idata, regs); exit: @@ -196,25 +195,19 @@ static int xpad_open (struct input_dev *dev) { struct usb_xpad *xpad = dev->private; - - if (xpad->open_count++) - return 0; - + xpad->irq_in->dev = xpad->udev; - if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) { - xpad->open_count--; + if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) return -EIO; - } - + return 0; } static void xpad_close (struct input_dev *dev) { struct usb_xpad *xpad = dev->private; - - if (!--xpad->open_count) - usb_kill_urb(xpad->irq_in); + + usb_kill_urb(xpad->irq_in); } static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id) @@ -224,19 +217,19 @@ struct usb_endpoint_descriptor *ep_irq_in; char path[64]; int i; - + for (i = 0; xpad_device[i].idVendor; i++) { if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct)) break; } - + if ((xpad = kmalloc (sizeof(struct usb_xpad), GFP_KERNEL)) == NULL) { err("cannot allocate memory for new pad"); return -ENOMEM; } memset(xpad, 0, sizeof(struct usb_xpad)); - + xpad->idata = usb_buffer_alloc(udev, XPAD_PKT_LEN, SLAB_ATOMIC, &xpad->idata_dma); if (!xpad->idata) { @@ -251,18 +244,18 @@ kfree(xpad); return -ENOMEM; } - + ep_irq_in = &intf->cur_altsetting->endpoint[0].desc; - + usb_fill_int_urb(xpad->irq_in, udev, usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), xpad->idata, XPAD_PKT_LEN, xpad_irq_in, xpad, ep_irq_in->bInterval); xpad->irq_in->transfer_dma = xpad->idata_dma; xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - + xpad->udev = udev; - + xpad->dev.id.bustype = BUS_USB; xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor); xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct); @@ -273,21 +266,21 @@ xpad->dev.phys = xpad->phys; xpad->dev.open = xpad_open; xpad->dev.close = xpad_close; - + usb_make_path(udev, path, 64); snprintf(xpad->phys, 64, "%s/input0", path); - + xpad->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - + for (i = 0; xpad_btn[i] >= 0; i++) set_bit(xpad_btn[i], xpad->dev.keybit); - + for (i = 0; xpad_abs[i] >= 0; i++) { - + signed short t = xpad_abs[i]; - + set_bit(t, xpad->dev.absbit); - + switch (t) { case ABS_X: case ABS_Y: @@ -310,11 +303,11 @@ break; } } - + input_register_device(&xpad->dev); - + printk(KERN_INFO "input: %s on %s", xpad->dev.name, path); - + usb_set_intfdata(intf, xpad); return 0; } @@ -322,7 +315,7 @@ static void xpad_disconnect(struct usb_interface *intf) { struct usb_xpad *xpad = usb_get_intfdata (intf); - + usb_set_intfdata(intf, NULL); if (xpad) { usb_kill_urb(xpad->irq_in); diff -Nru a/include/linux/gameport.h b/include/linux/gameport.h --- a/include/linux/gameport.h 2005-03-16 00:08:29 -08:00 +++ b/include/linux/gameport.h 2005-03-16 00:08:29 -08:00 @@ -67,6 +67,8 @@ void gameport_close(struct gameport *gameport); void gameport_rescan(struct gameport *gameport); +#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) + void __gameport_register_port(struct gameport *gameport, struct module *owner); static inline void gameport_register_port(struct gameport *gameport) { @@ -75,6 +77,29 @@ void gameport_unregister_port(struct gameport *gameport); +void gameport_set_phys(struct gameport *gameport, const char *fmt, ...) + __attribute__ ((format (printf, 2, 3))); + +#else + +static inline void gameport_register_port(struct gameport *gameport) +{ + return; +} + +static inline void gameport_unregister_port(struct gameport *gameport) +{ + return; +} + +static inline void gameport_set_phys(struct gameport *gameport, + const char *fmt, ...) +{ + return; +} + +#endif + static inline struct gameport *gameport_allocate_port(void) { struct gameport *gameport = kcalloc(1, sizeof(struct gameport), GFP_KERNEL); @@ -91,9 +116,6 @@ { strlcpy(gameport->name, name, sizeof(gameport->name)); } - -void gameport_set_phys(struct gameport *gameport, const char *fmt, ...) - __attribute__ ((format (printf, 2, 3))); /* * Use the following fucntions to manipulate gameport's per-port diff -Nru a/include/linux/input.h b/include/linux/input.h --- a/include/linux/input.h 2005-03-16 00:08:29 -08:00 +++ b/include/linux/input.h 2005-03-16 00:08:29 -08:00 @@ -854,6 +854,10 @@ int (*erase_effect)(struct input_dev *dev, int effect_id); struct input_handle *grab; + + struct semaphore sem; /* serializes open and close operations */ + unsigned int users; + struct device *dev; struct list_head h_list; diff -Nru a/include/linux/joystick.h b/include/linux/joystick.h --- a/include/linux/joystick.h 2005-03-16 00:08:29 -08:00 +++ b/include/linux/joystick.h 2005-03-16 00:08:29 -08:00 @@ -111,18 +111,35 @@ #define JS_SET_ALL 8 struct JS_DATA_TYPE { - int buttons; - int x; - int y; + __s32 buttons; + __s32 x; + __s32 y; }; -struct JS_DATA_SAVE_TYPE { - int JS_TIMEOUT; - int BUSY; - long JS_EXPIRETIME; - long JS_TIMELIMIT; +struct JS_DATA_SAVE_TYPE_32 { + __s32 JS_TIMEOUT; + __s32 BUSY; + __s32 JS_EXPIRETIME; + __s32 JS_TIMELIMIT; struct JS_DATA_TYPE JS_SAVE; struct JS_DATA_TYPE JS_CORR; }; + +struct JS_DATA_SAVE_TYPE_64 { + __s32 JS_TIMEOUT; + __s32 BUSY; + __s64 JS_EXPIRETIME; + __s64 JS_TIMELIMIT; + struct JS_DATA_TYPE JS_SAVE; + struct JS_DATA_TYPE JS_CORR; +}; + +#if BITS_PER_LONG == 64 +#define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_64 +#elif BITS_PER_LONG == 32 +#define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_32 +#else +#error Unexpected BITS_PER_LONG +#endif #endif /* _LINUX_JOYSTICK_H */ diff -Nru a/sound/oss/Kconfig b/sound/oss/Kconfig --- a/sound/oss/Kconfig 2005-03-16 00:08:29 -08:00 +++ b/sound/oss/Kconfig 2005-03-16 00:08:29 -08:00 @@ -112,7 +112,7 @@ config SOUND_ES1370 tristate "Ensoniq AudioPCI (ES1370)" - depends on SOUND_PRIME!=n && SOUND && PCI && SOUND_GAMEPORT + depends on SOUND_PRIME!=n && SOUND && PCI help Say Y or M if you have a PCI sound card utilizing the Ensoniq ES1370 chipset, such as Ensoniq's AudioPCI (non-97). To find @@ -125,7 +125,7 @@ config SOUND_ES1371 tristate "Creative Ensoniq AudioPCI 97 (ES1371)" - depends on SOUND_PRIME!=n && SOUND && PCI && SOUND_GAMEPORT + depends on SOUND_PRIME!=n && SOUND && PCI help Say Y or M if you have a PCI sound card utilizing the Ensoniq ES1371 chipset, such as Ensoniq's AudioPCI97. To find out if @@ -138,7 +138,7 @@ config SOUND_ESSSOLO1 tristate "ESS Technology Solo1" - depends on SOUND_PRIME!=n && SOUND && SOUND_GAMEPORT && PCI + depends on SOUND_PRIME!=n && SOUND && PCI help Say Y or M if you have a PCI sound card utilizing the ESS Technology Solo1 chip. To find out if your sound card uses a @@ -179,7 +179,7 @@ config SOUND_SONICVIBES tristate "S3 SonicVibes" - depends on SOUND_PRIME!=n && SOUND && SOUND_GAMEPORT + depends on SOUND_PRIME!=n && SOUND help Say Y or M if you have a PCI sound card utilizing the S3 SonicVibes chipset. To find out if your sound card uses a @@ -226,7 +226,7 @@ config SOUND_TRIDENT tristate "Trident 4DWave DX/NX, SiS 7018 or ALi 5451 PCI Audio Core" - depends on SOUND_PRIME!=n && SOUND && SOUND_GAMEPORT + depends on SOUND_PRIME!=n && SOUND ---help--- Say Y or M if you have a PCI sound card utilizing the Trident 4DWave-DX/NX chipset or your mother board chipset has SiS 7018 @@ -739,7 +739,7 @@ config SOUND_MAD16 tristate "OPTi MAD16 and/or Mozart based cards" - depends on SOUND_OSS && SOUND_GAMEPORT + depends on SOUND_OSS ---help--- Answer Y if your card has a Mozart (OAK OTI-601) or MAD16 (OPTi 82C928 or 82C929 or 82C931) audio interface chip. These chips are diff -Nru a/sound/pci/cs4281.c b/sound/pci/cs4281.c --- a/sound/pci/cs4281.c 2005-03-16 00:08:29 -08:00 +++ b/sound/pci/cs4281.c 2005-03-16 00:08:29 -08:00 @@ -1332,8 +1332,8 @@ } } #else -static inline int snd_cs4281_gameport(cs4281_t *chip) { return -ENOSYS; } -static inline void snd_cs4281_gameport_free(cs4281_t *chip) { } +static inline int snd_cs4281_create_gameport(cs4281_t *chip) { return -ENOSYS; } +static inline void snd_cs4281_free_gameport(cs4281_t *chip) { } #endif /* CONFIG_GAMEPORT || (MODULE && CONFIG_GAMEPORT_MODULE) */