Commit Graph

751 Commits (d9236303d0b7ba8bbaeb6adbbf088c3fe2a9ab9e)

Author SHA1 Message Date
Benjamin Tissoires d9236303d0 HID: kernel oops in out_cleanup in function hidinput_connect
Goto out_cleanup infers a kernel oops: hidinput_disconnect calls
input_unregister_driver to all members of hid->inputs.
However, hidinput already has been added to hid->inputs even
though input_register_device was not called.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Reviewed-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-02-15 23:47:05 +01:00
Steffen Barszus 6497dc3a54 HID: Add teletext/color keys - gyration remote - EU version (GYAR3101CKDE)
This patch adds support for 5 keys which can be found
only on the EU version of the gyration remote, which has been not
mapped before.

Signed-off-by: Steffen Barszus <steffenbpunkt[AT]googlemail[DOT]com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-02-15 10:29:57 +01:00
Stefan Achatz 3a22ebe9cc HID: hidraw: fix hidraw_disconnect()
hidraw_disconnect() first sets an entry in hidraw_table to NULL
and calls device_destroy() afterwards. The thereby called
hidraw_release() tries to read this already cleared value resulting
in never removing any device from the list.
This got fixed by changing the order of events.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-02-01 11:16:51 +01:00
Linus Torvalds 8f685fbda4 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: hid-multitouch: minor fixes based on additional review
  HID: Switch turbox/mosart touchscreen to hid-mosart
  HID: add Add Cando touch screen 10.1-inch product id
  HID: hid-mulitouch: add support for the 'Sensing Win7-TwoFinger'
  HID: hid-multitouch: add support for Cypress TrueTouch panels
  HID: hid-multitouch: support for PixCir-based panels
  HID: set HID_MAX_FIELD at 128
  HID: add feature_mapping callback
2011-01-13 09:58:38 -08:00
Benjamin Tissoires 2d93666e70 HID: hid-multitouch: minor fixes based on additional review
* amended Kconfig (PixCir and Hanvon are the same panel but with
  different name)
* insert field name in mt_class and retrieving it in mt_probe
* add 2 quirks: MT_QUIRK_VALID_IS_INRANGE, MT_QUIRK_VALID_IS_CONFIDENCE,
  in order to find the field "valid"
* inlined slot_is_contactid and slot_is_contact_number
* cosmetics changes (tabs and comments)
* do not send unnecessary properties once the touch is up

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-11 21:26:56 +01:00
Benjamin Tissoires c64f6f934c HID: Switch turbox/mosart touchscreen to hid-mosart
This device used the MULTI_INPUT quirk whereas it could be used
with hid-mosart instead to support the multitouch part.

Reference: https://bugs.launchpad.net/ubuntu/+bug/620609/

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-11 21:26:55 +01:00
Benjamin Tissoires bc5ab083a6 HID: add Add Cando touch screen 10.1-inch product id
This device has been reported to be an hid-cando one.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-11 21:26:55 +01:00
Benjamin Tissoires 5572da08a7 HID: hid-mulitouch: add support for the 'Sensing Win7-TwoFinger'
Added support for the 'Sensing Win7-TwoFinger' panel by GeneralTouch found on some tablets.

Because of conflicting VID/PID, this conflicts with previous support for some
single-touch panels by GeneralTouch

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Stéphane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-11 21:26:55 +01:00
Benjamin Tissoires a3b5e577d9 HID: hid-multitouch: add support for Cypress TrueTouch panels
Added support for Cypress TrueTouch panels, which detect up to 10 fingers

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Stéphane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-11 21:26:54 +01:00
Benjamin Tissoires 5519cab477 HID: hid-multitouch: support for PixCir-based panels
Created a driver for PixCir based dual-touch panels, including the one
in the Hanvon tablet.  This is done in a code structure aimed at unifying
support for several existing HID multitouch panels.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Stéphane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-11 21:26:54 +01:00
Benjamin Tissoires 0d2689c0f0 HID: add feature_mapping callback
Currently hid doesn't export the features it knows to the specific modules.
Some information can be really important in such features: MosArt and
Cypress devices are by default not in a multitouch mode.
We have to send the value 2 on the right feature.

