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>
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>
Make defaults consistent with help text suggestions for HID_DEBUG.
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* '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
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>
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>
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>
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>
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>
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>
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>
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>
The devices handled by hid-tmff and hid-zpff were added in the
hid_ignore_list[] instead of hid_blacklist[] in hid-core.c, thus
disabling them completely.
hid_ignore_list[] causes hid layer to skip the device, while
hid_blacklist[] indicates there is a specific driver in hid bus.
Re-enable the devices by moving them to the correct list.
Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
We can't return immediately because lock_kernel() is held.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
For quite some time users with various UPSes from Powercom were forced to play
magic with bind/unbind in /sys in order to be able to see the UPSes. The
beasts does not work as HID devices, even if claims to do so. cypress_m8
driver works with the devices instead, creating a normal serial port with which
normal UPS controlling software works.
The manufacturer confirmed the upcoming models with proper HID support will
have different device IDs. In any way, it's wrong to have two completely
different modules for one device in kernel.
Blacklist the device in HID (add it to hid_ignore_list) to stop this mess,
finally.
Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Many people get it wrong and add device IDs into hid_blacklist instead
of hid_ignore_list. Let's put a little comment in place.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
hid_ignore_list additions for the Antec-branded SoundGraph iMon VFD and LCD
devices (0x15c2:0x0044 and 0x0045).
These devices are driven by lirc.
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The logic for testing for disconnection is reversed in an ioctl leading
to false reports of disconnection.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Tested-by: Folkert van Heusden <folkert@vanheusden.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Report descriptor fixup for MS 1028 receiver changes also values for
Keyboard and Consumer, which incorrectly trims the range, causing correct
events being thrown away before passing to userspace.
We need to keep the GenDesk usage fixup though, as it reports totally bogus
values about axis.
Reported-by: Lucas Gadani <lgadani@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (123 commits)
wimax/i2400m: add CREDITS and MAINTAINERS entries
wimax: export linux/wimax.h and linux/wimax/i2400m.h with headers_install
i2400m: Makefile and Kconfig
i2400m/SDIO: TX and RX path backends
i2400m/SDIO: firmware upload backend
i2400m/SDIO: probe/disconnect, dev init/shutdown and reset backends
i2400m/SDIO: header for the SDIO subdriver
i2400m/USB: TX and RX path backends
i2400m/USB: firmware upload backend
i2400m/USB: probe/disconnect, dev init/shutdown and reset backends
i2400m/USB: header for the USB bus driver
i2400m: debugfs controls
i2400m: various functions for device management
i2400m: RX and TX data/control paths
i2400m: firmware loading and bootrom initialization
i2400m: linkage to the networking stack
i2400m: Generic probe/disconnect, reset and message passing
i2400m: host/device procotol and core driver definitions
i2400m: documentation and instructions for usage
wimax: Makefile, Kconfig and docbook linkage for the stack
...
Commit 079034073f ("HID: hiddev cleanup -- handle all error conditions
properly") by mistake removed proper initialization of hid->hiddev pointer
in hiddev_connect() in case usb_register_dev() succeeds for the hiddev node.
Put it properly back in place.
Reported-and-tested-by: Gabriel C <nix.or.die@googlemail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This patch (as1161) changes the interface to
usb_lock_device_for_reset(). The existing interface is apparently not
very clear, judging from the fact that several of its callers don't
use it correctly. The new interface always returns 0 for success and
it always requires the caller to unlock the device afterward.
The new routine will not return immediately if it is called while the
driver's probe method is running. Instead it will wait until the
probe is over and the device has been unlocked. This shouldn't cause
any problems; I don't know of any cases where drivers call
usb_lock_device_for_reset() during probe.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
sony_set_operational() only propagates return value from
usb_control_msg(), which returns negative on error and number
of transferred bytes otherwise.
Reported-by: Marcin Tolysz <tolysz@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The hidraw subsystem has a bug that prevents the close syscall from ever
reaching the low level driver, leading to a resource leak. Fix by replacing
postdecrement with predecrement.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The Genius PenSketch 12x9 tablet has a puck (labeled a
"Tablet Mouse") in addition to a pen. Without registering a quirk
the tablet appears to be a single input device that reports the
wrong axis information in /proc/bus/input/devices, and sends
incorrect events (e.g. ABS_Z instead of ABS_Y). This information
confuses the X evdev driver and makes the device impossible to
use.
The quirk fixes events and splits the device into multiple input
event devices so that at least the puck is useful.
Signed-off-by: Matt Helsley <matt.helsley@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This device is already handled by radio-si470x driver, and we therefore
want usbhid to ignore it. Patch places usb ids of that device in
ignore section of hid-core.c
Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Make default setting for TopSpeed driver compliant with the defaults
of the other specialized HID drivers.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
I recently picked up a Cyberlink branded remote control produced
by TopSeed Tech Corp. Alas, it appears that this device is using
non-standard mappings for some of it's keys (Usage page 0xffbc).
Signed-off-by: Lev Babiev <harley@hosers.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The usbmouse and usbkbd modules are not supposed to be used with regular USB
mice and keyboards. Make them depend on EMBEDDED to prevent them from being
built and loaded on non-EMBEDDED configs.
Signed-off-by: Parag Warudkar <parag.lkml@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This is a cleanup of hiddev and fixes the following issues:
- thread safety by locking in read & ioctl, introducing a per device mutex
- race between ioctl and disconnect, introducing a flag and locking
in form of a per low level device mutex
- race between open and other methods, making sure only successfully
opened devices are put on the list, changing order of events
- range checking both upper and lower limits of the minor range
- make sure further calls to open fail for unplugged devices even if
the device still has opened files
- error checking for low level open
- possible loss of wakeup events, using standard waiting macros
- race in initialisation by moving registration after full initialisation
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
I have implemented Force Feedback driver for another "GreeAsia" based device
(0e8f:0012 "GreenAsia Inc. USB Joystick"). The functionality was tested with
MANTA Warior MM816 and SpeedLink Strike2 SL-6635 and fftest software -
everything seems to work right.
Signed-off-by: Lukasz Lubojanski <lukasz@lubojanski.info>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Fix the obnoxious "default y" for all the "special" HID code, which forces folk
with EMBEDDED defined to manually override that inappropriate default for
almost 20 choices. The general policy is against "default y"; it should apply
here too.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
We need to properly set parent of the hidraw device (which is the
corresponding physical device itself) in order to hidraw devices not
end up under virtual device tree.
Reported-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Allow adding new devices to the hid drivers on the fly without
a need of kernel recompilation.
Now, one can test a driver e.g. by:
echo 0003:045E:00F0.0003 > ../generic-usb/unbind
echo 0003 045E 00F0 > new_id
from some driver subdir.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
We might sleep, so no problem to use GFP_KERNEL.
While at it bring the function to coding style.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Use usb_endpoint_xfer_int() instead of direct use of constants.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Move usbhid specific flags from global hid.h into local usbhid.h.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The hiddev interface provides ioctl() calls which can be used
to obtain phys and raw name of the underlying device.
Add the corresponding support also into hidraw.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch is part of a larger patch series which will remove
the "char bus_id[20]" name string from struct device. The device
name is managed in the kobject anyway, and without any size
limitation, and just needlessly copied into "struct device".
To set and read the device name dev_name(dev) and dev_set_name(dev)
must be used. If your code uses static kobjects, which it shouldn't
do, "const char *init_name" can be used to statically provide the
name the registered device should have. At registration time, the
init_name field is cleared, to enforce the use of dev_name(dev) to
access the device name at a later time.
We need to get rid of all occurrences of bus_id in the entire tree
to be able to enable the new interface. Please apply this patch,
and possibly convert any remaining remaining occurrences of bus_id.
We want to submit a patch to -next, which will remove bus_id from
"struct device", to find the remaining pieces to convert, and finally
switch over to the new api, which will remove the 20 bytes array
and does no longer have a size limitation.
CC: Jiri Kosina <jkosina@suse.cz>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch (as1146c) makes usbhid automatically call usbhid_set_leds()
for any device that supports the keyboard boot protocol.
In theory this should be perfectly safe. BIOSes send the LED output
report as part of their normal device initialization, so any keyboard
device supporting the boot protocol has to be able to handle it.
As a side effect, the hid-dell and hid-bright drivers are no longer
needed, and the Logitech keyboard driver can be removed from hid-lg.
CC: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
When computing the maximal buffer size needed, we must take into
account that not only input reports can be numbered.
Pointed out in bugzilla #10467
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The mouse interface on unibody macbooks is going to be handled by
bcm59743 driver in 2.6.29.
Reported-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
While parsing 'hid_blacklist' in the apple alu wireless keyboard is not found.
This happens because in the blacklist it is declared with HID_USB_DEVICE
although the keyboards are really bluetooth devices. The same holds for
'apple_devices' list.
This patch fixes it by changing HID_USB_DEVICE to HID_BLUETOOTH_DEVICE in those
two lists.
Signed-off-by: Jan Scholz <Scholz@fias.uni-frankfurt.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
It causes recursive locking warning and is unneeded after
introduction of STARTED flag.
* Resume vs. stop is effectively solved by DISCONNECT flag.
* No problem in suspend vs. start -- urb is submitted even after open
which is possible after connect which is called after start.
* Resume vs. start solved by STARTED flag.
* Suspend vs. stop -- no problem in killing urb and timer twice.
Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
In commit a96d6ef34, the mouse interfaces on the unibody macbooks were
put into hid mouse ignore list. This was a little bit too premature
though, as the corresponding bcm5974 changes are scheduled for 2.6.29.
Remove these devices from the ignore list for now, in order to provide at
least basic functionality with the HID driver.
Will be reintroduced in 2.6.29
Reported-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Fix misplaced quirk entries for devices driven by hid-pl driver. The
devices shouls be only blacklisted by generic HID driver, not completely
ignored.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Some devices have no input interrupt endpoint. These won't be handled
by usbhid, but currently they are not refused and reside on hid bus.
Perform this checking earlier so that we refuse to control such
a device early enough (and not pass it to the hid bus at all).
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch fixes radio-mr800 hidqurks. Removes it from blacklist entry
and places it in ignore entry in hid/hid-core.c
Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch fixes kworld fm700 usb-radio hidqurks that handled by
radio-si470x. Removes it from blacklist entry and places it in ignore
entry in hid/hid-core.c
The bug went in through the V4L/DVB tree by commit 6a13378a without
HID maintainer being involved at all.
Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
`stop' left out usbhid->urb* pointers and so the next `start' thought
it needs to allocate nothing and used the memory pointers previously
pointed to. This led to memory corruption and device malfunction.
Also don't forget to clear disconnect flag on start which was left set
by the previous `stop'.
This fixes
echo DEVICE > /sys/bus/hid/drivers/DRIVER/unbind
echo DEVICE > /sys/bus/hid/drivers/DRIVER/bind
failures.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Use single threaded work queue for hid_compat
I doubt HID really needs to scale over multiple CPUs. So only use a
single threaded workqueue for HID_COMPAT. This avoids some excessive
thread use on systems with a larger number of CPUs.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
On macbooks there are specific keys for the user-space functions Expose
and Dashboard, which currently has no counterpart in input.h. This patch
adds KEY_SCALE and KEY_DASHBOARD, and maps the keyboard accordingly.
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The unibody MacBook 5 and MacBook Pro 5 come with a new version of
the bcm5974 trackpad. This patch adds the USB device ids and all
the appropriate quirks, including hid_blacklist.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
As open needs to sleep hidraw was wrong to call it with a spinlock held.
Furthermore, open can of course fail which needs to be handled.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This device is already handled by radio-si470x driver, and we
therefore want usbhid to ignore it.
Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
Acked-by: Tobias Lorenz <tobias.lorenz@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
As it is, all instances of ->release() for files that have ->fasync()
need to remember to evict file from fasync lists; forgetting that
creates a hole and we actually have a bunch that *does* forget.
So let's keep our lives simple - let __fput() check FASYNC in
file->f_flags and call ->fasync() there if it's been set. And lose that
crap in ->release() instances - leaving it there is still valid, but we
don't have to bother anymore.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This patch (as1157) adds a no-name PS/2-to-USB keyboard+mouse adapter
to the hid-dell driver. (The device shows up with a Product string
saying "Generic USB K/B", nothing more.) This will force an initial
"Set-LEDs" report to be sent to the device, without which it won't
send any keystroke information. Several bug reports mentioning this
device have been filed in various forums; the patch should resolve
them.
This is just a temporary stop-gap for 2.6.28. A later patch for
2.6.29 will introduce a more generic mechanism for "Set-LEDs", making
this change (and the entire hid-dell driver) unnecessary.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
When suspending, make sure that the timer is not running
any more.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Usbhid structure is allocated on start invoked only from probe
of some driver. When there is no driver, the structure is null
and causes null-dereference oopses.
Fix it by allocating the structure on probe and disconnect of
the device itself. Also make sure we won't race between start
and resume or stop and suspend respectively.
References: http://bugzilla.kernel.org/show_bug.cgi?id=11827
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Andreas Schwab <schwab@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
HID: Add support for Sony Vaio VGX-TP1E
HID: fix lock imbalance in hiddev
HID: fix lock imbalance in hidraw
HID: fix hidbus/appletouch device binding regression
HID: add hid_type to general hid struct
HID: quirk for OLED devices present in ASUS G50/G70/G71
HID: Remove "default m" for Thrustmaster and Zeroplus
HID: fix hidraw_exit section mismatch
HID: add support for another Gyration remote control
Revert "HID: Invert HWHEEL mappings for some Logitech mice"
The Sony Vaio VGX-TP1E multimedia PC has a wireless keyboard with
a touchpad.
The mouse pointer is wrongly declared as constant non-data variable, which make
HID code to completely ignore all the "Pointer" usages.
Fix the report descriptor before it enters the parser to contain touchpad
pointer description that is correctly parsable (declaring data rather than
constant).
Reported-by: Stefan Hundhammer <sh@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The appletouch mouse devices are grabbed by the hid bus and not
released even if apple driver says ENODEV (as expected) -- these
are composite USB devices, for which we only ignore the mouse
interface. This is currently not handled by hidbus code properly.
Move the ignoring one level upper to forbid the hid layer to grab the
device.
Reported-by: Justin Mattock <justinmattock@gmail.com>
Reported-by: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add type to the hid structure to distinguish to which device type
(now only mouse) we are talking to. Needed for per device type ignore
list support.
Note: this patch leaves the type as unknown for bluetooth devices,
there is not support for this in the hidp code.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The new revision of OLED device (0x0b05/0x175b) found in ASUS G50/G70/G71
should be ignored the same way we currently do for 0x1726, so that asus_oled
driver can make use of the device.
Reported-by: Costin Grigoras <costin.grigoras@cern.ch>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
There were two stragglers that got missed in the last merge of the HID tree that forgot to change the warn() calls to dev_warn(). This patch fixes them up.
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
hidraw_exit() marked as __exit is called from __init function
from HID core. Remove the section placement from that function.
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
There is a slightly different Gyration remote control, which
requires the quirks we already have in place for the 0x0002 PID,
plus KEY_MEDIA mapping is different.
Reported-by: Marc Randolph <mrand@pobox.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This reverts commit 740f370dc6.
It turned out to be correct in the first place: a positive value should
be sent when the wheel is moved to the right, and a negative value when
moved to the left. This is the behavior expected by the Xorg evdev
driver. I must have had a remapping somewhere else in my system when
originally testing this. Testing on another system shows that the
unpatched kernel is correct.
Here is a bug report from Mandriva that brought the problem to my
attention:
https://qa.mandriva.com/show_bug.cgi?id=44309#c19
Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (46 commits)
UIO: Fix mapping of logical and virtual memory
UIO: add automata sercos3 pci card support
UIO: Change driver name of uio_pdrv
UIO: Add alignment warnings for uio-mem
Driver core: add bus_sort_breadthfirst() function
NET: convert the phy_device file to use bus_find_device_by_name
kobject: Cleanup kobject_rename and !CONFIG_SYSFS
kobject: Fix kobject_rename and !CONFIG_SYSFS
sysfs: Make dir and name args to sysfs_notify() const
platform: add new device registration helper
sysfs: use ilookup5() instead of ilookup5_nowait()
PNP: create device attributes via default device attributes
Driver core: make bus_find_device_by_name() more robust
usb: turn dev_warn+WARN_ON combos into dev_WARN
debug: use dev_WARN() rather than WARN_ON() in device_pm_add()
debug: Introduce a dev_WARN() function
sysfs: fix deadlock
device model: Do a quickcheck for driver binding before doing an expensive check
Driver core: Fix cleanup in device_create_vargs().
Driver core: Clarify device cleanup.
...
Update the help texts for the HID-quirk drivers, so that they are a little
bit more descriptive.
Also make some obsolete help descriptions up to date.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Commit 9be7bbd54d
(HID: build drivers for all quirky devices by default)
made a wrong assumption about select/depends interaction in Kconfig,
resulting in possibility of link failure with certain configuration
options.
Fix this by explicitly having all the quirk-drivers depend on
USB_HID, default to y and make the possibility to alter the
settings dependent on EBMEDDED.
Reported-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Once kernel configuration has CONFIG_HID turned on, let also all the
specialized drivers for quirky devices to be built (unless CONFIG_EMBEDDED is
specified), as usually users don't care that much which driver
gives them the functionality, but when they want generic support, they
probably want to have support for all the quirky devices as well.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This device is already handled by hid-apple driver, but the blacklist entry
was missing in generic driver.
Reported-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This keyboard needs to reset the LEDS during probe.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Based on an original patch from Alexey Klimov <klimov.linux@gmail.com>,
against kernel version 2.6.27.
This device is already handled by radio-mr800 driver, and we therefore
want usbhid not to touch it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
USB should not be having it's own printk macros, so remove warn() and
use the system-wide standard of dev_warn() wherever possible. In the
few places that will not work out, use a basic printk().
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
USB should not be having it's own printk macros, so remove info() and
use the system-wide standard of dev_info() wherever possible.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Commit 8006479c9b introduced a spinlock in
input_dev->event_lock, which is locked when handling input events.
However, the hid-pidff driver sleeps when handling events as it waits for
reports being sent to the device before changing the report contents
again.
This causes a system lockup when trying to use force feedback with a PID
device, a regression introduced in 2.6.24 and 2.6.23.15.
Fix it by extracting the raw report data from struct hid_report
immediately when hid_submit_report() is called, therefore allowing
drivers to change the contents of struct hid_report immediately without
affecting the already-queued transfer.
In hid-pidff, re-add the removed usbhid_wait_io() to
pidff_erase_effect() instead, to prevent a full report queue from causing
the submission to fail, thus not freeing up device memory.
pidff_erase_effect() is not called while dev->event_lock is held.
Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Since we have a real device bound to a driver, we may use struct
device for printing. Use dev_* functions instead of printks in
4 drivers.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
hid-ff.c now calls only pidff (generic driver), the special ones are now
in separate drivers. Invoke pidff on all non-special directly.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Move the force feedback processing into a separate module.
[jkosina@suse.cz: fix Kconfig texts a little bit]
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The bound check on the buffer length
if (count > HID_MIN_BUFFER_SIZE)
is of course incorrent, the proper check is
if (count > HID_MAX_BUFFER_SIZE)
Fix it.
Reported-by: Jerry Ryle <jerry@mindtribe.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
hid_compat_load() runs on the default workqueue, it request_module(), it
execs modprobe, it exits, tty flushes default workqueue, it hangs, because
we are still in it.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Tested-by: <Valdis.Kletnieks@vt.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
iBuddy devices claim to be HID devices, but they are not.
Add them to the blacklist.
Signed-off-by: Remi Cattiau <remi@cattiau.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch fixes a problem that MacBook JIS keyboard sends wrong report
descriptors. Although it has already been fixed in the first Core 2 Duo model,
it still remains in other models of MacBook.
Signed-off-by: Tomoya Adachi <adachi@il.is.s.u-tokyo.ac.jp>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Current kernel has no support for autocentering for Logitech wheels. By
default autocentering enabled in wheel and constant effect does not work
properly. Using USB sniffer I found command which change autocentering
settings: 0xFE, 0x0D, 0x0R, 0x0L, 0x80, 0x00, 0x00, where R - clockwise force,
L - counter-clockwise (0x0-0xF, 0xC = 100%).
Signed-off-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The Kconfig option for HID_COMPAT should read "lose", not "loose".
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This seems to be the very same device, as already supported Smartjoy
dual Plus, but with slightly different vendor ID. Let's support this
one too.
Reported-by: David Ashley <dashxdr@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch reverts the change made four years ago here:
http://www.vg.kernel.org/pub/linux/kernel/people/gregkh/usb/2.4/usb-hid-2.4.25-pre7.patch
UPS's made by MGE can be used with usbhid just fine, and by removing the
ignore quirk allows them to be used with HAL so they just work when plugged
in, without needing to be manually configured.
With the ignore quirk in place a user would have to configure NUT before the
UPS could be used, as NUT uses it's own internal USB matching framework
to match against the USB devices, do low level control messages on the
device and then parse the HID tables all in userspace.
This is not needed, as allowing the device to be claimed as a usbhid device
allows it to be used like any other USB UPS device. The devices correctly
advertise the power device page which can be queried for the device state.
I assume the quirk was changed so that people using < libusb 0.1.8 could
still use NUT's internal HID code to manage the UPS.
libusb 0.1.8 was released quite some time ago: 2004-02-11.
This patch does not break NUT as in drivers/libusb.c the device is force
unbound from the kernel driver using usb_detach_kernel_driver_np () where
it can be controlled like normal.
[jkosina@suse.cz: adapt to the new hidbus code]
Signed-off-by: Richard Hughes <rhughes@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Introduce a list of devices for which there is need to
force a creation of the hiddev interface, but still they
are operated by generic driver (i.e. certain UPS).
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Merge the logitech force feedback processing directly into logitech
driver from the usbhid core.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Move the handling of the leds resetting from the core to
the dell and logitech drivers.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Move connecting from usbhid to the hid layer and fix also hidp in
that manner.
This removes all the ignore/force hidinput/hiddev connecting quirks.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Remove support for both dynamic and static report descriptor
quirks. There is no longer rdesc code which it would support,
so it's useless.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Bring switch and cases into coding style and save thus some
indentation to make the code tighter.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add compat option to hid code to allow loading of all modules on
systems which don't allow autoloading because of old userspace.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Move ignore quirks from usbhid-quirks into hid-core code. Also don't output
warning when ENODEV is error code in usbhid and try ordinal input in hidp
when that error is returned.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This mapping are currently used on 2 placces and will be needed by more
quirk drivers, so move them to hid.h to allow them to use it.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Move ids from hid-quirks.c into separate file, since it will be needed in
more than one place.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Next step for complete hid bus, this patch includes:
- call parser either from probe or from hid-core if there is no probe.
- add ll_driver structure and centralize some stuff there (open, close...)
- split and merge usb_hid_configure and hid_probe into several functions
to allow hooks/fixes between them
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Make a bus from hid core. This is the first step for converting all the
quirks and separate almost-drivers into real drivers attached to this bus.
It's implemented to change behaviour in very tiny manner, so that no driver
needs to be changed this time.
Also add generic drivers for both usb and bt into usbhid or hidp
respectively which will bind all non-blacklisted device. Those blacklisted
will be either grabbed by special drivers or by nobody if they are broken at
the very rude base.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This driver adds support for the multitouch trackpad on the new
Apple Macbook Air and Macbook Pro Penryn laptops. It replaces the
appletouch driver on those computers, and integrates well with the
synaptics driver of the Xorg system.
[dtor@mail.ru: various cleanups]
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
In drivers/hid/hid-input.c, the apple_fn_keys translation table
contains no entries for the F5 and F6 keys. This patch maps the F5 and
F6 keys to KBDILLUMDOWN and KBDILLUMUP, respektively, which make them
work as keyboard backlight control keys.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch completely removes the dependency of usbkbd and usbmouse drivers
on usbhid code.
usbkbd/usbmouse drivers are not needed in the vast majority of cases anyway,
and they shouldn't be loaded in standard configurations at all. They are supposed
to be as trivial as possible, and searching for HID_QUIRK_IGNORE can even be
bad in some cases.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This adds in a quirk for the additional un-mapped buttons on the
gyration MCE remote.
Defines are now alphabetical.
Signed-off-by: Daniel Walker <dwalker@mvista.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch is based on one provided by Jiri Kosina to handle the sleep
button. I just added some cleanup and integrated it into my series.
Signed-off-by: Daniel Walker <dwalker@mvista.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Logitech DiNovo desktop needs the same quirk as other DiNovo
devices.
Reported-by: Farid Benamrouche <farid.benamrouche@free.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
When usbmouse/kbd is set to build, USB_HID is never defined due to
the USB_HID!=y Kconfig rule. Test CONFIG_USB_HID_MODULE in both
drivers instead.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Some Logitech mice have a tilt wheel which register as HWHEEL buttons.
The events are positive for a click to the right and negative for a
click to the left. Applications expect the opposite, though.
I suspect this affects a lot more Logitech mice, but these are the only
two I have. I tested this using evtest and a GTK application. A similar
Microsoft Intellimouse I have works correctly.
Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Added device ids to hid-quriks for detection of keyboards on 4th
generation Macbook Pro and Macbook Air
The naming scheme is consistent with past Apple keyboards in hid-quirks;
as defined by Apple (including device ids) in:
/System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/Co
ntents/Info.plist
Patch was originally posted and tested at:
https://bugs.launchpad.net/mactel-support/+bug/207127
Signed-off-by: Alexandre Karpenko <alexander@comm.utoronto.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Fix build failure introduced by Alan's ioctl -> unlocked_ioctl
(pushing BKL down to the driver) conversion patch for hiddev.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
In this case I simply wrapped it as code review suggests the locking
already terminally broken and I didn't want to make it first. See added
comment
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Push down the BKL. In some cases compat_ioctl already doesn't take the
BKL so we don't either. Some of the locking here seems already dubious
and object lifetimes want documenting
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
device_create() is race-prone, so use the race-free
device_create_drvdata() instead as device_create() is going away.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch renames the existing usb_reset_device in hub.c to
usb_reset_and_verify_device and renames the existing
usb_reset_composite_device to usb_reset_device. Also the new
usb_reset_and_verify_device does't need to be EXPORTED .
The idea of the patch is that external interface driver
should warn the other interfaces' driver of the same
device before and after reseting the usb device. One interface
driver shoud call _old_ usb_reset_composite_device instead of
_old_ usb_reset_device since it can't assume the device contains
only one interface. The _old_ usb_reset_composite_device
is safe for single interface device also. we rename the two
functions to make the change easily.
This patch is under guideline from Alan Stern.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
From the current implementation of usb_reset_composite_device
function, the iface parameter is no longer useful. This function
doesn't do something special for the iface usb_interface,compared
with other interfaces in the usb_device. So remove the parameter
and fix the related caller.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch removes CVS keywords that weren't updated for a long time
from comments.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The new iMON LCDs from SoundGraph need to be blacklisted from HID in order to
be used by lirc.
Signed-off-by: Dylan R Semler <dylan.semler@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Since 2.6.25 the HID_QUIRK_APPLE_HAS_FN quirk is enabled even for
non-laptop Apple keyboards of the Aluminium series. The USB version of
these don't need Numlock emulation, like the laptop (and Aluminium
Wireless) do, as they have a proper keypad.
This patch splits the Numlock emulation for Apple keyboards in a
different quirk flag, so that it can be enabled for all the keyboards
but the Aluminium USB ones.
If the Numlock emulation is enabled for Aluminium USB keyboards, the
JKL and UIO keys become the numeric pad, and the rest of the keyboard
is disabled, included the key used to disable Numlock.
Additionally, these keyboard should not have a Numlock at all, as the
Numlock key is instead replaced by the 'Clear' key as usual for Apple
USB keyboards.
Signed-off-by: Diego 'Flameeyes' Petteno <flameeyes@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
usb_control_msg() converts arguments to little-endian itself,
doing that in caller means breakage on big-endian boxen.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Fix a typo in report descriptor fixup, which results in improper
substitution and leaving old value in place.
Reported-by: Juha Motorsportcom <juha_motorsportcom@luukku.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Samsung USB remotes (0419:0001) report six keys via standard HID usage pages
(arrow keys, OK, Power). Kernel 2.6.25 maps those to input events (in addition
to the hiddev report). The remaining 43 keys are reported via proprietary HID
report page and therefore by hiddev only.
Applications using hiddev and input device might process the 6 standard keys
twice. To avoid this, the input device will be suppressed for the Samsung
remote with a quirk entry, forcing to use the hiddev device only.
LIRC already contains the proper support.
Signed-off-by: Robert Schedel <r.schedel@yahoo.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Jeremy Robertson reports that GTCO engineers made a mistake and we don't
need 0x60x GTCO product ids blacklisted.
This mostly reverts dda3fd35, but leaves PID 0x1007 intact.
Reported-by: Jeremy Roberson <jeremy.roberson@einstruction.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
There is no need to keep a few years old ThrustMaster force-feedback
driver as experimental.
HID_FF is currently marked experimental anyway, so this is even redundant.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
There is a window:
task A task B
spin_lock_irq(&usbhid->inlock); /* Sync with error handler */
usb_set_intfdata(intf, NULL);
spin_unlock_irq(&usbhid->inlock);
usb_kill_urb(usbhid->urbin);
usb_kill_urb(usbhid->urbout);
usb_kill_urb(usbhid->urbctrl);
del_timer_sync(&usbhid->io_retry);
cancel_work_sync(&usbhid->reset_work);
if (!hid->open++) {
res = usb_autopm_get_interface(usbhid->intf);
if (res < 0) {
hid->open--;
return -EIO;
}
}
if (hid_start_in(hid))
if (hid->claimed & HID_CLAIMED_INPUT)
hidinput_disconnect(hid);
in which an open() to an already disconnected device will submit an URB
to an undead device. In case disconnect() was called by an ioctl, this'll
oops. Fix by introducing a new flag and checking it in hid_start_in().
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch makes the following needlessly global functions static:
- hid-core.c:hid_input_field()
- usbhid/hid-quirks.c:usbhid_modify_dquirk()
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The numbered reports need to be passed properly to hidraw (i.e. with the first
data field indicating the report number), otherwise userspace has no idea
about the identification of the report.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This moves the misplaced rdesc quirk to the place where it belongs.
Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add force feedback support for Logitech Rumblepad 2.
Tested-By: Edgar Simo <bobbens@gmail.com>
Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Fix these sparse warnings:
.../hid/hid-core.c💯15: warning: incorrect type in assignment (different signedness)
.../hid/hid-core.c💯15: expected signed int [usertype] *value
.../hid/hid-core.c💯15: got unsigned int *<noident>
by unsigned -> s32
.../hid/hid-input-quirks.c:336:10: warning: Using plain integer as NULL pointer
by 0 -> NULL
.../hid/usbhid/hid-core.c:786:46: warning: incorrect type in argument 3 (different signedness)
.../hid/usbhid/hid-core.c:786:46: expected int *max
.../hid/usbhid/hid-core.c:786:46: got unsigned int *<noident>
.../hid/usbhid/hid-core.c:787:47: warning: incorrect type in argument 3 (different signedness)
.../hid/usbhid/hid-core.c:787:47: expected int *max
.../hid/usbhid/hid-core.c:787:47: got unsigned int *<noident>
.../hid/usbhid/hid-core.c:788:48: warning: incorrect type in argument 3 (different signedness)
.../hid/usbhid/hid-core.c:788:48: expected int *max
.../hid/usbhid/hid-core.c:788:48: got unsigned int *<noident>
by int -> unsigned int
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Currently using debug=1 with hid module prints out all sent and received
reports to the kernel log, while in many cases we only want to see the
report descriptors and hid-input mappings that are printed when a device
is probed.
Add new level debug=2, and only dump the report traffic with that level.
Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This must be the weirdest failure yet. My external disk stops processing
the storage commands the moment it receives a GET_REPORT. The firmware
does not crash; if I do rmmod hid, then SET-INTERFACE restores normal
operations. Still, I cannot live without the keyboard when I want backup
my files. Adding the NOGET quirk fixes this problem for me.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This device has reports lower logical maximum compared to the real
usages for Zoom+ and Zoom- it emits.
This patch bumps the values in the report descriptor up, and also
adjusts HID_MAX_USAGE accordingly.
Reported-by: Khelben Blackstaff <eye.of.the.8eholder@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Microsoft's wireless desktop receiver (Model 1028) has a bug in the report
descriptor -- namely, in four seperate places it uses USAGE_MIN and _MAX when
it quite obviously doesn't intend to.
In other words, it reports that it has pretty much _everything_ in 'consumer'
and 'generic desktop'. And then the X evdev driver believes I have a mouse
with 36 absolute axes and a huge pile of keys and buttons, when I in fact,
should have zero. 255/256 in three of the cases, and 0-1024 in another.
This patch fixes the report descriptor of this device before it enters the HID
parser.
Signed-off-by: Jim Duchek <jim.duchek@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Many vendors highspeed devices give erroneously fullspeed interval value in
endpoint descriptor for interrupt endpoints. This quirk fixes up that by
recalculating the right value for highspeed device.
At the time of hid configuration this quirk calculates which highspeed interval
value gives same interval delay as, or next smaller then, what it would be if
the original value would be interpreted as fullspeed value. In subsequent urbs
that new value is used instead.
Forming the 'hid->name' in usb_hid_config() was moved up to accommodate more
descriptive printk reporting the fixup.
In this patch the quirk is set for one such device: Afatech DVB-T 2 infrared
HID-keyboard. It reports value 16 which means 4,069s in highspeed while
obviously 16ms was intended. In this case quirk calculates new value to be 8
which gives when interpreted as highspeed value 16ms as wanted. The behavior of
the device was verified to be what expected both before and after the patch.
Signed-off-by: Pekka Sarnila <sarnila@adit.fi>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Fix build failure in hiddev_ioctl with gcc 3.2:
http://bugzilla.kernel.org/show_bug.cgi?id=10121
The trick is to move the handling of ioctls which need to allocate
memory to separate functions.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
USBHID driver only supports relative mode with this tablet so let aiptek
module handle it.
Signed-off-by: Dmitry Guryanov <guryanov@dgap.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
F5 and F6 have no second function printed on them. Thus their definitions have
been removed from the table.
KEY_CYCLEWINDOWS doesn't name the function of Mac OS X' Expose properly and
because we couldn't find a better key code, we decided to use KEY_FN_F4
instead.
We also changed KEY_BACK and KEY_FORWARD, which apply to browser functions, to
KEY_PREVIOUSSONG and KEY_NEXTSONG, since the keys are intended to control a
music player.
Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The hid_input_report() in debug mode of course outputs the report itself, not
the device report descriptor.
Fix this error in comment.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add quirk entry for BADPAD for the NATSU Playstation USB adapter. The
adapter is supported under Linux, but with bad direction detection.
Signed-off-by: Andrew Burton <adb@iinet.net.au>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
We need to blacklist this device, as it should be handled by
ldusb driver.
Reported-by: stephen <stephen.ware@eqware.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The old code (before move) stopped further processing of the
event after it has been already processed by the quirk handler.
The new code didn't propagate the return value properly, and
therefore the processing always proceeded, which was wrong.
This patch fixes it. Pointed out in kernel.org bugzilla #9842
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Adds new GTCO CalComp USB device PIDs to the blacklist.
Signed-off-by: Jeremy A. Roberson <jroberson@gtcocalcomp.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch adds blacklist entries in hid-quirks.c to let the usbhid driver
ignore the si470x radio devices. They are now handled by the new radio-si470x
driver.
Signed-off-by: Tobias Lorenz <tobias.lorenz@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Logitech Extreme 3D needs NOGET quirk, otherwise it times out at
the time of connect.
Reported-by: Mike Sharov <msharov@softhome.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Following the suggestion of Jonas, this patch maps the special keys of
the MS Presenter 8000 to targets that should allow for better re-mapping
according to individual use cases (i.e. I avoided hard-wiring to
standard keys). This time I also included the last missing key event
(switching back from presentation mode).
The optimal Xmodmap customization for using the Presenter with
OpenOffice now looks like this for me:
keycode 175 = Escape
keycode 179 = F5
keysym XF86Forward = Right
keysym XF86Back = Left
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
0x045e/0x0701 also needs the hid-input mapping quirk established by
quirk_microsoft_presenter_8k().
Reported-by: Jonas Delrue <jonas_delrue@hotmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Samsung USB remotes (0419:0001) are rejected by kernel 2.6.23, because the
report descriptor from the remote contains a 48 bit HID report field. HID 1.11
states: Fields may span at most 4 bytes.
This patch, based on 2.6.23, fixes this by modifying the internal report
descriptor in hid-quirks.c. Additional user space support (e.g. LIRC) is
required to fetch the information from the hiddev interface.
The burden to reconstruct the data is moved into userspace (lirc through hiddev).
There is no need to set HID_QUIRK_HIDDEV quirk, as the device has also output
applications, which trigger the creation of hiddev device automatically.
Signed-off-by: Robert Schedel <r.schedel@yahoo.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
We can use the blacklist only if usbhid code is compiled.
Reported-by: jurriaan <thunder7@xs4all.nl>
Cc: Pascal Terjan <pterjan@mandriva.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>