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>
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>