This patch exports to the module the features report so they can find the
right feature to set up the correct mode.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-11 21:26:53 +01:00
Linus Torvalds facc7a96d4 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: (34 commits)
  HID: roccat: Update sysfs attribute doc
  HID: roccat: don't use #pragma pack
  HID: roccat: Add support for Roccat Kone[+] v2
  HID: roccat: reduce number of functions in kone and pyra drivers
  HID: roccat: declare meaning of pack pragma usage in driver headers
  HID: roccat: use class for char device for sysfs attribute creation
  sysfs: Introducing binary attributes for struct class
  HID: hidraw: add compatibility ioctl() for 32-bit applications.
  HID: hid-picolcd: Fix memory leak in picolcd_debug_out_report()
  HID: picolcd: fix misuse of logical operation in place of bitop
  HID: usbhid: base runtime PM on modern API
  HID: replace offsets values with their corresponding BTN_* defines
  HID: hid-mosart: support suspend/resume
  HID: hid-mosart: ignore buttons report
  HID: hid-picolcd: don't use flush_scheduled_work()
  HID: simplify an index check in hid_lookup_collection
  HID: Hoist assigns from ifs
  HID: Remove superfluous __inline__
  HID: Use vzalloc for vmalloc/memset(,0...)
  HID: Add and use hid_<level>: dev_<level> equivalents
  ...
2011-01-10 08:15:37 -08:00
Jiri Kosina 4d04310189 HID: roccat: don't use #pragma pack
Replace #pragma pack ocurences with __atribute__((__packed__));

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-08 01:18:35 +01:00
Stefan Achatz 47dbdbffe1 HID: roccat: Add support for Roccat Kone[+] v2
This patch adds support for Roccat Kone[+] gaming mouse. Kone[+] is an enhanced version
of the old Kone with more memory for macros, a better sensor and more functionality.
This driver is conceptual similar to the existing Kone and Pyra drivers.
Userland tools can soon be found at http://sourceforge.net/projects/roccat

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-08 01:18:28 +01:00
Stefan Achatz 14a057f80f HID: roccat: reduce number of functions in kone and pyra drivers
The profile number is now passed via bin_attribute->private instead
of function parameter to reduce number of functions.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-08 01:11:33 +01:00
Stefan Achatz bd3a2b9663 HID: roccat: declare meaning of pack pragma usage in driver headers
Using pack pragma to prevent padding bytes in binary data structures
used for hardware communication. Explanation of these pragmas was requested.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-08 01:11:24 +01:00
Stefan Achatz 5012aada50 HID: roccat: use class for char device for sysfs attribute creation
Adding sysfs attributes to an already created device raises no userland
notification. Now the device drivers associate the devices attributes
with a class and use this for roccat event char device creation.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-08 01:11:00 +01:00
Jiri Kosina a7153258b7 Merge branches 'upstream' and 'upstream-fixes' into for-linus 2011-01-08 01:08:19 +01:00
Linus Torvalds 31b6ca0af7 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: (58 commits)
  Input: wacom_w8001 - support pen or touch only devices
  Input: wacom_w8001 - use __set_bit to set keybits
  Input: bu21013_ts - fix misuse of logical operation in place of bitop
  Input: i8042 - add Acer Aspire 5100 to the Dritek list
  Input: wacom - add support for digitizer in Lenovo W700
  Input: psmouse - disable the synaptics extension on OLPC machines
  Input: psmouse - fix up Synaptics comment
  Input: synaptics - ignore bogus mt packet
  Input: synaptics - add multi-finger and semi-mt support
  Input: synaptics - report clickpad property
  input: mt: Document interface updates
  Input: fix double equality sign in uevent
  Input: introduce device properties
  hid: egalax: Add support for Wetab (726b)
  Input: include MT library as source for kerneldoc
  MAINTAINERS: Update input-mt entry
  hid: egalax: Add support for Samsung NB30 netbook
  hid: egalax: Document the new devices in Kconfig
  hid: egalax: Add support for Wetab
  hid: egalax: Convert to MT slots
  ...

Fixed up trivial conflict in drivers/input/keyboard/Kconfig
2011-01-07 14:45:47 -08:00
Alan Ott ae5e49c79c HID: hidraw: add compatibility ioctl() for 32-bit applications.
Added the ioctl function to the compat_ioctl pointer in the file_operations
struct. Before this, some ioctls would fail for 32-bit apps on 64-bit systems.

