summaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid
Commit message (Collapse)AuthorAgeFilesLines
* Merge branches 'upstream', 'raw_report_modifications' and ↵Jiri Kosina2010-02-251-2/+3
|\ | | | | | | | | | | | | 'apple_magic_mouse' into for-linus Conflicts: drivers/hid/Kconfig
| * HID: make raw reports possible for both feature and output reportsJiri Kosina2010-02-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 2da31939a42 ("Bluetooth: Implement raw output support for HIDP layer"), support for Bluetooth hid_output_raw_report was added, but it pushes the data to the intr socket instead of the ctrl one. This has been fixed by 6bf8268f9a91f1 ("Bluetooth: Use the control channel for raw HID reports") Still, it is necessary to distinguish whether the report in question should be either FEATURE or OUTPUT. For this, we have to extend the generic HID API, so that hid_output_raw_report() callback provides means to specify this value so that it can be passed down to lower level hardware drivers (currently Bluetooth and USB). Based on original patch by Bastien Nocera <hadess@hadess.net> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | HID: usbhid: initialize interface pointers early enoughJiri Kosina2010-02-171-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Move the initialization of USB interface pointers from _start() over to _probe() callback, which is where it belongs. This fixes case where interface is NULL when parsing of report descriptor fails. LKML-Reference: <20100213135720.603e5f64@neptune.home> Reported-by: Alan Stern <stern@rowland.harvard.edu> Tested-by: Bruno Prémont <bonbons@linux-vserver.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | HID: usbhid: introduce timeout for stuck ctrl/out URBsOliver Neukum2010-02-122-2/+28
| | | | | | | | | | | | | | | | | | | | | | Some devices do not react to a control request (seen on APC UPS's) resulting in a slow stream of messages, "generic-usb ... control queue full". Therefore request needs a timeout. Cc: stable@kernel.org Signed-off-by: Oliver Neukum <oliver@neukum.org> Signed-off-by: David Fries <david@fries.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | HID: use multi input quirk for TouchPack touchscreenThadeu Lima de Souza Cascardo2010-02-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | This device generates ABS_Z and ABS_RX events, while it should be generating ABS_X and ABS_Y instead. Using the MULTI_INPUT quirk solves this issue. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Signed-off-by: Daniel Oliveira Nascimento <don@syst.com.br> [jkosina@suse.cz: fixed blacklist ordering while resolving conflict] [jkosina@suse.cz: fixed typo to make it compile] Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | Merge branch 'master' into upstreamJiri Kosina2010-02-021-4/+4
|\ \ | |/ | | | | | | Conflicts: drivers/hid/hid-ids.h
| * USB: remove the auto_pm flagAlan Stern2009-12-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | This patch (as1302) removes the auto_pm flag from struct usb_device. The flag's only purpose was to distinguish between autosuspends and external suspends, but that information is now available in the pm_message_t argument passed to suspend methods. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | HID: use multi input quirk for eTurboTouch touchscreenThadeu Lima de Souza Cascardo2010-02-021-0/+1
| | | | | | | | | | | | | | | | | | | | This device generates ABS_Z and ABS_RX events, while it should be generating ABS_X and ABS_Y instead. Using the MULTI_INPUT quirk solves this issue. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Signed-off-by: Daniel Oliveira Nascimento <don@syst.com.br> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | HID: add NOGET quirk for Prodige Cordless ComboAlexander Shishkin2010-02-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | I happen to own a keyboard identified as 05af:3062 which is labeled as "FlatX Coldless Combo" by "Prodige", which exhibits input problems without NOGET quirk. For some reason, lsusb reports this device as "Jing-Mold Enterprise Co., Ltd", which is not mentioned anywhere on the package. A quick search on the intenet shows that there a other people who have this in their lsusb output, but apparently they don't have the problem I am seeing (or they are not such furious typists as myself). Signed-off-by: Alexander Shishkin <virtuoso@slind.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | HID: update copyrightJiri Kosina2010-02-021-1/+1
| | | | | | | | Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | HID: make USB device id constantMárton Németh2010-01-121-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The id_table field of the struct usb_device_id is constant in <linux/usb.h> so it is worth to make the initialization data also constant. The semantic match that finds this kind of pattern is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ disable decl_init,const_decl_init; identifier I1, I2, x; @@ struct I1 { ... const struct I2 *x; ... }; @s@ identifier r.I1, y; identifier r.x, E; @@ struct I1 y = { .x = E, }; @c@ identifier r.I2; identifier s.E; @@ const struct I2 E[] = ... ; @depends on !c@ identifier r.I2; identifier s.E; @@ + const struct I2 E[] = ...; // </smpl> Signed-off-by: Márton Németh <nm127@freemail.hu> Cc: Julia Lawall <julia@diku.dk> Cc: cocci@diku.dk Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* Merge branch 'for-linus' of ↵Linus Torvalds2009-12-091-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (51 commits) Input: appletouch - give up maintainership Input: dm355evm_kbd - switch to using sparse keymap library Input: wistron_btns - switch to using sparse keymap library Input: add generic support for sparse keymaps Input: fix memory leak in force feedback core Input: wistron - remove identification strings from DMI table Input: psmouse - remove identification strings from DMI tables Input: atkbd - remove identification strings from DMI table Input: i8042 - remove identification strings from DMI tables DMI: allow omitting ident strings in DMI tables Input: psmouse - do not carry DMI data around Input: matrix-keypad - switch to using dev_pm_ops Input: keyboard - fix lack of locking when traversing handler->h_list Input: gpio_keys - scan gpio state at probe and resume time Input: keyboard - add locking around event handling Input: usbtouchscreen - add support for ET&T TC5UH touchscreen controller Input: xpad - add two new Xbox 360 devices Input: polled device - do not start polling if interval is zero Input: polled device - schedule first poll immediately Input: add S3C24XX touchscreen driver ...
| * Input: do not overwrite the first part of phys stringMárton Németh2009-11-231-1/+1
| | | | | | | | | | | | | | | | Use strlcat() to append a string to the previously created first part. Signed-off-by: Márton Németh <nm127@freemail.hu> Acked-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
| |
| \
| \
| \
*---. \ Merge branches 'bkl-removal', 'upstream' and 'upstream-fixes' into for-linusJiri Kosina2009-12-074-15/+11
|\ \ \ \ | |_|_|/ |/| | |
| | | * HID: add multi-input quirk for NextWindow Touchscreen.Peter Hutterer2009-12-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These touchscreens are mounted onto HP TouchSmart and the Dell Studio One 19. Without a quirk they report a wrong button set and the x/y coordinates through ABS_Z/ABS_RX, confusing the higher levels (most notably X.Org's evdev driver). Device id 0x003 covers models 1900, 2150, and 2700 [1] though testing could only be performed on a model 1900. [1] http://www.nextwindow.com/nextwindow_support/latest_tech_info.html Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| | | * HID: pidff - fix unnecessary loop iterations on resetAnssi Hannula2009-11-041-3/+2
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When encountering a strange value in the pool report, pidff_reset will always refetch the report 20 times, even if one of the retries results in a sane value. This is because a temporary variable being used to store the value is not being updated inside the loop. Fix it by using the value directly in the loop. Reported-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| | * HID: fixup quirk for NCR devicesJiri Kosina2009-11-052-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NCR devices are terminally broken by design -- they claim themselves to contain proper input applications in their HID report descriptor, but behave very badly if treated in standard way. According to NCR developers, the devices get confused when queried for reports in a standard way, rendering them unusable. NCR is shipping application called "RPSL" that can be used to drive these devices through hiddev, under the assumption that in-kernel driver doesn't perform initial report query. If it does, neither in-kernel nor hiddev-based driver can operate with these devices any more. Introduce a quirk that skips the report query for all NCR devices. The previous NOGET quirk was wrong and had been introduced because I misunderstood the nature of brokenness of these devices. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| | * HID: add NOGET quirk for another device from CH ProductsKeith Rutkowski2009-10-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch was applied to Fedora 11's 2.6.30.8-64 kernel and adds the NOGET quirk for CH Products industrial class joystick(s). It is like the previous CH Products NOGET quirk patch for their consumer class joysticks. Without the quirk, the joystick would only be detected and would not function at all in kernels >= 2.6.29. It was tested with a CH Products 3-axis 5-button industrial joystick, product #HG-434IS000-U-217. Signed-off-by: Keith Rutkowski <rutkowski@signatureresearchinc.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| | * HID: remove useless DRIVER_VERSION macroJiri Kosina2009-10-131-3/+1
| | | | | | | | | | | | | | | | | | | | | DRIVER_VERSION has no use whatosoever, it has been set to "2.6" for ages. Remove it. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| | * HID: fix MODULE_AUTHOR usage in HID modulesJiri Kosina2009-10-131-2/+3
| |/ |/| | | | | | | | | | | Remove unused (in usbhid module) DRIVER_AUTHOR macrco and properly use multiple MODULE_AUTHOR() instances in both modules. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: remove BKL from hiddev_ioctl_usage()Jiri Kosina2009-11-051-5/+0
|/ | | | | | | | | | | The race between ioctl and disconnect is guarded by low level hiddev device mutex (existancelock) since the commit 07903407 ("HID: hiddev cleanup -- handle all error conditions properly"), therefore we can remove the lock_kernel() from hiddev_ioctl_usage(). Acked-by: Oliver Neukum <oliver@neukum.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* Merge branch 'for-linus' of ↵Linus Torvalds2009-09-221-11/+5
|\ | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: Remove duplicate Kconfig entry HID: consolidate connect and disconnect into core code HID: fix non-atomic allocation in hid_input_report
| * HID: consolidate connect and disconnect into core codeJiri Kosina2009-09-171-11/+5
| | | | | | | | | | | | | | | | | | | | | | HID core registers input, hidraw and hiddev devices, but leaves unregistering it up to the individual driver, which is not really nice. Let's move all the logic to the core. Reported-by: Marcel Holtmann <marcel@holtmann.org> Reported-by: Brian Rogers <brian@xyzw.org> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | Driver-Core: extend devnode callbacks to provide permissionsKay Sievers2009-09-191-2/+2
|/ | | | | | | | | | | | | This allows subsytems to provide devtmpfs with non-default permissions for the device node. Instead of the default mode of 0600, null, zero, random, urandom, full, tty, ptmx now have a mode of 0666, which allows non-privileged processes to access standard device nodes in case no other userspace process applies the expected permissions. This also fixes a wrong assignment in pktcdvd and a checkpatch.pl complain. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
*-. Merge branches 'upstream', 'upstream-fixes' and 'debugfs' into for-linusJiri Kosina2009-09-132-8/+2
|\ \
| | * HID: use debugfs for report dumping descriptorJiri Kosina2009-06-121-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is a little bit inconvenient for people who have some non-standard HID hardware (usually violating the HID specification) to have to recompile kernel with CONFIG_HID_DEBUG to be able to see kernel's perspective of the HID report descriptor and observe the parsed events. Plus the messages are then mixed up inconveniently with the rest of the dmesg stuff. This patch implements /sys/kernel/debug/hid/<device>/rdesc file, which represents the kernel's view of report descriptor (both the raw report descriptor data and parsed contents). With all the device-specific debug data being available through debugfs, there is no need for keeping CONFIG_HID_DEBUG, as the 'debug' parameter to the hid module will now only output only driver-specific debugging options, which has absolutely minimal memory footprint, just a few error messages and one global flag (hid_debug). We use the current set of output formatting functions. The ones that need to be used both for one-shot rdesc seq_file and also for continuous flow of data (individual reports, as being sent by the device) distinguish according to the passed seq_file parameter, and if it is NULL, it still output to kernel ringbuffer, otherwise the corresponding seq_file is used for output. The format of the output is preserved. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * | HID: fix overrun in quirks initializationRoel Kluin2009-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check whether index is within bounds before testing the element. declared in drivers/hid/usbhid/hid-core.c:62: static char *quirks_param[MAX_USBHID_BOOT_QUIRKS] = ... Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Cc: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | | HID: support larger reports than 64 bytes in hiddevJiri Kosina2009-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hiddev userspace driver uses a rignbuffer to store the parsed usages that should be returned through read(). This buffer is 64 bytes long, which is sufficient for queueing single USB 1.0 low-speed report, which is of maximum size 48 bytes. There are however USB HID devices which are full-speed USB devices, and therefore they are free to produce reports 64 bytes long. This is correctly handled by HID core, but read() on hiddev node gets stuck forever, because the ring buffer loops infinitely (as it is exactly 64 bytes long as well), never advancing the buffer pointer. Plus, the core driver is ready to handle highspeed devices, so we should be able to handle reports from such devices in the hiddev driver as well, which means we need larger ringbuffer. Reported-by: Michael Zeisel <michael.zeisel@philips.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | | HID: local function should be staticH Hartley Sweeten2009-08-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | __usbhid_submit_report() is a local function wrapped by the exported symbol usbhid_submit_report(). As such, it should be static. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | | HID: Avoid double spin_lock_init on usbhid->lockSergey Senozhatsky2009-07-231-1/+0
|/ / | | | | | | | | | | | | Avoid double spin_lock_init on usbhid->lock. Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@mail.by> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | Merge branch 'for-linus' of ↵Linus Torvalds2009-07-221-1/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: Move dereferences below a NULL test HID: hiddev, fix lock imbalance
| * | HID: hiddev, fix lock imbalanceJiri Slaby2009-06-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Add omitted BKL to one switch/case. Cc: Stable <stable@kernel.org> Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | | headers: smp_lock.h reduxAlexey Dobriyan2009-07-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove smp_lock.h from files which don't need it (including some headers!) * Add smp_lock.h to files which do need it * Make smp_lock.h include conditional in hardirq.h It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT This will make hardirq.h inclusion cheaper for every PREEMPT=n config (which includes allmodconfig/allyesconfig, BTW) Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* | | Driver Core: usb: add nodename support for usb drivers.Kay Sievers2009-06-151-1/+6
|/ / | | | | | | | | | | | | | | | | | | This adds support for USB drivers to report their requested nodename to userspace. It also updates a number of USB drivers to provide the needed subdirectory and device name to be used for them. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Jan Blunck <jblunck@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | HID: no more reinitializtion is needed in post_resetJiri Kosina2009-06-041-4/+3
|/ | | | | | | | | No more reinitialization is needed in the post reset hook, remove the FIXME comment. While at it, clean up whitespaces in the immediate surrounding. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: add NOGET quirk for devices from CH ProductsAlan Stern2009-05-111-0/+3
| | | | | | | | | | | | | | | This patch (as1240) adds the NOGET quirk for three devices from CH Products: the Pro pedals, the Combatstick joystick, and the Flight-Sim yoke. Without these quirks, the devices haven't worked for many kernel releases. Sometimes replugging them after boot-up would get them to work and sometimes they wouldn't work at all. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Reported-by: Sean Hildebrand <silverwraithii@gmail.com> Reported-by: Sid Boyce <sboyce@blueyonder.co.uk> Tested-by: Sean Hildebrand <silverwraithii@gmail.com> Tested-by: Sid Boyce <sboyce@blueyonder.co.uk> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: fix dropped device-specific quirksZoltan Karcagi2009-05-111-1/+1
| | | | | | | | | | | Device-specific quirks are set up correctly in their respective vendor-specific driver, then get overwritten in usbhid_parse(). This is only issue for device-specific NOGET quirks being set by driver for a few devices out there. Signed-off-by: Zoltan Karcagi <zkr@freemail.hu> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* HID: fix possible deadlock in usbhid_close()Oliver Neukum2009-04-291-1/+1
| | | | | | | | | | | This patch switches usbhid_close() from flush_scheduled_work() to canceling the outstanding work. This fixes a possible deadlock due to work taking the mutex usbhid_close() holds. Lockdep reported the problem. Signed-off-by: Oliver Neukum <oliver@neukum.org> -- Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* Merge branch 'autosuspend' into for-nextJiri Kosina2009-03-303-111/+392
|\ | | | | | | | | | | Conflicts: drivers/hid/hid-core.c
| * HID: autosuspend -- fix lockup of hid on resetOliver Neukum2009-03-251-1/+1
| | | | | | | | | | | | | | | | | | This fixes a use of flush_scheduled_work() in USB HID's reset logic that can deadlock. Tested-by: Valdis Kletniks <Valdis.Kletnieks@vt.edu> Signed-off-by: Oliver Neukum <oliver@neukum.name> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: hid_reset_resume() needs to be defined only when CONFIG_PM is setJiri Kosina2009-03-251-50/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | There is no point of having hid_reset_resume() when CONFIG_PM is not set, and even the corresponding .reset_resume pointer in hid_driver struct is properly ifdefed. Move the definition into the ifdef CONFIG_PM part of the source to avoid drivers/hid/usbhid/hid-core.c:1337: warning: 'hid_reset_resume' defined but not used Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: fix USB HID devices after STD with autosuspendOliver Neukum2009-03-251-1/+10
| | | | | | | | | | | | | | | | | | | | | | This patch fixes a bug caused by reset_resume not changing the internal status flags for a device that is resumed via reset_resume. To do so the reset handlers, which correctly assume that a device is awake, can no longer do all the work of reset_resume handling. Signed-off-by: Oliver Neukum <oneukum@suse.de> Tested-by: Laurent Riffard <laurent.riffard@free.fr> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: do not try to compile PM code with CONFIG_PM unsetJiri Kosina2009-03-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes this build breakage in case when CONFIG_PM is not set drivers/hid/usbhid/hid-core.c: In function 'hid_suspend': drivers/hid/usbhid/hid-core.c:1220: error: 'struct usb_device' has no member named 'auto_pm' drivers/hid/usbhid/hid-core.c:1245: error: 'struct usb_device' has no member named 'auto_pm' drivers/hid/usbhid/hid-core.c:1258: error: 'struct usb_device' has no member named 'auto_pm' by throwing both the hid_suspend() and hid_resume() away completely in such case, as they won't be used anyway. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * HID: autosuspend support for USB HIDOliver Neukum2009-03-253-100/+366
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This uses the USB busy mechanism for aggessive autosuspend of USB HID devices. It autosuspends all opened devices supporting remote wakeup after a timeout unless - output is being done to the device - a key is being held down (remote wakeup isn't triggered upon key release) - LED(s) are lit - hiddev is opened As in the current driver closed devices will be autosuspended even if they don't support remote wakeup. The patch is quite large because output to devices is done in hard interrupt context meaning a lot a queuing and locking had to be touched. The LED stuff has been solved by means of a simple counter. Additions to the generic HID code could be avoided. In addition it now covers hidraw. It contains an embryonic version of an API to let the generic HID code tell the lower levels which capabilities with respect to power management are needed. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | HID: fix race between usb_register_dev() and hiddev_open()Oliver Neukum2009-03-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | upon further thought this code is still racy. retval = usb_register_dev(usbhid->intf, &hiddev_class); here you open a window during which open can happen if (retval) { err_hid("Not able to get a minor for this device."); hid->hiddev = NULL; kfree(hiddev); return -1; } else { hid->minor = usbhid->intf->minor; hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; and will fail because hiddev_table hasn't been updated The obvious fix of using a mutex to guard hiddev_table doesn't work because usb_open() and usb_register_dev() take minor_rwsem and we'd have an AB-BA deadlock. We need a lock usb_open() also takes in the right order and that leaves only one option, BKL. I don't like it but I see no alternative. Once the usb_open() implements something better than lock_kernel(), we could also do so. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | HID: bring back possibility to specify vid/pid ignore on module loadJiri Kosina2009-03-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When hid quirks were converted to specialized driver, the HID_QUIRK_IGNORE has been moved completely, as the hid_ignore_list[] has been moved into the generic code. However userspace already got used to the possibility that modprobing usbhid with 'quirks=vid:pid:0x4' makes the device ignored by usbhid driver. So keep this quirk flag in place for backwards compatibility. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6Linus Torvalds2009-03-261-4/+1
|\ \ | |/ |/| | | | | | | | | | | * 'bkl-removal' of git://git.lwn.net/linux-2.6: Rationalize fasync return values Move FASYNC bit handling to f_op->fasync() Use f_lock to protect f_flags Rename struct file->f_ep_lock
| * Rationalize fasync return valuesJonathan Corbet2009-03-161-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most fasync implementations do something like: return fasync_helper(...); But fasync_helper() will return a positive value at times - a feature used in at least one place. Thus, a number of other drivers do: err = fasync_helper(...); if (err < 0) return err; return 0; In the interests of consistency and more concise code, it makes sense to map positive return values onto zero where ->fasync() is called. Cc: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
* | HID: fix waitqueue usage in hiddevJohannes Weiner2009-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DECLARE_WAITQUEUE doesn't initialize the wait descriptor's task_list to 'empty' but to zero. prepare_to_wait() will not enqueue the descriptor to the waitqueue and finish_wait() will do list_del_init() on a list head that contains NULL pointers, which oopses. This was introduced by 079034073 "HID: hiddev cleanup -- handle all error conditions properly". The prior code used an unconditional add_to_waitqueue() which didn't care about the wait descriptor's list head and enqueued the thing unconditionally. The new code uses prepare_to_wait() which DOES check the prior list state, so use DEFINE_WAIT instead. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Oliver Neukum <oliver@neukum.name> Cc: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | HID: fix incorrect free in hiddevJohannes Weiner2009-03-101-1/+1
|/ | | | | | | | | | | | | | | | If hiddev_open() fails, it wrongly frees the shared hiddev structure kept in hiddev_table instead of the hiddev_list structure allocated for the opened file descriptor. Existing references to this structure will then accessed free memory. This was introduced by 079034073 "HID: hiddev cleanup -- handle all error conditions properly". Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Oliver Neukum <oliver@neukum.name> Cc: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
OpenPOWER on IntegriCloud