dect
/
linux-2.6
Archived
13
0
Fork 0
Commit Graph

567 Commits

Author SHA1 Message Date
Dmitry Torokhov 58b939959d Input: scancode in get/set_keycodes should be unsigned
The HID layer has some scan codes of the form 0xffbc0000 for logitech
devices which do not work if scancode is typed as signed int, so we need
to switch to unsigned it instead. While at it keycode being signed does
not make much sense either.

Acked-by: Márton Németh <nm127@freemail.hu>
Acked-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-03-08 23:19:15 -08:00
Oliver Neukum 86266452f8 USB: Push BKL on open down into the drivers
Straightforward push into the drivers to allow
auditing individual drivers separately

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-02 14:54:23 -08:00
Jiri Kosina 14ef2b0c02 Merge branches 'upstream', 'raw_report_modifications' and 'apple_magic_mouse' into for-linus
Conflicts:
	drivers/hid/Kconfig
2010-02-25 17:39:16 +01:00
Jiri Kosina 57ab12e418 HID: usbhid: initialize interface pointers early enough
Move the initialization of USB interface pointers from _start()
over to _probe() callback, which is where it belongs.

This fixes case where interface is NULL when parsing of report
descriptor fails.

LKML-Reference: <20100213135720.603e5f64@neptune.home>
Reported-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-17 14:25:01 +01:00
Jiri Kosina 7f978b9bf5 HID: extend mask for BUTTON usage page
Now that joystick button usages can expand over 15 buttons, we
have to properly mask out the code from hid usage to cover the
whole 0xffff available space.

Reported-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-17 09:36:35 +01:00
Rafi Rubin ff5cf34c80 HID: hid-ntrig: Single touch mode tap
Add DOUBLETAP to events emitted when in single touch only mode.

Users with a single touch firmware report not seeing the DOUBLETAP events; this
is a side effect of dropping old mapping for confidence. The confidence mapping
may be fine for singletouch mode but causes problems in multitouch mode.

Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-16 17:56:20 +01:00
Rafi Rubin dbf2b17de5 HID: hid-ntrig: multitouch cleanup and fix
This cleans up the identification of multitouch groups and enables
the end of group sync.

Taps are now explicitly handled to adjust for the changes in the
event stream in multitouch mode.  Added triple and quad tap for the
benefit of tools that recognize different tap types but do not have
full multi touch support.

This cleans up the behavior particularly for the latest firmware, which
didn't work particularly well with the older version of the driver.

In this form, when multitouch is active, both mt and st events will come out of
the "N-Trig MultiTouch" device.  And when its not st events will come out of
"N-Trig Touchscreen".

Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-16 13:54:23 +01:00
Rafi Rubin b0549cf1a3 HID: n-trig: remove unnecessary tool switching
With the pen and touch split apart, we no longer need to inject
additional tool switching events.

Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-16 13:53:52 +01:00
Rafi Rubin 943ed464f3 HID: hid-ntrig add multi input quirk and clean up
Added a quirk to enable distinct input devices.  The digitizer utilizes
three inputs to represent pen, multitouch and a normal touch screen.

With the Pen partitioned, it behaves well and does not need special
handling.