Signed-off-by: Alan Ott <alan@signal11.us>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-04 11:21:28 +01:00
Jesper Juhl 0fbf8ed976 HID: hid-picolcd: Fix memory leak in picolcd_debug_out_report()
We have a memory leak in drivers/hid/hid-picolcd.c::picolcd_debug_out_report()
in an error path..  We are not always freeing the memory allocated to
'buff' - this patch makes sure we always kfree() what we allocate with
kmalloc() when it is no longer needed.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-01-03 00:11:30 +01:00
David Sterba 86280a2088 HID: picolcd: fix misuse of logical operation in place of bitop
CC: Bruno Prémont <bonbons@linux-vserver.org>
CC: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-27 16:38:16 +01:00
Oliver Neukum 68229689b6 HID: usbhid: base runtime PM on modern API
This patch doesn't alter functionality, but removes a dedicated kernel
thread.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Tested-by: Maulik Mankad <x0082077@ti.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-22 19:06:53 +01:00
Melchior FRANZ 73bc7d315f USB: add support for Dream Cheeky DL100B Webmail Notifier (1d34:0004)
So far the USBLED driver only supports Delcom's "USB Visual Signal
Indicator" (http://www.delcomproducts.com/products_USBLMP.asp). The
driver generates virtual files "red", "green", and "blue" under the
device's /sys/ directory, where color values can be read from and
written to.

