If, in usb_hid_configure(), we fail to allocate storage for 'usbhid',
"if (!(usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL)))",
then we'll jump to the 'fail:' label where we have this code:
usb_free_urb(usbhid->urbin);
usb_free_urb(usbhid->urbout);
usb_free_urb(usbhid->urbctrl);
Since we got here because we couldn't allocate storage for 'usbhid',
what we have here is a NULL pointer dereference - ouch...
This patch solves that little problem by adding a new
'fail_no_usbhid:' label after the problematic calls to
usb_free_urb() and jumps to that one instead, in the problem case.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Some of ASUS' notebooks (e.g G Series) include a tiny oled display, which is
attached to an internal USB bus. Unfortunatly the device reports a wrong
DeviceDescriptor and is therefore identified as a HID device...
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch adds the entire range of Logitech's ProductIDs that are reserved
for their Harmony remotes. The in-kernel HID driver can't do anything with
these, and now there is a GPL user-space application that can handle them:
http://www.sf.net/projects/harmonycontrol
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The IR sensor in some newer Apple computers has no other
driver in the kernel, yet. However, the macmini driver in lirc
requires a HID device for the IR sensor.
Cc: Soeren Sonnenburg <kernel@nn7.de>
Signed-off-by: Tino Keitel <tino.keitel@tikei.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch (as918) introduces a new USB driver method: reset_resume.
It is called when a device needs to be reset as part of a resume
procedure (whether because of a device quirk or because of the
USB-Persist facility), thereby taking over a role formerly assigned to
the post_reset method. As a consequence, post_reset no longer needs
an argument indicating whether it is being called as part of a
reset-resume. This separation of functions makes the code clearer.
In addition, the pre_reset and post_reset method return types are
changed; they now must return an error code. The return value is
unused at present, but at some later time we may unbind drivers and
re-probe if they encounter an error during reset handling.
The existing pre_reset and post_reset methods in the usbhid,
usb-storage, and hub drivers are updated to match the new
requirements. For usbhid the post_reset routine is also used for
reset_resume (duplicate method pointers); for the other drivers a new
reset_resume routine is added. The change to hub.c looks bigger than
it really is, because mark_children_for_reset_resume() gets moved down
next to the new hub_reset_resume() routine.
A minor change to usb-storage makes the usb_stor_report_bus_reset()
routine acquire the host lock instead of requiring the caller to hold
it already.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This patch (as886) adds the controversial USB-persist facility,
allowing USB devices to persist across a power loss during system
suspend.
The facility is controlled by a new Kconfig option (with appropriate
warnings about the potential dangers); when the option is off the
behavior will remain the same as it is now. But when the option is
on, people will be able to use suspend-to-disk and keep their USB
filesystems intact -- something particularly valuable for small
machines where the root filesystem is on a USB device!
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This keyboard has wireless mouse which has left, middle, right buttons and
2-dimensional scrolling wheel. Unfornetuly, this wheel reports side scrolling
events and 11 or 12 button events at the same time.
I've wrote a patch to fix this mapping. I'm not sure if this mapping is proper
for buttons, because , for example, there is no entry for "burn cd" in input.h.
The patch also supress 11 and 12 button events from mouse when you scroll the
wheel left and right. With this patch, only side scrolling events are
reported. (This mouse has only 4 buttons and 2D wheel. There is no such
buttons like 11 and 12.)
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
When setting the autocentering of PID devices, PID_DIRECTION_ENABLE is not
being explicitely set to 1. This results in autocentering working only on the
vertical axis when this field is preset to 0.
Fix that by setting it explicitely to 1 when preparing the set_effect report
for autocentering spring effect.
Signed-off-by: Diogo Kastrup <dk@bighost.com.br>
Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Lately there have been quite a lot of bug reports against broken devices
which require us to fix their report descriptor in the runtime, before it
is passed to the HID parser. Those devices have eaten quite an amount of
our quirks space, which isn't particularly necessary - the quirks are not
needed after the report descriptor is parsed, and they just consume bits.
Therefore this patch separates the quirks for report descriptor fixup, and
moves their handling into separate code. The quirks are then forgotten as
soon as the report descriptor has been parsed.
Module parameter 'rdesc_quirks' is introduced to be able to modify these
quirks in runtime in a similar way to 'quirks' parameter for ordinary HID
quirks.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Devices manufactured by NCR have userspace hiddev-based drivers,
which do all the necessary device querying by themselves. The devices
must not be queried directly by the generic HID driver, as reported by
NCR engineers.
Cc: Petr Ostadal <postadal@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Petalynx Maxter remote control [1] 0x18b1/0x0037 emits 0xfa and 0xfc from
consumer page (reserved in HUT 1.12) for back and more keys. It also emits
a few usages from LOGIVENDOR page, which need adding.
Also, this device has broken report descriptor - the reported maximum is too
low - it doesn't contain the range for 'back' and 'more' keys, so we need to
bump it up before the report descriptor is being parsed.
Besides all this, it also requires NOGET quirk.
This patch does so.
[1] http://www.elmak.pl/index.php?option=com_phpshop&page=shop.browse&category_id=14&ext=opis&lang=en
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch provides support for the Gameron dual psx adaptor. The
modification is to add the quirk HID_QUIRK_MULTI_INPUT for this
specific USB device.
Signed-off-by: Julien Eyries <jeyries@yahoo.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch (as914) replaces a call to flush_scheduled_work() with
cancel_work_sync(), in order to help avoid potential deadlocks.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Microsoft SideWinder GameVoice driver is a trivial device with a few buttons
(0x09 HID usage) and an audio connector, which just forwards the audio input
into oridinary sound card present in the computer.
Despite this fact, the only interface of this device reports itself as a
Telephony/Headset type of HID device. This is apparently incorrect - the device
itself doesn't provide any audio/telephony functionality. This is achieved in
userland application which only needs to receive the button events from the HID
driver.
This patch establishes a new quirk which forces hid-input to claim a device it
will otherwise leave untouched.
Reported-by: Tomas Carnecky <tom@dbservice.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
There have been many reports recently about broken HID devices, the
diagnosis of which required users to recompile their kernels in order
to be able to provide debugging output needed for coding a quirk for
a particular device.
This patch makes CONFIG_HID_DEBUG default y if !EMBEDDED and makes it
possible to control debugging output produced by HID code by supplying
'debug=1' module parameter.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
There is a small race window in which hiddev_release() could corrupt the
list that is being processed for new event in hiddev_send_event().
Synchronize the operations over this list.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
In preparation for struct class_device -> struct device input
core conversion switch to using input_dev->dev.parent when
specifying device position in sysfs tree.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Logitech wheel (product id 0xc294) doesn't like to be polled for reports,
otherwise it slows down initialization of this device to ten seconds.
This patch adds HID_QUIRK_NOGET flag for this wheel.
Signed-off-by: Jan Kratochvil <honza@jikos.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Certain versions of Cypress USB barcode readers (this problem is known to
happen at least with PIDs 0xde61 and 0xde64) have report descriptor which
has swapped usage min and usage max tag. This results in HID parser failing
for report descriptor of these devices, as it (wrongly) requires allocating
more usages than HID_MAX_USAGES.
Solve this by walking through the report descriptor for such devices, and swap
the usage min and usage max items (and their values) to be in proper order.
Reported-by: Bret Towe <magnade@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
It turns out that there are broken devices out there that incorrectly
report VID/PID as 0x000, see http://lkml.org/lkml/2007/4/27/496
Therefore we should not confuse users by dumping warnings and stacktraces
in such situation. It is not possible to add quirks for such horribly
broken devices, but currently that's not needed.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add a 'quirks' module parameter for the usbhid module, so users can
add or modify quirks at module load time.
Signed-off-by: Paul Walmsley <paul@booyaka.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add internal support for dynamically-allocated HID quirks, "dquirks"
(for "dynamic quirks"). Includes several functions to add/modify quirks
from the list. This code is used by the next patch to implement quirk
modification upon module load.
Signed-off-by: Paul Walmsley <paul@booyaka.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Rename existing quirks handling code that operates over a static array
to "squirks" (short for static quirks) to differentiate it from the
dynamically-allocated quirks that will be introduced in the
next patch. Add an accessor function specifically for static quirks,
usbhid_exists_squirk().
Signed-off-by: Paul Walmsley <paul@booyaka.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Move the USB_VENDOR* and USB_DEVICE* defines and the hid_blacklist[]
array there from hid-core.c. Add
hid-quirks.c:usbhid_lookup_any_quirks() to return quirk information to
hid-core.c. Convert __u32, __u16 types to u32, u16.
Signed-off-by: Paul Walmsley <paul@booyaka.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add HID_QUIRK_MULTI_INPUT to the EMS USBII (0x0b43/0003) so the kernel detects both joystick
ports properly. Without it you end up with a single joystick node (js0) that combines the
two physical port signals.
Signed-off-by: Paul Zaremba <pez-gpg@treeofice.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This adds support for WiseGroup Quad Joypad (0x0925/0x8800). The
same quirks as for Dual Joypad (0x0925/0x8866) are needed.
Signed-off-by: Sam Liddicott <sam@liddicott.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch adds support for Logitech Force 3D Pro Joystick (0x046d/0xc286)
to hid-lgff driver.
Device ID reported by Richard Bolkey <rbolkey@cs.utexas.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
On Dell W7658 keyboard, when BIOS sets NumLock LED on, it survives the
takeover by kernel and thus confuses users.
Eating of an increasibly scarce quirk bit is unfortunate. We do it for safety,
given the history of nervous input devices which crash if anything unusual
happens.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Logitech MX3000 contains report descriptor which doesn't cover usages
above 0x28c, but emits such usages. Report descriptor needs fixing
in the very same way as with receivers shipped with S510 keyboards.
This patch also adds a few mappings for multimedia keys that S510 didn't
emit.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Logitech S510 keyboard is shipped with USB receivers with various product
ids, all need their report descriptor to be fixed. This adds PID 0xc50c.
Reported by Christophe Colombier in kernel.org bugzilla #7352
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Add HID_QUIRK_HIDDEV for the Belkin Flip USB KVM, which provides for software
control of switching via a HID class interface. It overloads three HID LED
usages, two of which aren't mapped in the ev_dev input subsection, and which it
doesn't make sense to map. In order to force the creation of a hiddev device
for controlling the Flip, this quirk flag is needed.
Signed-off-by: Daniel P. Engel <dengel@sourceharvest.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This patch adds support for version 1 of Thustmaster firestorm dual power
(0x44f/0xb300).
Signed-off-by: Ronny Peine <RonnyPeine@gmx.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Explicitly specify the size of the hid_blacklist quirks member, to guard
against surprises on architectures where unsigned ints aren't 32 bits long.
Signed-off-by: Paul Walmsley <paul@booyaka.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The USB HID driver fails to reset its error-retry timeout when there
has been a long time interval between I/O errors with no successful URB
completions in the meantime. As a result, the very next error would
trigger an immediate reset, even if it was a chance event occurring
long after the previous error.
More USB keyboards and mice than one might expect end up getting I/O
errors. Almost always this results from hardware problems of one sort of
another. For example, people attach the device to a USB extension cable,
which degrades the signal. Or they simply have poor quality cables to
begin with. Or they use a KVM switch which doesn't handle USB messages
correctly. Etc...
There have been reports from several users in which these I/O
errors would occur more or less randomly, at intervals ranging from
seconds to minutes. The error-handling code in hid-core.c was originally
meant for situations where a single outage would persist for a few hundred
ms (electromagnetic interference, for example). It didn't work right when
these more sporadic errors occurred, because of a flaw in the logic
which this patch fixes.
This patch (as873) fixes that oversight.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
The vendor/product IDs for the purposes of hid_blacklist got
scathered around the hid-core.c in a rather random way over the
time.
Move all the related definitions at the beginning of the file,
and make them sorted again. Sort also hid_blacklist properly.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Separate usbhid code into dedicated drivers/hid/usbhid directory as
discussed previously with Greg, so that it eases maintaineance process.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>