Also, I set names to the input devices to clarify the functions of the
various inputs.

Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-16 13:53:22 +01:00
Oliver Neukum 858155fbcc HID: usbhid: introduce timeout for stuck ctrl/out URBs
Some devices do not react to a control request (seen on APC UPS's) resulting in
a slow stream of messages, "generic-usb ... control queue full".  Therefore
request needs a timeout.

Cc: stable@kernel.org
Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: David Fries <david@fries.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-12 13:07:51 +01:00
Michael Poole 71b38bd4c1 HID: magicmouse: coding style and probe failure fixes
Use proper values to initialize bool configuration variables, tabs rather than
spaces, no braces for one-line else clause, __set_bit() when the operation
doesn't have to be atomic, input_set_abs_params() rather than writing the
fields directly, and call hid_hw_stop() when appropriate to handle failures in
the probe.

Signed-off-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-11 11:22:35 +01:00
Jiri Kosina c8a8602b76 HID: remove MODULE_VERSION from new drivers
MODULE_VERSION doesn't make too much sense for drivers merged
into main tree, as git is much better tracking revisions than
any developer might ever be.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-10 15:29:02 +01:00
Jiri Kosina 9f52314723 HID: fix up Kconfig entry for MagicMouse
Make Apple MagicMouse Kconfig entry consistent with other dirvers.
Also expand the tristate text a little bit more, so that it doesn't
clash with already existing HID_APPLE.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-10 14:59:03 +01:00
Michael Poole 128537cea4 HID: add a device driver for the Apple Magic Mouse.
The Magic Mouse requires that a driver send an unlock Report(Feature) command,
similar to the Wacom wireless tablet and Sixaxis controller quirks.  This turns
on an Input Report that isn't published in the input Report descriptor that
contains touch data (and usually overrides the normal motion and click Report).

Because the mouse has only one switch and no scroll wheel, the driver
(under control of parameters) emulates a middle button and scroll wheel.
User space could also ignore and/or re-synthesize those events based on
the reported events.

Some user-space tools to talk to the mouse directly (that is, when it is not
associated with the host's HIDP stack) are at
http://github.com/entrope/linux-magicmouse

Signed-off-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-10 14:57:33 +01:00
Michael Poole 90a006abf8 HID: Export hid_register_report
The Apple Magic Mouse (and probably other devices) publish reports that are not
called out in their HID report descriptors -- they only send them when enabled
through other writes to the device.  This allows a driver to handle these
unlisted reports.

Signed-off-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-10 14:57:30 +01:00
Stephane Chatty 77f720b71d HID: Support for MosArt multitouch panel
Added support for MosArt dual-touch panels, present in the Asus T91MT notebook.

Signed-off-by: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-10 14:52:12 +01:00
Stephane Chatty 580363db92 HID: add pressure support for the Stantum multitouch panel
Added pressure handling for Stantum multitouch panels

Signed-off-by: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-10 12:12:43 +01:00
Stephane Chatty b32758c721 HID: fixed bug in single-touch emulation on the stantum panel
Fixed stupid copy-paste bug in touchscreen emulation for the Stantum multitouch
panel: a flag was reset just before being tested.

Signed-off-by: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-10 12:09:17 +01:00
Bastien Nocera eabe5c9058 HID: fix typo in error message
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-09 11:43:19 +01:00
Leo P White 0690535d6b HID: add mapping for "AL Network Chat" usage
Adding a mapping for the 'AL Network Chat' usage from the 'Consumer' usage
page (USB HID Usage Tables v1.11). This usage is used by some keyboards for
a multimedia key.

Signed-off-by: Leo P White <lpw25@cam.ac.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-09 11:23:00 +01:00
Thadeu Lima de Souza Cascardo c2c3489c5b HID: use multi input quirk for TouchPack touchscreen
This device generates ABS_Z and ABS_RX events, while it should be
generating ABS_X and ABS_Y instead. Using the MULTI_INPUT quirk solves
this issue.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Daniel Oliveira Nascimento <don@syst.com.br>
[jkosina@suse.cz: fixed blacklist ordering while resolving conflict]
[jkosina@suse.cz: fixed typo to make it compile]
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-04 18:50:23 +01:00
Jiri Kosina 2dbf209d7a HID: make full-fledged hid-bus drivers properly selectable
For historical reasons, we don't have most of the in-tree
drivers residing on hid-bus properly selectable in kernel
configuration unless CONFIG_EMBEDDED is set.

This has been introduced on Linus' request from 14 Oct

===
As to the Kconfig options - do they really add so much space that you need to
ask for the quirks? You didn't use to. Can you make the questions depend on
EMBEDDED, or at least on the HID_COMPAT thing or whatever?
===

This still makes perfect sense for small and tiny drivers, which
just fix report descriptors, fix up HID->input mappings that slightly
violates HUT standard, send one extra packet to the device that is
needed before it becomes functional, etc.

Since then, we have been gathering more and more HID-bus drivers,
which are full-fledged drivers. For these, the size argument becomes
more valid. Plus the devices are much more special than "just violates
HID specification in this one or two tiny unimportant points".

Therefore I am marking such drivers as properly selectable no matter
the setting of CONFIG_EMBEDDED, while keeping all the small and tiny
ones compiled by default.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-03 16:23:45 +01:00
Jiri Kosina 342f31e84e HID: make Wacom modesetting failures non-fatal
With Wacom tablet mode-setting moved from userspace into kernel,
we don't have to consider failures of device queries through the
_raw callback as hard failure, as the driver can safely continue
anyway.

This is consistent with the current USB driver in wacom_sys.c

Reported-by: Ping Cheng <pinglinux@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-03 15:52:31 +01:00
Bastien Nocera f9ce7c283c HID: Enable Sixaxis controller over Bluetooth
Now that hid_output_raw_report works, port the PS3 Sixaxis
Bluetooth quirk from user-space, into kernel-space.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-03 15:47:53 +01:00
Bastien Nocera 46a709b900 HID: Implement Wacom quirk in the kernel
The hid-wacom driver required user-space to poke at the tablet
to make it send data about the cursor location.

This patch makes it do the same thing but in the kernel.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-03 15:45:49 +01:00
Jiri Kosina d4bfa033ed HID: make raw reports possible for both feature and output reports
In commit 2da31939a4 ("Bluetooth: Implement raw output support for HIDP
layer"), support for Bluetooth hid_output_raw_report was added, but it
pushes the data to the intr socket instead of the ctrl one. This has been
fixed by 6bf8268f9a ("Bluetooth: Use the control channel for raw HID reports")

Still, it is necessary to distinguish whether the report in question should be
either FEATURE or OUTPUT. For this, we have to extend the generic HID API,
so that hid_output_raw_report() callback provides means to specify this
value so that it can be passed down to lower level hardware drivers (currently
Bluetooth and USB).

Based on original patch by Bastien Nocera <hadess@hadess.net>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-03 15:41:52 +01:00
Alex Neblett f54405db66 HID: add support for Pixart Imaging Optical Touch Screen
Added support for the Pixart Imaging Inc. Optical Touch Screen found in the MSI
AE2220 and other new all in one computers to the Quanta Optical Touch
dual-touch panel driver found in the latest git clone
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git.

Signed-off-by: Alex Neblett <alexneblett01@yahoo.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-03 12:03:26 +01:00
Jiri Kosina e1a0bdd802 Merge branch 'master' into upstream
Conflicts:
	drivers/hid/hid-ids.h
2010-02-02 23:10:39 +01:00
Thadeu Lima de Souza Cascardo 8127f4e883 HID: use multi input quirk for eTurboTouch touchscreen
This device generates ABS_Z and ABS_RX events, while it should be
generating ABS_X and ABS_Y instead. Using the MULTI_INPUT quirk solves
this issue.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Daniel Oliveira Nascimento <don@syst.com.br>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-02 23:05:38 +01:00
Alexander Shishkin 1c3a02c215 HID: add NOGET quirk for Prodige Cordless Combo
I happen to own a keyboard identified as 05af:3062 which is labeled as
"FlatX Coldless Combo" by "Prodige", which exhibits input problems without
NOGET quirk. For some reason, lsusb reports this device as "Jing-Mold
Enterprise Co., Ltd", which is not mentioned anywhere on the package.
A quick search on the intenet shows that there a other people who have
this in their lsusb output, but apparently they don't have the problem
I am seeing (or they are not such furious typists as myself).

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-02 21:30:34 +01:00
Jiri Kosina 7d39e84991 HID: update copyright
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-02 20:46:34 +01:00
Johnathon Harris cd9ec30da5 HID: add support for Ortek WKB-2000
This patch adds a new USB HID driver for the Ortek WKB-2000, working around an
incorrect LogicalMaximum value in the USB resource descriptor.

Tracked by http://bugzilla.kernel.org/show_bug.cgi?id=14787
Bug originally reported by Ubuntu users: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/405390

Signed-off-by: Johnathon Harris <jmharris@gmail.com>
Tested-by: Daniel J Blueman <daniel.blueman@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-26 01:57:35 +01:00
H Hartley Sweeten 62e62da856 HID: hid-debug.c: make local symbols static
hid-debug.c: make local symbols static

The symbols hid_resolv_event and hid_dump_input_mapping
are only used locally in this file. Make them static to prevent
the following sparse warnings:

warning: symbol 'hid_resolv_event' was not declared. Should it be static?
warning: symbol 'hid_dump_input_mapping' was not declared. Should it be static?

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-15 11:38:51 +01:00
Linus Torvalds 8866f9df4a Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: wacom: Add BTN_TOOL_FINGER for pad button reporting
  HID: add device IDs for new model of Apple Wireless Keyboard
  HID: fix pad button definition in hid-wacom
  HID: Support 171 byte variant of Samsung USB IR receiver
  HID: blacklist ET&T TC5UH touchscreen controller
2010-01-13 16:10:13 -08:00
Jiri Kosina 4bb9508bbb HID: remove TENX iBuddy from blacklist
There were multiple reports which indicate that vendor messed up horribly
and the same VID/PID combination is used for completely different devices,
some of them requiring the blacklist entry and other not.

Remove the blacklist entry for this combination of VID/PID completely, and let
the user decide and unbind the driver via sysfs eventually, if needed. Proper
fix would be fixing the vendor.

References:

http://lkml.org/lkml/2009/2/10/434
http://bugzilla.kernel.org/show_bug.cgi?id=13411

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-13 12:00:43 +01:00
Przemo Firszt 0e253fdb3b HID: wacom: Add BTN_TOOL_FINGER for pad button reporting
Without this patch xf86-input-wacom driver wasn't able to properly recognise
pad button events. It was also causing some problems with button mapping.

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-13 12:00:33 +01:00
Christian Schuerer-Waldheim 23aeb61e7e HID: add device IDs for new model of Apple Wireless Keyboard
Added device IDs for the new model of the Apple Wireless Keyboard
(November 2009).

Signed-off-by: Christian Schuerer-Waldheim <csw@xray.at>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-13 12:00:33 +01:00
Przemo Firszt d01799b2f3 HID: fix pad button definition in hid-wacom
This fix is required for xorg driver to recognise 2 pad buttons

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-13 12:00:32 +01:00
Stephane Chatty 49e4739a0c HID: add support for Acer T230H multitouch
Add support for the Quanta Optical Touch dual-touch panel, present in the Acer
T230H monitor, HP L2105tm, and Packard-Bell Video 200t.

Signed-off-by: Stephane Chatty <chatty@enac.fr>
Tested-by: Jerome Vidal <jerom3@free.fr>
Tested-by: Cedric Berthier <berthiec@gmail.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-13 00:29:16 +01:00
Gary Stein 74f292ca8c HID: add driver for the Logitech Flight System G940
Implements a new USB-HID for Force Feedback based on the normal
Logitech Force Feedback code and FF-Memless.

Currently only supports the FF_CONSTANT effect although the joystick
appears to support additional non-standard ones.

Signed-off-by: Gary Stein <LordCnidarian@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-13 00:26:31 +01:00
Márton Németh d67dec5b2c HID: make USB device id constant
The id_table field of the struct usb_device_id is constant in <linux/usb.h>
so it is worth to make the initialization data also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
	struct I1 {
	  ...
	  const struct I2 *x;
	  ...
	};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
	struct I1 y = {
	  .x = E,
	};
@c@
identifier r.I2;
identifier s.E;
@@
	const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+	const
	struct I2 E[] = ...;
// </smpl>

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-12 14:34:43 +01:00
Stefan Glasenhardt 54a6593d65 HID: allow disabling hard-coded ISO-layout for Apple keyboards
This patch adds a new option named "iso_layout" to the driver
"hid-apple.ko", to allow disabling of the hard-coded ISO-layout.

Disabling the hard-coded layout solves the problem that the kernel-module only
works perfectly for the english/american version of the Apple aluminum
keyboard. Other versions have swapped keys, e.g. the "<"-key  is swapped with
"^"-key on the german keyboard. There is a very long bug-entry on Launchpad to
this problem:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/214786

Signed-off-by: Stefan Glasenhardt <stefan@glasen-hardt.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-06 11:21:37 +01:00
Jiri Kosina 722612cd51 HID: fix parsing of local delimiter with size 0
Acording to HID standard 1.11, value 0 allows for size being 0.
Local delimiter tag has has 0 one of the possible values.

Therefore we need to handle this case properly, to be fully compliant
with the specification.

Reported-by: Marcin Tolysz <tolysz@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-05 11:45:52 +01:00
Jiri Kosina cf2f765f18 HID: handle joysticks with large number of buttons
Current HID code doesn't properly handle HID joysticks which have
larger number of buttons than what fits into current range reserved
for BTN_JOYSTICK.

One such joystick reported to not work properly is Saitek X52 Pro
Flight System.

We can't extend the range to fit more buttons in, because of backwards
compatibility reasons.

Therefore this patch introduces a new BTN_TRIGGER_HAPPY range, and
uses these to map the buttons which are over BTN_JOYSTICK limit.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> [for the input.h part]
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-04 12:20:56 +01:00
Jiri Kosina 92688c0c3c HID: make Stantum driver standalone config option
Analogically to commit "HID: make 3M PCT touchscreen driver
standalone config option", remove the dependency of Stantum
driver on CONFIG_EMBEDDED, as it is a standalone driver rather
than device quirk.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-04 12:04:59 +01:00
Stephane Chatty d3fb5454a8 HID: add support for Stantum multitouch panel
Added support for the Stantum multitouch panel.

Signed-off-by: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-01-04 12:04:08 +01:00
Jiri Kosina 4b186f7203 HID: make 3M PCT touchscreen driver standalone config option
The point behind 'default !EMBEDDED' for certain HID drivers that simple and
straightforward quirks for HID devices (which are implemented as drivers on
HID bus) wouldn't have to be enabled separately, if the device is otherwise
more-or-less HID standard compliant.

But this driver is rather standalone driver, so we'd want to have it normally
selectable.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-23 13:21:34 +01:00
Stephane Chatty b6353f4f36 HID: Support for 3M multitouch panel
Add support for 3M multitouch panels.

Signed-off-by: Stephane Chatty <chatty@enac.fr>
[jkosina@suse.cz: fix build failure because of inconsistent 3M/MMM defines]
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-23 01:28:37 +01:00
Sam Ravnborg 98b8788ae9 drop explicit include of autoconf.h
kbuild.h forces include of autoconf.h on the
commandline using -include - so we do not need to
include the file explicit.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2009-12-12 13:08:15 +01:00
Alan Stern fb34d53752 USB: remove the auto_pm flag
This patch (as1302) removes the auto_pm flag from struct usb_device.
The flag's only purpose was to distinguish between autosuspends and
external suspends, but that information is now available in the
pm_message_t argument passed to suspend methods.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-12-11 11:55:21 -08:00
Robert Schedel 3975bc5630 HID: Support 171 byte variant of Samsung USB IR receiver
Extends the existing Samsung USB IrDA (0419:0001) quirk with newly reported 171
byte variant. It needs the same quirk as the other devices already supported
by hid-samsung (wrong logical range)

Refactors duplicate trace call into local helper function.

The original bug report for the new variant is available at the second half of
this ticket page:

  https://bugs.launchpad.net/bugs/326986

Signed-off-by: Robert Schedel <r.schedel@yahoo.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-11 10:59:02 +01:00
Petr Štetiar 70c66567d1 HID: blacklist ET&T TC5UH touchscreen controller
This patch adds ET&T TC5UH touchscreen controller to HID blacklist,
because this device is handled by input/usbtouchscreen driver.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-10 12:19:39 +01:00
Linus Torvalds fa395aaec8 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (51 commits)
  Input: appletouch - give up maintainership
  Input: dm355evm_kbd - switch to using sparse keymap library
  Input: wistron_btns - switch to using sparse keymap library
  Input: add generic support for sparse keymaps
  Input: fix memory leak in force feedback core
  Input: wistron - remove identification strings from DMI table
  Input: psmouse - remove identification strings from DMI tables
  Input: atkbd - remove identification strings from DMI table
  Input: i8042 - remove identification strings from DMI tables
  DMI: allow omitting ident strings in DMI tables
  Input: psmouse - do not carry DMI data around
  Input: matrix-keypad - switch to using dev_pm_ops
  Input: keyboard - fix lack of locking when traversing handler->h_list
  Input: gpio_keys - scan gpio state at probe and resume time
  Input: keyboard - add locking around event handling
  Input: usbtouchscreen - add support for ET&T TC5UH touchscreen controller
  Input: xpad - add two new Xbox 360 devices
  Input: polled device - do not start polling if interval is zero
  Input: polled device - schedule first poll immediately
  Input: add S3C24XX touchscreen driver
  ...
2009-12-09 19:52:01 -08:00
Jiri Kosina 447753d977 Merge branches 'bkl-removal', 'upstream' and 'upstream-fixes' into for-linus 2009-12-07 18:30:49 +01:00
Peter Hutterer 9db630b48a HID: add multi-input quirk for NextWindow Touchscreen.
These touchscreens are mounted onto HP TouchSmart and the Dell Studio One
19. Without a quirk they report a wrong button set and the x/y coordinates
through ABS_Z/ABS_RX, confusing the higher levels (most notably X.Org's
evdev driver).

Device id 0x003 covers models 1900, 2150, and 2700 [1] though testing could
only be performed on a model 1900.

[1] http://www.nextwindow.com/nextwindow_support/latest_tech_info.html

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-03 10:51:32 +01:00
Jiri Kosina e8d0eab4d9 HID: add support for Acan FG-8100 barcode reader
Acan FG-8100 barcode reader (0x04b4/0xbca1) has vendor ID of
cypress and requires the same MIN/MAX swap descriptor quirk
as other barcode readers from cypress.

Reported-by: Stijn Ghesquiere <stijn@applesnail.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-02 22:54:11 +01:00
Jiri Kosina 66d61bec69 HID: make Media key on Logitech DiNovo Mini work
Put proper mapping of Media key on Logitech DiNovo Mini.

According to the specification from Logitech webpage, this
key is intended to launch a Media center.

Reported-by: Stefan Plattner <Stefan.Plattner@ilogs.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-11-25 16:20:52 +01:00
Márton Németh 6236dfaa90 Input: do not overwrite the first part of phys string
Use strlcat() to append a string to the previously created first part.

Signed-off-by: Márton Németh <nm127@freemail.hu>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2009-11-23 08:50:52 -08:00
Jiri Kosina 24985cf686 HID: support Logitech/3DConnexion SpaceTraveler and SpaceNavigator
These devices wrongly report their axes as relative instead of absolute.

Fix this in up report descriptor of the device before it enters the parser.

Reported-by: simon.windows@gmail.com
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-11-13 10:45:53 +01:00
Jiri Kosina 6c85773043 HID: remove BKL from hiddev_ioctl_usage()
The race between ioctl and disconnect is guarded by low level
hiddev device mutex (existancelock) since the commit
07903407 ("HID: hiddev cleanup -- handle all error conditions
properly"), therefore we can remove the lock_kernel() from
hiddev_ioctl_usage().

Acked-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-11-05 18:59:03 +01:00
Jiri Kosina 5b915d9e6d HID: fixup quirk for NCR devices
NCR devices are terminally broken by design -- they claim themselves to contain
proper input applications in their HID report descriptor, but behave very badly
if treated in standard way.

According to NCR developers, the devices get confused when queried for reports
in a standard way, rendering them unusable.

NCR is shipping application called "RPSL" that can be used to drive these
devices through hiddev, under the assumption that in-kernel driver doesn't
perform initial report query.
If it does, neither in-kernel nor hiddev-based driver can operate with these
devices any more.

Introduce a quirk that skips the report query for all NCR devices. The previous
NOGET quirk was wrong and had been introduced because I misunderstood the nature
of brokenness of these devices.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-11-05 14:08:03 +01:00
Anssi Hannula 1168df7e1c HID: pidff - fix unnecessary loop iterations on reset
When encountering a strange value in the pool report, pidff_reset
will always refetch the report 20 times, even if one of the retries
results in a sane value. This is because a temporary variable being
used to store the value is not being updated inside the loop.

Fix it by using the value directly in the loop.

Reported-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-11-04 10:04:08 +01:00
Keith Rutkowski 73cdcf567a HID: add NOGET quirk for another device from CH Products
This patch was applied to Fedora 11's 2.6.30.8-64 kernel and adds the
NOGET quirk for CH Products industrial class joystick(s).  It is like
the previous CH Products NOGET quirk patch for their consumer class
joysticks.  Without the quirk, the joystick would only be detected and
would not function at all in kernels >= 2.6.29.  It was tested with a CH
Products 3-axis 5-button industrial joystick, product #HG-434IS000-U-217.

Signed-off-by: Keith Rutkowski <rutkowski@signatureresearchinc.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-10-20 02:33:10 +02:00
Jiri Kosina ccabcd2dbe HID: remove useless DRIVER_VERSION macro
DRIVER_VERSION has no use whatosoever, it has been set to "2.6"
for ages. Remove it.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-10-13 22:36:57 +02:00
Jiri Kosina 88adb72bcf HID: fix MODULE_AUTHOR usage in HID modules
Remove unused (in usbhid module) DRIVER_AUTHOR macrco and properly
use multiple MODULE_AUTHOR() instances in both modules.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-10-13 22:36:57 +02:00
Lamarque Vieira Souza eb8141ccd3 HID: blacklist Acer Ferrari 4005 optical mouse
Marks Acer Bluetooth Optical Rechargeable Mouse from Ferrari 4005 notebook to
be ignored by hid core. This change makes hid core to use input session instead
of hid session with that mouse. With hid session the mouse cursor moves too
laggy, using input session corrects this problem.

Signed-off-by: Lamarque V. Souza <lamarque@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-10-13 22:36:56 +02:00
Linus Torvalds 03266d28ca Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: fix possible deadlock in hidraw_read
  HID: fix kerneldoc comment for hid_input_report()
  HID: add __init/__exit macros to twinhan.c
2009-10-13 10:10:33 -07:00
Jiri Kosina b0e14951ee HID: fix possible deadlock in hidraw_read
If the loop in hidraw_read() loops more than once, then we might
end up trying to acquire already locked mutex, casuing a deadlock.

Reported-by: iceberg <iceberg@ispras.ru>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-10-12 11:25:56 +02:00
Alexey Dobriyan a99bbaf5ee headers: remove sched.h from poll.h
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-10-04 15:05:10 -07:00
Jiri Kosina ff9b00a226 HID: fix kerneldoc comment for hid_input_report()
The kerneldoc comment for 'interrupt' has already confused a lot
of people, as it is simply wrong. It doesn't carry the information
about the context, but is used to distinguish between two fundamental
types of low-level transport transfers -- interrupt vs. control.

Make this clear in the comment.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-10-01 16:03:13 +02:00
Peter Huewe fa59530267 HID: add __init/__exit macros to twinhan.c
Trivial patch which adds the __init/__exit macros to the module_init/
module_exit functions of the twinhan driver in hid.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-09-29 13:58:20 +02:00
Linus Torvalds 50223e486c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: Remove duplicate Kconfig entry
  HID: consolidate connect and disconnect into core code
  HID: fix non-atomic allocation in hid_input_report
2009-09-22 07:51:28 -07:00
Kay Sievers e454cea20b Driver-Core: extend devnode callbacks to provide permissions
This allows subsytems to provide devtmpfs with non-default permissions
for the device node. Instead of the default mode of 0600, null, zero,
random, urandom, full, tty, ptmx now have a mode of 0666, which allows
non-privileged processes to access standard device nodes in case no
other userspace process applies the expected permissions.

This also fixes a wrong assignment in pktcdvd and a checkpatch.pl complain.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-19 12:50:38 -07:00
Alessandro Guido a2d693cf65 HID: Remove duplicate Kconfig entry
Signed-off-by: Alessandro Guido <ag@alessandroguido.name>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-09-17 15:47:26 +02:00
Jiri Kosina c4c259bcc2 HID: consolidate connect and disconnect into core code
HID core registers input, hidraw and hiddev devices, but leaves
unregistering it up to the individual driver, which is not really nice.
Let's move all the logic to the core.

Reported-by: Marcel Holtmann <marcel@holtmann.org>
Reported-by: Brian Rogers <brian@xyzw.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-09-17 15:15:11 +02:00
Jiri Kosina d1ff65226c HID: fix non-atomic allocation in hid_input_report
'interrupt' variable can't be used to safely determine whether
we are running in atomic context or not, as we might be called from
during control transfer completion through hid_ctrl() in atomic
context with interrupt == 0.

Reported-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-09-15 12:31:06 +02:00
Jiri Kosina 8123e8f7c8 Merge branches 'upstream', 'upstream-fixes' and 'debugfs' into for-linus 2009-09-13 20:09:41 +02:00
Jan Scholz 42960a1300 HID: completely remove apple mightymouse from blacklist
Commit fa047e4f6f "HID: fix inverted
wheel for bluetooth version of apple mighty mouse" is incomplete. If
we remove Apple MightyMouse (bluetooth version) from the list of
apple_devices in drivers/hid/hid-apple.c we have to remove it from
hid_blacklist in drivers/hid/hid-core.c as well.

Signed-off-by: Jan Scholz <Scholz@fias.uni-frankfurt.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-08-26 13:18:51 +02:00
Jiri Kosina affbb8c6e6 HID: support larger reports than 64 bytes in hiddev
hiddev userspace driver uses a rignbuffer to store the parsed usages
that should be returned through read(). This buffer is 64 bytes long,
which is sufficient for queueing single USB 1.0 low-speed report, which
is of maximum size 48 bytes.

There are however USB HID devices which are full-speed USB devices, and
therefore they are free to produce reports 64 bytes long. This is correctly
handled by HID core, but read() on hiddev node gets stuck forever, because
the ring buffer loops infinitely (as it is exactly 64 bytes long as well),
never advancing the buffer pointer.

Plus, the core driver is ready to handle highspeed devices, so we should be
able to handle reports from such devices in the hiddev driver as well, which
means we need larger ringbuffer.

Reported-by: Michael Zeisel <michael.zeisel@philips.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-08-20 12:04:14 +02:00
H Hartley Sweeten 52cfc61bf9 HID: local function should be static
__usbhid_submit_report() is a local function wrapped by the exported
symbol usbhid_submit_report(). As such, it should be static.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc:  Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-08-18 13:57:10 +02:00
Henning Glawe 4cfae3e804 HID: ignore Philips IEEE802.15.4 RF Dongle
This usb device claims to be of HID class, but is in fact a 802.15.4
lowpan transceiver, therefore the generic HID driver cannot operate this
device. A separate driver for this device will be written for this using
the new 802.15.4 stack.

Signed-off-by: Henning Glawe <glaweh@debian.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-08-08 11:56:11 +02:00
Jarod Wilson 31f7fd795d HID: ignore all recent SoundGraph iMON devices
After some inspection of the Windows iMON driver, several additional
device IDs were added to the lirc_imon driver. At least a few of these
have been seen in the wild, and require manual quirking to keep the
usbhid driver from binding to them. Rather than list out every single
device, ignore the entire device ID range, 0x0034 - 0x0046. Some of
these may not advertise themselves as HID devices, but no harm done to
such devices anyway. Does the right thing in brief testing w/my 0x0045
device.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-08-08 11:55:46 +02:00
Julia Lawall a809dda036 HID: fix memory leak on error patch in debug code
Error handling code following a kzalloc should free the allocated data.

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l;
position p1,p2;
expression *ptr != NULL;
@@

x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
     when != if (...) { <+...x...+> }
(
x->f1 = E
|
 (x->f1 == NULL || ...)
|
 f(...,x->f1,...)
)
...>
(
 return \(0\|<+...x...+>\|ptr\);
|
 return@p2 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-08-08 02:26:10 +02:00
Roel Kluin 44cb2db10d HID: fix overrun in quirks initialization
Check whether index is within bounds before testing the element.

declared in drivers/hid/usbhid/hid-core.c:62:
static char *quirks_param[MAX_USBHID_BOOT_QUIRKS] = ...

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-08-08 02:17:32 +02:00
Julia Lawall 3040c8203d HID: Drop NULL test on list_entry result
list_entry, which is an alias for container_of, cannot return NULL, as
there is no way to add a NULL value to a doubly linked list.

A simplified version of the semantic match that findds this problem is as
follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r@
expression x,E;
statement S1,S2;
position p,p1;
@@

*x = list_entry@p(...)
... when != x = E
*if@p1 (x == NULL) S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-07-23 01:28:02 +02:00
Bruno Premont 711a680e35 HID: driver for Twinhan USB 6253:0100 remote control
Add explicit key mappings for TwinHan USB HID remote control.

All dummy Ctrl, Alt, Meta, ... key press/release events generated
by the remote are silenced by "unmapping" them. This makes Power and
Volume keys single-key and strips the regular (even while idle) key
release events for Ctrl, Alt, Meta, ...

Signed-off-by: Bruno Premont <bonbons@linux-vserver.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-07-23 01:28:01 +02:00
Peter Huewe a24f423bdf HID: adding __init/__exit macros to module init/exit functions
Trivial patch which adds the __init and __exit macros to the module_init /
module_exit functions of several HID drivers from drivers/hid/

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-07-23 01:28:01 +02:00
Ruben Aos Garralda 7a84b1336a HID: add rumble support for Thrustmaster Dual Trigger 3-in-1
This patch enables rumble in Thrustmaster Dual 3-in-1 trigger gamepads (in both
PC and PS3 modes).  It uses the same code as Thrustmaster FireStorm Dual Power 2,
so it only adds new USB IDs to hid-core.c and hid-tmff.c

Signed-off-by: Ruben Aos Garralda <rubenatch@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-07-23 01:28:01 +02:00
Rafi Rubin 837b47533a HID: ntrig tool separation and pen usages
When both touch and pen are active send a tool announcement before
sending any status changes so that event users may differentiate
which tool is changing.

Restored three usage codes used by the pen.

Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
Acked-by: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-07-23 01:28:01 +02:00
Sergey Senozhatsky 8b424887b6 HID: Avoid double spin_lock_init on usbhid->lock
Avoid double spin_lock_init on usbhid->lock.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@mail.by>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-07-23 01:28:00 +02:00
Jiri Kosina fd30ea8c87 HID: add force feedback support for Logitech WingMan Formula Force GP
Add force feedback support for Logitech WingMan Formula Force GP
(0x046d/0xc293).

Reported-by: wylda@volny.cz
Tested-by: wylda@volny.cz
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-07-23 01:28:00 +02:00
Robert Schedel 0810b51170 HID: Support new variants of Samsung USB IR receiver (0419:0001)
This patch extends the existing Samsung IrDA (0419:0001) quirk file with newly
reported variants:

* New device variants with 203 byte and 135 byte report descriptors were
  reported to be recognized incorrectly. This patch adds an autodetection for
  those two, using report descriptor size to enable new quirks.

* Any other unknown 0419:0001 variants will now be treated without any quirk
  flags (i.e. IGNORE_HIDINPUT/HIDDEV_FORCE will not be set by default anymore).

More details:

1. Descriptor size 184 bytes ("Satelco bundled remote")
Already supported since kernel 2.6.25 (my old patch).

2. Descriptor size 203 bytes ("Optronix remote")
This receiver mostly works with the regular HID input driver. Only when some
keys are released, another spurious key press event is interpreted due to
incorrect array ranges. According to HID 1.11, section 6.2.2.5, arrays should
return a 0 value when no control is asserted, and ranges should go from 1 to
the number of elements. The patch clips the value with a logical range from
1..15 (instead of originally 0..18).

Ticket with more information available at
https://bugs.launchpad.net/bugs/326986

3. Descriptor size 135 bytes ("Gotview remote")
This receiver has a similar issue than the previous one, i.e. it mostly works
with regular HID input, except some key press events get stuck on key release.
The patch clips the array value from 1..14 (instead of originally 0..17).

Ticket with more information available at
http://bugs.archlinux.org/task/15216

4. Other unknown variants (found one report with 218 bytes,
   but no further information about issues)

For such unknown variants we should refrain from changing any device flags.
Currently, HIDINPUT is suppressed and HIDDEV is enforced (because in 2.6.25 the
quirk table did not yet allow differentiating variants and we
did not expect variants either). Now we should be as strict as
possible and enable it only for the first variant above.

Signed-off-by: Robert Schedel <r.schedel@yahoo.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-07-23 01:27:59 +02:00
Linus Torvalds 1fd1f28536 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: Move dereferences below a NULL test
  HID: hiddev, fix lock imbalance
2009-07-22 09:30:07 -07:00
Julia Lawall 76c317d6e5 HID: Move dereferences below a NULL test
If the NULL test is necessary, then the dereferences should be moved below
the NULL test.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
type T;
expression E,E1;
identifier i,fld;
statement S;
@@

- T i = E->fld;
+ T i;
  ... when != E=E1
      when != i
  if (E == NULL||...) S
+ i = E->fld;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-07-20 00:03:35 +02:00
Alexey Dobriyan 405f55712d headers: smp_lock.h redux
* Remove smp_lock.h from files which don't need it (including some headers!)
* Add smp_lock.h to files which do need it
* Make smp_lock.h include conditional in hardirq.h
  It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

  This will make hardirq.h inclusion cheaper for every PREEMPT=n config
  (which includes allmodconfig/allyesconfig, BTW)

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-07-12 12:22:34 -07:00
Jiri Kosina 55dba52458 HID: fix memory leak on error path in debug code
If hid_get_report() fails, we forgot to free the already allocated buffer
for debugging messages on error path. Fix that up.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-06-26 10:50:12 +02:00
Jiri Slaby 4859484b09 HID: hiddev, fix lock imbalance
Add omitted BKL to one switch/case.

Cc: Stable <stable@kernel.org>
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-06-22 11:01:06 +02:00
Kay Sievers f7a386c5b8 Driver Core: usb: add nodename support for usb drivers.
This adds support for USB drivers to report their requested nodename to
userspace.  It also updates a number of USB drivers to provide the
needed subdirectory and device name to be used for them.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-06-15 21:30:25 -07:00
Jiri Kosina 6341de0527 Merge branches 'upstream' and 'ntrig-multitouch' into for-linus 2009-06-12 17:42:13 +02:00
Jiri Kosina cd667ce247 HID: use debugfs for events/reports dumping
This is a followup patch to the one implemeting rdesc representation in debugfs
rather than being dependent on compile-time CONFIG_HID_DEBUG setting.

The API of the appropriate formatting functions is slightly modified -- if
they are passed seq_file pointer, the one-shot output for 'rdesc' file mode
is used, and therefore the message is formatted into the corresponding seq_file
immediately.

Otherwise the called function allocated a new buffer, formats the text into the
buffer and returns the pointer to it, so that it can be queued into the ring-buffer
of the processess blocked waiting on input on 'events' file in debugfs.

'debug' parameter to the 'hid' module is now used solely for the prupose of inetrnal
driver state debugging (parser, transport, etc).

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-06-12 15:20:57 +02:00
Jiri Kosina a635f9dd83 HID: use debugfs for report dumping descriptor
It is a little bit inconvenient for people who have some non-standard
HID hardware (usually violating the HID specification) to have to
recompile kernel with CONFIG_HID_DEBUG to be able to see kernel's perspective
of the HID report descriptor and observe the parsed events. Plus the messages
are then mixed up inconveniently with the rest of the dmesg stuff.

This patch implements /sys/kernel/debug/hid/<device>/rdesc file, which
represents the kernel's view of report descriptor (both the raw report
descriptor data and parsed contents).

With all the device-specific debug data being available through debugfs, there
is no need for keeping CONFIG_HID_DEBUG, as the 'debug' parameter to the
hid module will now only output only driver-specific debugging options, which has
absolutely minimal memory footprint, just a few error messages and one global
flag (hid_debug).

We use the current set of output formatting functions. The ones that need to be
used both for one-shot rdesc seq_file and also for continuous flow of data
(individual reports, as being sent by the device) distinguish according to the
passed seq_file parameter, and if it is NULL, it still output to kernel ringbuffer,
otherwise the corresponding seq_file is used for output.

The format of the output is preserved.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-06-12 15:20:55 +02:00
Jiri Kosina fa047e4f6f HID: fix inverted wheel for bluetooth version of apple mighty mouse
Bluetooth version of Apple Mighty mouse (0x05ac/0x030c) doesn't, according to
multiple reports on linux-input@, need the same quirk as the USB version of
this mouse (0x05ac/0x0304) does.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-06-10 10:25:56 +02:00
Jiri Kosina 70fa9f2ead HID: no more reinitializtion is needed in post_reset
No more reinitialization is needed in the post reset hook, remove
the FIXME comment.

While at it, clean up whitespaces in the immediate surrounding.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-06-04 15:48:38 +02:00
Jiri Kosina bbe281fad6 HID: hidraw -- fix comment about accepted devices
hidraw accepts any devices, no matter if the device has
already been claimed by other HID driver (hid-input, hidraw), and
this is intended to stay. Fix up the comment to reflect reality.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-06-04 15:44:25 +02:00
Stephane Chatty 57fd637ad9 HID: Multitouch support for the N-Trig touchscreen
Adds support for multitouch interaction on the N-Trig touchscreen, using the
new ABS_MT_* input constants. Single touch support works as previously. This
code was tested against two versions of the N- Trig firmware: one that supports
dual pen/finger single touch, and one that supports finger multitouch but no
pen at all. Copyright notices that looked wrong were removed, as it seems that
there is only code written in 2009 by Rafin Rubin and Stephane Chatty in this
file.

Signed-off-by: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-05-20 15:49:35 +02:00
Stephane Chatty 89f536ccfa HID: add new multitouch and digitizer contants
Added constants to hid.h for all digitizer usages (including the new multitouch
ones that are not yet in the official USB spec but are being pushed by Microsft
as described in their paper "Digitizer Drivers for Windows Touch and Pen-Based
Computers"). Updated hid-debug.c to support the new MT input constants such as
ABS_MT_POSITION_X.

Signed-off-by: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-05-20 15:48:35 +02:00
Sergey Belyashov f0bca45982 HID: autocentering support for Logitech Force 3D Pro
This patch adds autocentering support for Logitech Force 3D Pro.

Signed-off-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-05-15 16:05:57 +02:00
Jiri Kosina 0f6f4319a7 HID: fix hid-ff drivers so that devices work even without ff support
Currently, the hid-*ff force feedback drivers, which claim the blacklisted
device on a HID bus, are only compiled in if the user selects force feedback
support.

However we want the device to be supported even when the kernel is configured
without force feedback.

This patch fixes the drivers in a way that they get compiled even if force
feedback is turned off; all the force feedback support code is compiled out in
such case, and the driver works as a usual driver on HID bus, claiming and
initializing the device, making it operational without FF effects.

Reported-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-05-15 15:51:36 +02:00
Jussi Kivilinna fac733f029 HID: force feedback support for SmartJoy PLUS PS2/USB adapter
This driver adds force feedback support for SmartJoy PLUS PS2/USB adapter. I
made this driver one device spesific instead of making generic 'wisegroup-ff'
because I have another Wisegroup PS2/USB adapter that doesn't work same way as
SmartJoy PLUS. If another device that is compatible pops up, this driver could
be then renamed to something more generic.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-05-15 14:28:44 +02:00
Bastien Nocera ca2dcd40f5 HID: Wacom Graphire Bluetooth driver
Based on the work by Andrew Zabolotny, an HID driver for the Bluetooth
Wacom tablet. This is required as it uses a slightly different
protocols from what's currently support by the drivers/input/wacom*
driver, and those only support USB.

A user-space patch is required to activate mode 2 of the Wacom tablet,
as hidp does not support hid_output_raw_report.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-05-13 11:42:11 +02:00
Sergey Belyashov 92e0d896ce HID: autocentering support for Logitech G25 Racing Wheel
Some months ago I send patch which adds autocentering for Logitech MOMO Wheel.
Now I have access to Logitech G25 Racing Wheel and test autocentering for it. I
write patch for current kernel to support autocentering for G25 in legacy mode
(this device supports other modes, but after switching device reconnects with
ID 0xc299 and FF support comes out) and others Logitech (Driving Force,
Formula Force Ex etc) wheels with ID 046d:c294.

Signed-off-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-05-13 11:42:11 +02:00
Alan Stern b820aabf6c HID: add NOGET quirk for devices from CH Products
This patch (as1240) adds the NOGET quirk for three devices from CH
Products: the Pro pedals, the Combatstick joystick, and the Flight-Sim
yoke.  Without these quirks, the devices haven't worked for many
kernel releases.  Sometimes replugging them after boot-up would get
them to work and sometimes they wouldn't work at all.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Sean Hildebrand <silverwraithii@gmail.com>
Reported-by: Sid Boyce <sboyce@blueyonder.co.uk>
Tested-by: Sean Hildebrand <silverwraithii@gmail.com>
Tested-by: Sid Boyce <sboyce@blueyonder.co.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-05-11 17:09:21 +02:00
Zoltan Karcagi f520899708 HID: fix dropped device-specific quirks
Device-specific quirks are set up correctly in their respective vendor-specific
driver, then get overwritten in usbhid_parse().

This is only issue for device-specific NOGET quirks being set by driver for a
few devices out there.

Signed-off-by: Zoltan Karcagi <zkr@freemail.hu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-05-11 17:09:17 +02:00
Jiri Kosina e5288eb5ea HID: fix oops in hid_check_keys_pressed()
If the device is not claimed by hid-input (i.e devices driver by userspace
hiddev/hidraw-based drivers, or completely detached from HID
and driver by libusb), we must not check the hid->inptus, as it
is not guaranteed to be initialized, as this is performed only for devices
handled by hid-input.

Reported-by: Guillaume Chazarain <guichaz@gmail.com>
Tested-by: Guillaume Chazarain <guichaz@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-05-02 00:02:57 +02:00
Oliver Neukum 89092ddd7a HID: fix possible deadlock in usbhid_close()
This patch switches usbhid_close() from flush_scheduled_work() to canceling
the outstanding work. This fixes a possible deadlock due to work taking
the mutex usbhid_close() holds. Lockdep reported the problem.

Signed-off-by: Oliver Neukum <oliver@neukum.org>

--
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-04-29 17:25:01 +02:00
Ulrich Dangel 2feaace40e HID: Fix the support for apple mini aluminium keyboard
Quirks for the apple mini keyboard was recently added but keyboard
was recognized as a powerbook keyboard. Adjusted boundary to the lowest
product id for the apple mini keyboard to get the right translation.

Signed-off-by: Ulrich Dangel <uli@spamt.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-04-29 11:55:18 +02:00
Christophe Borivant 243b706d8a HID: Add support for the G25 force feedback wheel in native mode
Add Product Id 0xc299 for the Logitech G25 force feedback wheel
The Logitech G25 force feedback wheel, is first recognize by the kernel
with the product id "0xc294". In this mode, we can't use all the axes
and buttons of the wheel.

Using a userland utility, it is possible to make the wheel switch to native
mode -- http://svn.vdrift.net/viewvc.cgi/trunk/tools/G25manage/?root=VDrift
In native mode, the wheel change its id number to "0xc299".

The packet that needs to be sent to the wheel to swtich to native mode and
change its PID is

	{ 0xf8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 }

Signed-off-by: Christophe Borivant <christophe.borivant@wanadoo.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-04-17 11:39:39 +02:00
Dan Carpenter 38089c658b HID: hidraw -- fix missing unlocks in unlocked_ioctl
There were 2 places that returned directly instead of releasing their
locks.  I sent a fix for this file earlier but ended up missing these
spots.  I think what happened is that I have improved my checker script
since then...  Or maybe I just screwed up.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-04-07 16:35:56 +02:00
Linus Torvalds 5fba0925fd Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: remove compat stuff
  HID: constify arrays of struct apple_key_translation
  HID: add support for Kye/Genius Ergo 525V
  HID: Support Apple mini aluminum keyboard
  HID: support for Kensington slimblade device
  HID: DragonRise game controller force feedback driver
  HID: add support for another version of 0e8f:0003 device in hid-pl
  HID: fix race between usb_register_dev() and hiddev_open()
  HID: bring back possibility to specify vid/pid ignore on module load
  HID: make HID_DEBUG defaults consistent
  HID: autosuspend -- fix lockup of hid on reset
  HID: hid_reset_resume() needs to be defined only when CONFIG_PM is set
  HID: fix USB HID devices after STD with autosuspend
  HID: do not try to compile PM code with CONFIG_PM unset
  HID: autosuspend support for USB HID
2009-04-03 15:25:44 -07:00
Matt LaPlante 692105b8ac trivial: fix typos/grammar errors in Kconfig texts
Signed-off-by: Matt LaPlante <kernel1@cyberdogtech.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-03-30 15:22:01 +02:00
Jiri Kosina 621de59308 Merge branch 'autosuspend' into for-next
Conflicts:

	drivers/hid/hid-core.c
2009-03-30 15:14:53 +02:00
Jiri Slaby afa5eb7c68 HID: remove compat stuff
This removal was scheduled and there is no problem with later
distros to adapt for the new bus, thanks to aliases.

module-init-tools map files are deprecated nowadays, so that
the patch which introduced hid ones into the m-i-t won't be
accepted and hence there is no reason for leaving compat stuff in.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-03-30 15:12:54 +02:00
Paul Collins b2ddd54e19 HID: constify arrays of struct apple_key_translation
Mark arrays of struct apple_key_translation const so that they may be placed in
.rodata, and adjust users to suit.

Signed-off-by: Paul Collins <paul@ondioline.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-03-30 15:12:54 +02:00
Jiri Kosina 794227415f HID: add support for Kye/Genius Ergo 525V
This device sends several buttons in a separate field, which is
wrongly described in the report descriptor. Fix it in the following
way:

- change led usage page to button
- report size 8 count 1 becomes report size 1 count 8
- the button usage range changed to 4-7 (the mouse has three buttons in
  a different field already).

Reported-by: Tomas Hanak <tomas.hanak@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-03-30 15:12:54 +02:00
Ryan Finnie fef3f571ec HID: Support Apple mini aluminum keyboard
New USB device ids and quirks for the "mini" Apple USB aluminum
keyboards released Tuesday, model A1242.  Note that while I own the ANSI
(0x021d) version and cannot verify that the ISO (0x021e) and JIS
(0x021f) versions exist, previous releases have followed the triple id
convention for awhile now, and the device ids fit perfectly between
USB_DEVICE_ID_APPLE_GEYSER4_* and USB_DEVICE_ID_APPLE_ALU_*.

Signed-off-by: Ryan Finnie <ryan@finnie.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-03-30 15:12:53 +02:00
Jiri Kosina fdf93aa332 HID: support for Kensington slimblade device
0x47d/0x2041 device sends two extra buttons in 0xff00 usage
page and therefore requires special handling.

Reported-by: Jason Noble <nobleja@polezero.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-03-30 15:12:53 +02:00
Richard Walmsley 3f866fbd52 HID: DragonRise game controller force feedback driver
Adds force feedback support for USB DragonRise Inc. game controllers.
These devices are mass produced in China and distributed under several vendors.

Signed-off-by: Richard Walmsley <richwalm@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-03-30 15:12:53 +02:00
Anssi Hannula 27a9c17930 HID: add support for another version of 0e8f:0003 device in hid-pl
Add support for another version of 0e8f:0003 device into hid-pl driver.
This device has the values in separate fields and resembles devices
handled by hid-zpff.

Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Tested-by: Pantelis Koukousoulas <pktoss@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-03-30 15:12:52 +02:00
Oliver Neukum e43bd67d72 HID: fix race between usb_register_dev() and hiddev_open()
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>
2009-03-30 15:12:52 +02:00
Jiri Kosina 6f4303fb2e HID: bring back possibility to specify vid/pid ignore on module load
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>
2009-03-30 15:12:52 +02:00
Pavel Machek 205adbec0d HID: make HID_DEBUG defaults consistent
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>
2009-03-30 15:12:51 +02:00
Linus Torvalds 8e9d208972 Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* '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
2009-03-26 16:14:02 -07:00
Oliver Neukum 6d77976800 HID: autosuspend -- fix lockup of hid on reset
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>
2009-03-25 17:57:58 +01:00
Jiri Kosina ae2f007468 HID: hid_reset_resume() needs to be defined only when CONFIG_PM is set
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>
2009-03-25 17:57:58 +01:00
Oliver Neukum 378a0ede12 HID: fix USB HID devices after STD with autosuspend
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>
2009-03-25 17:57:58 +01:00
Jiri Kosina 0f6f1407e3 HID: do not try to compile PM code with CONFIG_PM unset
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>
2009-03-25 17:57:58 +01:00
Oliver Neukum 0361a28d3f HID: autosuspend support for USB HID
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>
2009-03-25 17:57:57 +01:00
Linus Torvalds 2d8620cb88 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: fix waitqueue usage in hiddev
  HID: fix incorrect free in hiddev
2009-03-19 14:50:15 -07:00
Jonathan Corbet 60aa49243d Rationalize fasync return values
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>
2009-03-16 08:34:35 -06:00
Johannes Weiner 96fe2ab830 HID: fix waitqueue usage in hiddev
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>
2009-03-10 22:44:01 +01:00
Johannes Weiner 48e7a3c95c HID: fix incorrect free in hiddev
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>
2009-03-10 22:43:56 +01:00
Anssi Hannula daedb3d6a9 HID: move tmff and zpff devices from ignore_list to blacklist
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>
2009-02-17 13:25:01 +01:00
Dan Carpenter dfd395aff4 HID: unlock properly on error paths in hidraw_ioctl()
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>
2009-02-17 13:25:01 +01:00
Michael Tokarev 35cfd1d964 HID: blacklist Powercom USB UPS
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>
2009-02-17 13:25:01 +01:00
Jiri Kosina bae7eb33b2 HID: document difference between hid_blacklist and hid_ignore_list
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>
2009-01-29 11:23:12 +01:00
Jarod Wilson 656f1fb90a HID: add antec-branded soundgraph imon devices to blacklist
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>
2009-01-29 11:23:12 +01:00
Oliver Neukum be5d0c837c HID: fix reversed logic in disconnect testing of hiddev
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>
2009-01-29 11:23:12 +01:00
Jiri Kosina 0fb21de079 HID: adjust report descriptor fixup for MS 1028 receiver
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>
2009-01-29 11:23:11 +01:00
Linus Torvalds 7c7758f99d Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* 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
  ...
2009-01-07 15:37:24 -08:00
Jiri Kosina 7605274914 HID: fix hid->hiddev initialization in hiddev_connect()
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>
2009-01-07 11:30:57 -08:00