This patch adds support for Dream Cheeky's "DL100B Webmail Notifier"
(http://www.dreamcheeky.com/webmail-notifier -- available from several
shops, such as http://www.conrad.at/ce/de/product/777048/USB-WEBMAIL).
This device isn't as pretty as Delcom's, but it's *far* cheaper, and
its 3 LEDs can be set in 32 brightness steps each. The grey envelope
contour can easily be removed, leaving a rather neutral white box (with
a few small holes), which is useful for generic signalling purposes.
Of course, the small circuit board can easily be put into a prettier
case.

The DL100B device pretends to be a HID, but the HID descriptor shows
that it's not overly useful as such (see below). The patch therefore
removes the "HID-ness" (hid-core.c, hid-ids.h), and adds the necessary
commands to usbled.c. The protocol info comes from the developer's
manual that Dream Cheeky kindly provided (815DeveloperManual.pdf).

HID descriptor:

  0: 05 01   Usage Page 'Generic Desktop Controls'
  2: 09 10   Usage 'Reserved'
  4: a1 01   Collection 'Application (mouse, keyboard)'
  6: 05 00           Usage Page 'Undefined'
  8: 19 10           Usage Minimum = 16
 10: 29 11           Usage Maximum = 17
 12: 15 00           Logical Minimum = 0
 14: 25 0f           Logical Maximum = 15
 16: 75 08           Report Size = 8
 18: 95 08           Report Count = 8
 20: 91 02           Output data *var abs lin pref-state null-pos non-vol bit-field
 22: 19 10           Usage Minimum = 16
 24: 29 11           Usage Maximum = 17
 26: 15 00           Logical Minimum = 0
 28: 25 0f           Logical Maximum = 15
 30: 75 08           Report Size = 8
 32: 95 08           Report Count = 8
 34: 81 00           Input data array abs lin pref-state null-pos non-vol bit-field
 36: c0      End Collection

Signed-off-by: Melchior FRANZ <mfranz@aon.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-12-21 20:48:21 -08:00
Andy Ross 4dd295a73e hid: egalax: Add support for Wetab (726b)
This patch adds support for another Wetab device (726b), and grabs it
accordingly in hid-core.

[rydberg@euromail.se: rename and log message changes]
Signed-off-by: Andy Ross <andy@plausible.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-18 09:25:48 +01:00
Richard Nauber 28906ad6d7 hid: egalax: Add support for Samsung NB30 netbook
The Samsung NB30 touch has a DWAV dual-touch device. This patch adds
the NB30 to the list of supported devices, and grabs it accordingly in
hid-core.

[rydberg@euromail.se: rename and log message changes]
Signed-off-by: Richard Nauber <Richard.Nauber@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-16 11:32:21 +01:00
Henrik Rydberg e12b355b57 hid: egalax: Document the new devices in Kconfig
Add the new supported devices to the kernel menu config help text.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-16 11:32:21 +01:00
Henrik Rydberg 4e93db23bf hid: egalax: Add support for Wetab
The Wetab tablet dual-touch controller works the same way as the one
in the Joojoo tablet. This patch adds the Wetab to the list of
supported devices, and grabs it accordingly in hid-core.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-16 10:44:01 +01:00
Henrik Rydberg f7bc8046b3 hid: egalax: Convert to MT slots
The firmware in the joojoo reports touches sequentially, one per
report, which confuses the current driver. A further complication is
the absense of any indication of a touch frame. This patch converts
the driver to the MT slots protocol, and outputs one full touch frame
per report. This way, proper handling for both firmwares is ensured.

Tested-by: Philipp Merkel <mail@philmerk.de>
Cc: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-16 10:43:53 +01:00
Henrik Rydberg 17c760687f hid: egalax: Add event filtering
Use estimated signal-to-noise ratios to reduce noise and limit the
amount of events emitted.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-16 10:43:46 +01:00
Henrik Rydberg 80a469e4f4 hid: egalax: Report zero as minimum pressure
The firmware reports a logical minimum of one, but in order for
userspace applications to correctly map all reported values to
non-zero pressure, the driver needs to report a logical minimum of
zero.  Fixed with this patch.

Tested-by: Philipp Merkel <mail@philmerk.de>
Cc: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-16 10:43:37 +01:00
Henrik Rydberg b88cbd3a00 hid: egalax: Correct for device resolution report error
The firmware of both supported devices report a X/Y maximum of 4095,
whereas in reality, it is eight times larger. Fixed with this patch.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-16 10:43:27 +01:00
Henrik Rydberg 4a864183fb hid: egalax: Setup input device manually
The hid core does not yet handle input filtering. Take over the setup
of the input device, so that proper signal-to-noise ratios can be
used.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Stephane Chatty <chatty@enac.fr>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-16 10:43:18 +01:00
Henrik Rydberg c5f4dec1ce input: mt: Move tracking and pointer emulation to input-mt
The drivers using the type B protocol all report tracking information
the same way. The contact id is semantically equivalent to
ABS_MT_SLOT, and the handling of ABS_MT_TRACKING_ID only complicates
the driver. The situation can be improved upon by providing a common
pointer emulation code, thereby removing the need for the tracking id
in the driver.  This patch moves all tracking event handling over to
the input core, simplifying both the existing drivers and the ones
currently in preparation.

Acked-by: Ping Cheng <pingc@wacom.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-16 10:41:38 +01:00
Henrik Rydberg 8cde810016 input: mt: Collect slots initialization code
The MT slots devices all follow the same initialization pattern
of creating slots and hinting about buffer size. Let drivers call
an initialization function instead, and make sure it can be called
repeatedly without side effects.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-16 10:41:12 +01:00
Henrik Rydberg 47c78e8913 input: mt: Break out slots handling
In preparation for common code to handle a larger set of MT slots
devices, move the slots handling over to a separate file.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2010-12-16 10:39:57 +01:00
Florian Fainelli 1874542d95 HID: replace offsets values with their corresponding BTN_* defines
Instead of using magic values, use their corresponding BTN_* defines
from linux/input.h.

Signed-off-by: Florian Fainelli <ffainelli@freebox.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-14 14:49:27 +01:00
Benjamin Tissoires c25bcd3400 HID: hid-mosart: support suspend/resume
The device has 2 modes. The first one is an emulation of a touchscreen
by sending left and right button, and the second mode is the one used in
dual-touch (sending trackingID, touch and else).

In case of a suspend/resume, the device switch back to the first mode
described above (with left and right buttons).
This adds a hook in .reset_resume for the device to be switched to
the correct mode (I just copied the code in mosart_probe).

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-14 11:40:51 +01:00
Benjamin Tissoires ad6d426702 HID: hid-mosart: ignore buttons report
This commit allows the device to be recognized as a touchscreen, and not a
touchpad by xf86-input-evdev.

The device has 2 modes. The first one is an emulation of a touchscreen by
sending left and right button, and the second mode is the one used in
dual-touch (sending trackingID, touch and else).

That's why there is a hid report containing left and right buttons
(9000001 and 9000002). The point is that xorg relies on these fields to
determine if it's a touchpad or a touchscreen.
Clearing the report (return -1) makes xorg detecting it out of the box
as a quite pleasant (dual)touchscreen.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-14 11:40:50 +01:00
Tejun Heo c4ffafa51b HID: hid-picolcd: don't use flush_scheduled_work()
flush_scheduled_work() is deprecated and scheduled to be removed.
Directly flush picolcd_fb_cleanup on exit instead.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-11 18:38:20 +01:00
Jiri Kosina 2ade0c1d9d Merge branch 'master' into upstream 2010-12-10 15:19:18 +01:00
Joe Perches 504499f22c HID: simplify an index check in hid_lookup_collection
Save the struct hid_collection * in a temporary to shorten
the generated code a bit and perhaps improve readability.

$ size drivers/hid/hid-core.o*
   text	   data	    bss	    dec	    hex	filename
  16460	     78	      8	  16546	   40a2	drivers/hid/hid-core.o.new
  16469	     78	      8	  16555	   40ab	drivers/hid/hid-core.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-10 15:14:43 +01:00
Joe Perches a3789a1783 HID: Hoist assigns from ifs
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-10 15:13:43 +01:00
Joe Perches 16ee4cc82b HID: Remove superfluous __inline__
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-10 15:12:22 +01:00
Joe Perches fe2580204d HID: Use vzalloc for vmalloc/memset(,0...)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-10 15:11:31 +01:00
Joe Perches 4291ee305e HID: Add and use hid_<level>: dev_<level> equivalents
Neaten current uses of dev_<level> by adding and using
hid specific hid_<level> macros.

Convert existing uses of dev_<level> uses to hid_<level>.
Convert hid-pidff printk uses to hid_<level>.

Remove err_hid and use hid_err instead.

Add missing newlines to logging messages where necessary.
Coalesce format strings.

Add and use pr_fmt(fmt) KBUILD_MODNAME ": " fmt

Other miscellaneous changes:

Add const struct hid_device * argument to hid-core functions
extract() and implement() so hid_<level> can be used by them.
Fix bad indentation in hid-core hid_input_field function
that calls extract() function above.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-10 15:10:38 +01:00
Chase Douglas 6a66bbd693 HID: magicmouse: Don't report REL_{X,Y} for Magic Trackpad
With the recent switch to having the hid layer handle standard axis
initialization, the Magic Trackpad now reports relative axes. This would
be fine in the normal mode, but the driver puts the device in multitouch
mode where no relative events are generated. Also, userspace software
depends on accurate axis information for device type detection. Thus,
ignoring the relative axes from the Magic Trackpad is best.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-09 14:39:53 +01:00
Dmitry Torokhov 5bea7660bb HID: add hid_hw_open/close/power() handlers
Instead of exposing the guts of hid->ll_driver relationship to HID
sub-drivers provide these helpers to encapsulate the details.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-08 14:35:14 +01:00
Valentine Barshak 33d6eb570b HID: Consolidate device existence checks in hiddev_ioctl
Currently, if the device has been removed before hiddev_ioctl(),
the -EIO is returned. If it's removed while hiddev_ioctl() is in
progress, some commands are still processed fine, others
return -ENODEV. This change takes the "existancelock" before
processing ioctl commands and releases it at the end.
If the device has been removed, always returns -ENODEV.

Signed-off-by: Valentine Barshak <vbarshak@mvista.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-07 15:45:50 +01:00
Valentine Barshak 1a8e8fab79 HID: Fix race between disconnect and hiddev_ioctl
A USB HID device can be disconnected at any time.
If this happens right before or while hiddev_ioctl is in progress,
the hiddev_ioctl tries to access invalid hiddev->hid pointer.
When the hid device is disconnected, the hiddev_disconnect()
ends up with a call to hid_device_release() which frees
hid_device, but doesn't set the hiddev->hid pointer to NULL.
If the deallocated memory region has been re-used by the kernel,
this can cause a crash or memory corruption.

Since disconnect can happen at any time, we can't initialize
struct hid_device *hid = hiddev->hid at the beginning of ioctl
and then use it.

This change checks hiddev->exist flag while holding
the existancelock and uses hid_device only if it exists.

Signed-off-by: Valentine Barshak <vbarshak@mvista.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-07 15:45:49 +01:00