Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c024e95 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (47 commits)
  HID: fix mismerge in hid-lg
  HID: hidraw: fix window in hidraw_release
  HID: hid-sony: override usbhid_output_raw_report for Sixaxis
  HID: add absolute axis resolution calculation
  HID: force feedback support for Logitech RumblePad gamepad
  HID: support STmicroelectronics and Sitronix with hid-stantuml driver
  HID: magicmouse: Adjust major / minor axes to scale
  HID: Fix for problems with eGalax/DWAV multi-touch-screen
  HID: waltop: add support for Waltop Slim Tablet 12.1 inch
  HID: add NOGET quirk for AXIS 295 Video Surveillance Joystick
  HID: usbhid: remove unused hiddev_driver
  HID: magicmouse: Use hid-input parsing rather than bypassing it
  HID: trivial formatting fix
  HID: Add support for Logitech Speed Force Wireless gaming wheel
  HID: don't Send Feature Reports on Interrupt Endpoint
  HID: 3m: Adjust major / minor axes to scale
  HID: 3m: Correct touchscreen emulation
  HID: 3m: Convert to MT slots
  HID: 3m: Output proper orientation range
  HID: 3m: Adjust to sequential MT HID protocol
  ...
parents 188e213d d8692ac0
Loading
Loading
Loading
Loading
+98 −0
Original line number Original line Diff line number Diff line
What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/actual_cpi
Date:		August 2010
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Description:	It is possible to switch the cpi setting of the mouse with the
		press of a button.
		When read, this file returns the raw number of the actual cpi
		setting reported by the mouse. This number has to be further
		processed to receive the real dpi value.

		VALUE DPI
		1     400
		2     800
		4     1600

		This file is readonly.

What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/actual_profile
Date:		August 2010
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Description:	When read, this file returns the number of the actual profile in
		range 0-4.
		This file is readonly.

What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/firmware_version
Date:		August 2010
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Description:	When read, this file returns the raw integer version number of the
		firmware reported by the mouse. Using the integer value eases
		further usage in other programs. To receive the real version
		number the decimal point has to be shifted 2 positions to the
		left. E.g. a returned value of 138 means 1.38
		This file is readonly.

What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/profile_settings
Date:		August 2010
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Description:	The mouse can store 5 profiles which can be switched by the
		press of a button. A profile is split in settings and buttons.
		profile_settings holds informations like resolution, sensitivity
		and light effects.
		When written, this file lets one write the respective profile
		settings back to the mouse. The data has to be 13 bytes long.
		The mouse will reject invalid data.
		Which profile to write is determined by the profile number
		contained in the data.
		This file is writeonly.

What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/profile[1-5]_settings
Date:		August 2010
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Description:	The mouse can store 5 profiles which can be switched by the
		press of a button. A profile is split in settings and buttons.
		profile_settings holds informations like resolution, sensitivity
		and light effects.
		When read, these files return the respective profile settings.
		The returned data is 13 bytes in size.
		This file is readonly.

What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/profile_buttons
Date:		August 2010
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Description:	The mouse can store 5 profiles which can be switched by the
		press of a button. A profile is split in settings and buttons.
		profile_buttons holds informations about button layout.
		When written, this file lets one write the respective profile
		buttons back to the mouse. The data has to be 19 bytes long.
		The mouse will reject invalid data.
		Which profile to write is determined by the profile number
		contained in the data.
		This file is writeonly.

What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/profile[1-5]_buttons
Date:		August 2010
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Description:	The mouse can store 5 profiles which can be switched by the
		press of a button. A profile is split in settings and buttons.
		profile_buttons holds informations about button layout.
		When read, these files return the respective profile buttons.
		The returned data is 19 bytes in size.
		This file is readonly.

What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/startup_profile
Date:		August 2010
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Description:	The integer value of this attribute ranges from 0-4.
                When read, this attribute returns the number of the profile
                that's active when the mouse is powered on.
		This file is readonly.

What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/settings
Date:		August 2010
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Description:	When read, this file returns the settings stored in the mouse.
		The size of the data is 3 bytes and holds information on the
		startup_profile.
		When written, this file lets write settings back to the mouse.
		The data has to be 3 bytes long. The mouse will reject invalid
		data.
+126 −0
Original line number Original line Diff line number Diff line
N-Trig touchscreen Driver
-------------------------
	Copyright (c) 2008-2010 Rafi Rubin <rafi@seas.upenn.edu>
	Copyright (c) 2009-2010 Stephane Chatty

This driver provides support for N-Trig pen and multi-touch sensors.  Single
and multi-touch events are translated to the appropriate protocols for
the hid and input systems.  Pen events are sufficiently hid compliant and
are left to the hid core.  The driver also provides additional filtering
and utility functions accessible with sysfs and module parameters.

This driver has been reported to work properly with multiple N-Trig devices
attached.


Parameters
----------

Note: values set at load time are global and will apply to all applicable
devices.  Adjusting parameters with sysfs will override the load time values,
but only for that one device.

The following parameters are used to configure filters to reduce noise:

activate_slack		number of fingers to ignore before processing events

activation_height	size threshold to activate immediately
activation_width

min_height		size threshold bellow which fingers are ignored
min_width		both to decide activation and during activity

deactivate_slack	the number of "no contact" frames to ignore before
			propagating the end of activity events

When the last finger is removed from the device, it sends a number of empty
frames.  By holding off on deactivation for a few frames we can tolerate false
erroneous disconnects, where the sensor may mistakenly not detect a finger that
is still present.  Thus deactivate_slack addresses problems where a users might
see breaks in lines during drawing, or drop an object during a long drag.


Additional sysfs items
----------------------

These nodes just provide easy access to the ranges reported by the device.
sensor_logical_height	the range for positions reported during activity
sensor_logical_width

sensor_physical_height	internal ranges not used for normal events but
sensor_physical_width	useful for tuning

All N-Trig devices with product id of 1 report events in the ranges of
X: 0-9600
Y: 0-7200
However not all of these devices have the same physical dimensions.  Most
seem to be 12" sensors (Dell Latitude XT and XT2 and the HP TX2), and
at least one model (Dell Studio 17) has a 17" sensor.  The ratio of physical
to logical sizes is used to adjust the size based filter parameters.


Filtering
---------

With the release of the early multi-touch firmwares it became increasingly
obvious that these sensors were prone to erroneous events.  Users reported
seeing both inappropriately dropped contact and ghosts, contacts reported
where no finger was actually touching the screen.

Deactivation slack helps prevent dropped contact for single touch use, but does
not address the problem of dropping one of more contacts while other contacts
are still active.  Drops in the multi-touch context require additional
processing and should be handled in tandem with tacking.

As observed ghost contacts are similar to actual use of the sensor, but they
seem to have different profiles.  Ghost activity typically shows up as small
short lived touches.  As such, I assume that the longer the continuous stream
of events the more likely those events are from a real contact, and that the
larger the size of each contact the more likely it is real.  Balancing the
goals of preventing ghosts and accepting real events quickly (to minimize
user observable latency), the filter accumulates confidence for incoming
events until it hits thresholds and begins propagating.  In the interest in
minimizing stored state as well as the cost of operations to make a decision,
I've kept that decision simple.

Time is measured in terms of the number of fingers reported, not frames since
the probability of multiple simultaneous ghosts is expected to drop off
dramatically with increasing numbers.  Rather than accumulate weight as a
function of size, I just use it as a binary threshold.  A sufficiently large
contact immediately overrides the waiting period and leads to activation.

Setting the activation size thresholds to large values will result in deciding
primarily on activation slack.  If you see longer lived ghosts, turning up the
activation slack while reducing the size thresholds may suffice to eliminate
the ghosts while keeping the screen quite responsive to firm taps.

Contacts continue to be filtered with min_height and min_width even after
the initial activation filter is satisfied.  The intent is to provide
a mechanism for filtering out ghosts in the form of an extra finger while
you actually are using the screen.  In practice this sort of ghost has
been far less problematic or relatively rare and I've left the defaults
set to 0 for both parameters, effectively turning off that filter.

I don't know what the optimal values are for these filters.  If the defaults
don't work for you, please play with the parameters.  If you do find other
values more comfortable, I would appreciate feedback.

The calibration of these devices does drift over time.  If ghosts or contact
dropping worsen and interfere with the normal usage of your device, try
recalibrating it.


Calibration
-----------

The N-Trig windows tools provide calibration and testing routines.  Also an
unofficial unsupported set of user space tools including a calibrator is
available at:
http://code.launchpad.net/~rafi-seas/+junk/ntrig_calib


Tracking
--------

As of yet, all tested N-Trig firmwares do not track fingers.  When multiple
contacts are active they seem to be sorted primarily by Y position.
+59 −32
Original line number Original line Diff line number Diff line
@@ -56,20 +56,20 @@ menu "Special HID drivers"
	depends on HID
	depends on HID


config HID_3M_PCT
config HID_3M_PCT
	tristate "3M PCT"
	tristate "3M PCT touchscreen"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for 3M PCT touch screens.
	Support for 3M PCT touch screens.


config HID_A4TECH
config HID_A4TECH
	tristate "A4 tech" if EMBEDDED
	tristate "A4 tech mice" if EMBEDDED
	depends on USB_HID
	depends on USB_HID
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
	Support for A4 tech X5 and WOP-35 / Trust 450L mice.
	Support for A4 tech X5 and WOP-35 / Trust 450L mice.


config HID_ACRUX_FF
config HID_ACRUX_FF
	tristate "ACRUX force feedback support"
	tristate "ACRUX force feedback"
	depends on USB_HID
	depends on USB_HID
	select INPUT_FF_MEMLESS
	select INPUT_FF_MEMLESS
	---help---
	---help---
@@ -77,7 +77,7 @@ config HID_ACRUX_FF
	game controllers.
	game controllers.


config HID_APPLE
config HID_APPLE
	tristate "Apple" if EMBEDDED
	tristate "Apple {i,Power,Mac}Books" if EMBEDDED
	depends on (USB_HID || BT_HIDP)
	depends on (USB_HID || BT_HIDP)
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
@@ -88,7 +88,7 @@ config HID_APPLE
	MacBooks, MacBook Pros and Apple Aluminum.
	MacBooks, MacBook Pros and Apple Aluminum.


config HID_BELKIN
config HID_BELKIN
	tristate "Belkin" if EMBEDDED
	tristate "Belkin Flip KVM and Wireless keyboard" if EMBEDDED
	depends on USB_HID
	depends on USB_HID
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
@@ -101,14 +101,14 @@ config HID_CANDO
	Support for Cando dual touch panel.
	Support for Cando dual touch panel.


config HID_CHERRY
config HID_CHERRY
	tristate "Cherry" if EMBEDDED
	tristate "Cherry Cymotion keyboard" if EMBEDDED
	depends on USB_HID
	depends on USB_HID
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
	Support for Cherry Cymotion keyboard.
	Support for Cherry Cymotion keyboard.


config HID_CHICONY
config HID_CHICONY
	tristate "Chicony" if EMBEDDED
	tristate "Chicony Tactical pad" if EMBEDDED
	depends on USB_HID
	depends on USB_HID
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
@@ -130,20 +130,20 @@ config HID_PRODIKEYS
	  and some additional multimedia keys.
	  and some additional multimedia keys.


config HID_CYPRESS
config HID_CYPRESS
	tristate "Cypress" if EMBEDDED
	tristate "Cypress mouse and barcode readers" if EMBEDDED
	depends on USB_HID
	depends on USB_HID
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
	Support for cypress mouse and barcode readers.
	Support for cypress mouse and barcode readers.


config HID_DRAGONRISE
config HID_DRAGONRISE
	tristate "DragonRise Inc. support"
	tristate "DragonRise Inc. game controller"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Say Y here if you have DragonRise Inc.game controllers.
	Say Y here if you have DragonRise Inc.game controllers.


config DRAGONRISE_FF
config DRAGONRISE_FF
	bool "DragonRise Inc. force feedback support"
	bool "DragonRise Inc. force feedback"
	depends on HID_DRAGONRISE
	depends on HID_DRAGONRISE
	select INPUT_FF_MEMLESS
	select INPUT_FF_MEMLESS
	---help---
	---help---
@@ -157,46 +157,58 @@ config HID_EGALAX
	Support for the eGalax dual-touch panel.
	Support for the eGalax dual-touch panel.


config HID_ELECOM
config HID_ELECOM
	tristate "ELECOM"
	tristate "ELECOM BM084 bluetooth mouse"
	depends on BT_HIDP
	depends on BT_HIDP
	---help---
	---help---
	Support for the ELECOM BM084 (bluetooth mouse).
	Support for the ELECOM BM084 (bluetooth mouse).


config HID_EZKEY
config HID_EZKEY
	tristate "Ezkey" if EMBEDDED
	tristate "Ezkey BTC 8193 keyboard" if EMBEDDED
	depends on USB_HID
	depends on USB_HID
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
	Support for Ezkey BTC 8193 keyboard.
	Support for Ezkey BTC 8193 keyboard.


config HID_KYE
config HID_KYE
	tristate "Kye" if EMBEDDED
	tristate "Kye/Genius Ergo Mouse" if EMBEDDED
	depends on USB_HID
	depends on USB_HID
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
	Support for Kye/Genius Ergo Mouse.
	Support for Kye/Genius Ergo Mouse.


config HID_UCLOGIC
	tristate "UC-Logic"
	depends on USB_HID
	---help---
	Support for UC-Logic tablets.

config HID_WALTOP
	tristate "Waltop"
	depends on USB_HID
	---help---
	Support for Waltop tablets.

config HID_GYRATION
config HID_GYRATION
	tristate "Gyration"
	tristate "Gyration remote control"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for Gyration remote control.
	Support for Gyration remote control.


config HID_TWINHAN
config HID_TWINHAN
	tristate "Twinhan"
	tristate "Twinhan IR remote control"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for Twinhan IR remote control.
	Support for Twinhan IR remote control.


config HID_KENSINGTON
config HID_KENSINGTON
	tristate "Kensington" if EMBEDDED
	tristate "Kensington Slimblade Trackball" if EMBEDDED
	depends on USB_HID
	depends on USB_HID
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
	Support for Kensington Slimblade Trackball.
	Support for Kensington Slimblade Trackball.


config HID_LOGITECH
config HID_LOGITECH
	tristate "Logitech" if EMBEDDED
	tristate "Logitech devices" if EMBEDDED
	depends on USB_HID
	depends on USB_HID
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
@@ -220,12 +232,12 @@ config LOGITECH_FF
	  force feedback.
	  force feedback.


config LOGIRUMBLEPAD2_FF
config LOGIRUMBLEPAD2_FF
	bool "Logitech Rumblepad 2 force feedback support"
	bool "Logitech RumblePad/Rumblepad 2 force feedback support"
	depends on HID_LOGITECH
	depends on HID_LOGITECH
	select INPUT_FF_MEMLESS
	select INPUT_FF_MEMLESS
	help
	help
	  Say Y here if you want to enable force feedback support for Logitech
	  Say Y here if you want to enable force feedback support for Logitech
	  Rumblepad 2 devices.
	  RumblePad and Rumblepad 2 devices.


config LOGIG940_FF
config LOGIG940_FF
	bool "Logitech Flight System G940 force feedback support"
	bool "Logitech Flight System G940 force feedback support"
@@ -235,6 +247,14 @@ config LOGIG940_FF
	  Say Y here if you want to enable force feedback support for Logitech
	  Say Y here if you want to enable force feedback support for Logitech
	  Flight System G940 devices.
	  Flight System G940 devices.


config LOGIWII_FF
	bool "Logitech Speed Force Wireless force feedback support"
	depends on HID_LOGITECH
	select INPUT_FF_MEMLESS
	help
	  Say Y here if you want to enable force feedback support for Logitech
	  Speed Force Wireless (Wii) devices.

config HID_MAGICMOUSE
config HID_MAGICMOUSE
	tristate "Apple MagicMouse multi-touch support"
	tristate "Apple MagicMouse multi-touch support"
	depends on BT_HIDP
	depends on BT_HIDP
@@ -245,39 +265,39 @@ config HID_MAGICMOUSE
	Apple Wireless "Magic" Mouse.
	Apple Wireless "Magic" Mouse.


config HID_MICROSOFT
config HID_MICROSOFT
	tristate "Microsoft" if EMBEDDED
	tristate "Microsoft non-fully HID-compliant devices" if EMBEDDED
	depends on USB_HID
	depends on USB_HID
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
	Support for Microsoft devices that are not fully compliant with HID standard.
	Support for Microsoft devices that are not fully compliant with HID standard.


config HID_MOSART
config HID_MOSART
	tristate "MosArt"
	tristate "MosArt dual-touch panels"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for MosArt dual-touch panels.
	Support for MosArt dual-touch panels.


config HID_MONTEREY
config HID_MONTEREY
	tristate "Monterey" if EMBEDDED
	tristate "Monterey Genius KB29E keyboard" if EMBEDDED
	depends on USB_HID
	depends on USB_HID
	default !EMBEDDED
	default !EMBEDDED
	---help---
	---help---
	Support for Monterey Genius KB29E.
	Support for Monterey Genius KB29E.


config HID_NTRIG
config HID_NTRIG
	tristate "NTrig"
	tristate "N-Trig touch screen"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for N-Trig touch screen.
	Support for N-Trig touch screen.


config HID_ORTEK
config HID_ORTEK
	tristate "Ortek"
	tristate "Ortek WKB-2000 wireless keyboard and mouse trackpad"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for Ortek WKB-2000 wireless keyboard + mouse trackpad.
	Support for Ortek WKB-2000 wireless keyboard + mouse trackpad.


config HID_PANTHERLORD
config HID_PANTHERLORD
	tristate "Pantherlord support"
	tristate "Pantherlord/GreenAsia game controller"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	  Say Y here if you have a PantherLord/GreenAsia based game controller
	  Say Y here if you have a PantherLord/GreenAsia based game controller
@@ -292,7 +312,7 @@ config PANTHERLORD_FF
	  or adapter and want to enable force feedback support for it.
	  or adapter and want to enable force feedback support for it.


config HID_PETALYNX
config HID_PETALYNX
	tristate "Petalynx"
	tristate "Petalynx Maxter remote control"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for Petalynx Maxter remote control.
	Support for Petalynx Maxter remote control.
@@ -356,7 +376,7 @@ config HID_PICOLCD_LEDS
	  Provide access to PicoLCD's GPO pins via leds class.
	  Provide access to PicoLCD's GPO pins via leds class.


config HID_QUANTA
config HID_QUANTA
	tristate "Quanta Optical Touch"
	tristate "Quanta Optical Touch panels"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for Quanta Optical Touch dual-touch panels.
	Support for Quanta Optical Touch dual-touch panels.
@@ -376,32 +396,39 @@ config HID_ROCCAT_KONE
	---help---
	---help---
	Support for Roccat Kone mouse.
	Support for Roccat Kone mouse.


config HID_ROCCAT_PYRA
	tristate "Roccat Pyra mouse support"
	depends on USB_HID
	select HID_ROCCAT
	---help---
	Support for Roccat Pyra mouse.

config HID_SAMSUNG
config HID_SAMSUNG
	tristate "Samsung"
	tristate "Samsung InfraRed remote control or keyboards"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for Samsung InfraRed remote control or keyboards.
	Support for Samsung InfraRed remote control or keyboards.


config HID_SONY
config HID_SONY
	tristate "Sony"
	tristate "Sony PS3 controller"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for Sony PS3 controller.
	Support for Sony PS3 controller.


config HID_STANTUM
config HID_STANTUM
	tristate "Stantum"
	tristate "Stantum multitouch panel"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for Stantum multitouch panel.
	Support for Stantum multitouch panel.


config HID_SUNPLUS
config HID_SUNPLUS
	tristate "Sunplus"
	tristate "Sunplus wireless desktop"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	Support for Sunplus wireless desktop.
	Support for Sunplus wireless desktop.


config HID_GREENASIA
config HID_GREENASIA
	tristate "GreenAsia (Product ID 0x12) support"
	tristate "GreenAsia (Product ID 0x12) game controller support"
	depends on USB_HID
	depends on USB_HID
	---help---
	---help---
	  Say Y here if you have a GreenAsia (Product ID 0x12) based game
	  Say Y here if you have a GreenAsia (Product ID 0x12) based game
+6 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,9 @@ endif
ifdef CONFIG_LOGIG940_FF
ifdef CONFIG_LOGIG940_FF
	hid-logitech-objs	+= hid-lg3ff.o
	hid-logitech-objs	+= hid-lg3ff.o
endif
endif
ifdef CONFIG_LOGIWII_FF
	hid-logitech-objs	+= hid-lg4ff.o
endif


obj-$(CONFIG_HID_3M_PCT)	+= hid-3m-pct.o
obj-$(CONFIG_HID_3M_PCT)	+= hid-3m-pct.o
obj-$(CONFIG_HID_A4TECH)	+= hid-a4tech.o
obj-$(CONFIG_HID_A4TECH)	+= hid-a4tech.o
@@ -52,6 +55,7 @@ obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o
obj-$(CONFIG_HID_PICOLCD)	+= hid-picolcd.o
obj-$(CONFIG_HID_PICOLCD)	+= hid-picolcd.o
obj-$(CONFIG_HID_ROCCAT)	+= hid-roccat.o
obj-$(CONFIG_HID_ROCCAT)	+= hid-roccat.o
obj-$(CONFIG_HID_ROCCAT_KONE)	+= hid-roccat-kone.o
obj-$(CONFIG_HID_ROCCAT_KONE)	+= hid-roccat-kone.o
obj-$(CONFIG_HID_ROCCAT_PYRA)	+= hid-roccat-pyra.o
obj-$(CONFIG_HID_SAMSUNG)	+= hid-samsung.o
obj-$(CONFIG_HID_SAMSUNG)	+= hid-samsung.o
obj-$(CONFIG_HID_SMARTJOYPLUS)	+= hid-sjoy.o
obj-$(CONFIG_HID_SMARTJOYPLUS)	+= hid-sjoy.o
obj-$(CONFIG_HID_SONY)		+= hid-sony.o
obj-$(CONFIG_HID_SONY)		+= hid-sony.o
@@ -61,9 +65,11 @@ obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o
obj-$(CONFIG_HID_THRUSTMASTER)	+= hid-tmff.o
obj-$(CONFIG_HID_THRUSTMASTER)	+= hid-tmff.o
obj-$(CONFIG_HID_TOPSEED)	+= hid-topseed.o
obj-$(CONFIG_HID_TOPSEED)	+= hid-topseed.o
obj-$(CONFIG_HID_TWINHAN)	+= hid-twinhan.o
obj-$(CONFIG_HID_TWINHAN)	+= hid-twinhan.o
obj-$(CONFIG_HID_UCLOGIC)	+= hid-uclogic.o
obj-$(CONFIG_HID_ZEROPLUS)	+= hid-zpff.o
obj-$(CONFIG_HID_ZEROPLUS)	+= hid-zpff.o
obj-$(CONFIG_HID_ZYDACRON)	+= hid-zydacron.o
obj-$(CONFIG_HID_ZYDACRON)	+= hid-zydacron.o
obj-$(CONFIG_HID_WACOM)		+= hid-wacom.o
obj-$(CONFIG_HID_WACOM)		+= hid-wacom.o
obj-$(CONFIG_HID_WALTOP)	+= hid-waltop.o


obj-$(CONFIG_USB_HID)		+= usbhid/
obj-$(CONFIG_USB_HID)		+= usbhid/
obj-$(CONFIG_USB_MOUSE)		+= usbhid/
obj-$(CONFIG_USB_MOUSE)		+= usbhid/
+72 −55
Original line number Original line Diff line number Diff line
@@ -2,6 +2,8 @@
 *  HID driver for 3M PCT multitouch panels
 *  HID driver for 3M PCT multitouch panels
 *
 *
 *  Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
 *  Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
 *  Copyright (c) 2010      Henrik Rydberg <rydberg@euromail.se>
 *  Copyright (c) 2010      Canonical, Ltd.
 *
 *
 */
 */


@@ -24,15 +26,26 @@ MODULE_LICENSE("GPL");


#include "hid-ids.h"
#include "hid-ids.h"


#define MAX_SLOTS		60
#define MAX_TRKID		USHRT_MAX
#define MAX_EVENTS		360

/* estimated signal-to-noise ratios */
#define SN_MOVE			2048
#define SN_WIDTH		128

struct mmm_finger {
struct mmm_finger {
	__s32 x, y, w, h;
	__s32 x, y, w, h;
	__u8 rank;
	__u16 id;
	bool prev_touch;
	bool touch, valid;
	bool touch, valid;
};
};


struct mmm_data {
struct mmm_data {
	struct mmm_finger f[10];
	struct mmm_finger f[MAX_SLOTS];
	__u8 curid, num;
	__u16 id;
	__u8 curid;
	__u8 nexp, nreal;
	bool touch, valid;
	bool touch, valid;
};
};


@@ -40,6 +53,10 @@ static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max)
		unsigned long **bit, int *max)
{
{
	int f1 = field->logical_minimum;
	int f2 = field->logical_maximum;
	int df = f2 - f1;

	switch (usage->hid & HID_USAGE_PAGE) {
	switch (usage->hid & HID_USAGE_PAGE) {


	case HID_UP_BUTTON:
	case HID_UP_BUTTON:
@@ -50,18 +67,20 @@ static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		case HID_GD_X:
		case HID_GD_X:
			hid_map_usage(hi, usage, bit, max,
			hid_map_usage(hi, usage, bit, max,
					EV_ABS, ABS_MT_POSITION_X);
					EV_ABS, ABS_MT_POSITION_X);
			input_set_abs_params(hi->input, ABS_MT_POSITION_X,
					     f1, f2, df / SN_MOVE, 0);
			/* touchscreen emulation */
			/* touchscreen emulation */
			input_set_abs_params(hi->input, ABS_X,
			input_set_abs_params(hi->input, ABS_X,
						field->logical_minimum,
					     f1, f2, df / SN_MOVE, 0);
						field->logical_maximum, 0, 0);
			return 1;
			return 1;
		case HID_GD_Y:
		case HID_GD_Y:
			hid_map_usage(hi, usage, bit, max,
			hid_map_usage(hi, usage, bit, max,
					EV_ABS, ABS_MT_POSITION_Y);
					EV_ABS, ABS_MT_POSITION_Y);
			input_set_abs_params(hi->input, ABS_MT_POSITION_Y,
					     f1, f2, df / SN_MOVE, 0);
			/* touchscreen emulation */
			/* touchscreen emulation */
			input_set_abs_params(hi->input, ABS_Y,
			input_set_abs_params(hi->input, ABS_Y,
						field->logical_minimum,
					     f1, f2, df / SN_MOVE, 0);
						field->logical_maximum, 0, 0);
			return 1;
			return 1;
		}
		}
		return 0;
		return 0;
@@ -81,21 +100,31 @@ static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		case HID_DG_TIPSWITCH:
		case HID_DG_TIPSWITCH:
			/* touchscreen emulation */
			/* touchscreen emulation */
			hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
			hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
			input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
			return 1;
			return 1;
		case HID_DG_WIDTH:
		case HID_DG_WIDTH:
			hid_map_usage(hi, usage, bit, max,
			hid_map_usage(hi, usage, bit, max,
					EV_ABS, ABS_MT_TOUCH_MAJOR);
					EV_ABS, ABS_MT_TOUCH_MAJOR);
			input_set_abs_params(hi->input, ABS_MT_TOUCH_MAJOR,
					     f1, f2, df / SN_WIDTH, 0);
			return 1;
			return 1;
		case HID_DG_HEIGHT:
		case HID_DG_HEIGHT:
			hid_map_usage(hi, usage, bit, max,
			hid_map_usage(hi, usage, bit, max,
					EV_ABS, ABS_MT_TOUCH_MINOR);
					EV_ABS, ABS_MT_TOUCH_MINOR);
			input_set_abs_params(hi->input, ABS_MT_TOUCH_MINOR,
					     f1, f2, df / SN_WIDTH, 0);
			input_set_abs_params(hi->input, ABS_MT_ORIENTATION,
			input_set_abs_params(hi->input, ABS_MT_ORIENTATION,
					1, 1, 0, 0);
					0, 1, 0, 0);
			return 1;
			return 1;
		case HID_DG_CONTACTID:
		case HID_DG_CONTACTID:
			field->logical_maximum = 59;
			field->logical_maximum = MAX_TRKID;
			hid_map_usage(hi, usage, bit, max,
			hid_map_usage(hi, usage, bit, max,
					EV_ABS, ABS_MT_TRACKING_ID);
					EV_ABS, ABS_MT_TRACKING_ID);
			input_set_abs_params(hi->input, ABS_MT_TRACKING_ID,
					     0, MAX_TRKID, 0, 0);
			if (!hi->input->mt)
				input_mt_create_slots(hi->input, MAX_SLOTS);
			input_set_events_per_packet(hi->input, MAX_EVENTS);
			return 1;
			return 1;
		}
		}
		/* let hid-input decide for the others */
		/* let hid-input decide for the others */
@@ -113,10 +142,10 @@ static int mmm_input_mapped(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max)
		unsigned long **bit, int *max)
{
{
	/* tell hid-input to skip setup of these event types */
	if (usage->type == EV_KEY || usage->type == EV_ABS)
	if (usage->type == EV_KEY || usage->type == EV_ABS)
		clear_bit(usage->code, *bit);
		set_bit(usage->type, hi->input->evbit);

	return -1;
	return 0;
}
}


/*
/*
@@ -126,70 +155,49 @@ static int mmm_input_mapped(struct hid_device *hdev, struct hid_input *hi,
static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
static void mmm_filter_event(struct mmm_data *md, struct input_dev *input)
{
{
	struct mmm_finger *oldest = 0;
	struct mmm_finger *oldest = 0;
	bool pressed = false, released = false;
	int i;
	int i;

	for (i = 0; i < MAX_SLOTS; ++i) {
	/*
	 * we need to iterate on all fingers to decide if we have a press
	 * or a release event in our touchscreen emulation.
	 */
	for (i = 0; i < 10; ++i) {
		struct mmm_finger *f = &md->f[i];
		struct mmm_finger *f = &md->f[i];
		if (!f->valid) {
		if (!f->valid) {
			/* this finger is just placeholder data, ignore */
			/* this finger is just placeholder data, ignore */
		} else if (f->touch) {
			continue;
		}
		input_mt_slot(input, i);
		if (f->touch) {
			/* this finger is on the screen */
			/* this finger is on the screen */
			int wide = (f->w > f->h);
			int wide = (f->w > f->h);
			input_event(input, EV_ABS, ABS_MT_TRACKING_ID, i);
			/* divided by two to match visual scale of touch */
			int major = max(f->w, f->h) >> 1;
			int minor = min(f->w, f->h) >> 1;

			if (!f->prev_touch)
				f->id = md->id++;
			input_event(input, EV_ABS, ABS_MT_TRACKING_ID, f->id);
			input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x);
			input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x);
			input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y);
			input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y);
			input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
			input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
			input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR,
			input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
						wide ? f->w : f->h);
			input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
			input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR,
			/* touchscreen emulation: pick the oldest contact */
						wide ? f->h : f->w);
			if (!oldest || ((f->id - oldest->id) & (SHRT_MAX + 1)))
			input_mt_sync(input);
			/*
			 * touchscreen emulation: maintain the age rank
			 * of this finger, decide if we have a press
			 */
			if (f->rank == 0) {
				f->rank = ++(md->num);
				if (f->rank == 1)
					pressed = true;
			}
			if (f->rank == 1)
				oldest = f;
				oldest = f;
		} else {
		} else {
			/* this finger took off the screen */
			/* this finger took off the screen */
			/* touchscreen emulation: maintain age rank of others */
			input_event(input, EV_ABS, ABS_MT_TRACKING_ID, -1);
			int j;

			for (j = 0; j < 10; ++j) {
				struct mmm_finger *g = &md->f[j];
				if (g->rank > f->rank) {
					g->rank--;
					if (g->rank == 1)
						oldest = g;
				}
			}
			f->rank = 0;
			--(md->num);
			if (md->num == 0)
				released = true;
		}
		}
		f->prev_touch = f->touch;
		f->valid = 0;
		f->valid = 0;
	}
	}


	/* touchscreen emulation */
	/* touchscreen emulation */
	if (oldest) {
	if (oldest) {
		if (pressed)
		input_event(input, EV_KEY, BTN_TOUCH, 1);
		input_event(input, EV_KEY, BTN_TOUCH, 1);
		input_event(input, EV_ABS, ABS_X, oldest->x);
		input_event(input, EV_ABS, ABS_X, oldest->x);
		input_event(input, EV_ABS, ABS_Y, oldest->y);
		input_event(input, EV_ABS, ABS_Y, oldest->y);
	} else if (released) {
	} else {
		input_event(input, EV_KEY, BTN_TOUCH, 0);
		input_event(input, EV_KEY, BTN_TOUCH, 0);
	}
	}
	input_sync(input);
}
}


/*
/*
@@ -223,10 +231,12 @@ static int mmm_event(struct hid_device *hid, struct hid_field *field,
				md->f[md->curid].h = value;
				md->f[md->curid].h = value;
			break;
			break;
		case HID_DG_CONTACTID:
		case HID_DG_CONTACTID:
			value = clamp_val(value, 0, MAX_SLOTS - 1);
			if (md->valid) {
			if (md->valid) {
				md->curid = value;
				md->curid = value;
				md->f[value].touch = md->touch;
				md->f[value].touch = md->touch;
				md->f[value].valid = 1;
				md->f[value].valid = 1;
				md->nreal++;
			}
			}
			break;
			break;
		case HID_GD_X:
		case HID_GD_X:
@@ -238,7 +248,12 @@ static int mmm_event(struct hid_device *hid, struct hid_field *field,
				md->f[md->curid].y = value;
				md->f[md->curid].y = value;
			break;
			break;
		case HID_DG_CONTACTCOUNT:
		case HID_DG_CONTACTCOUNT:
			if (value)
				md->nexp = value;
			if (md->nreal >= md->nexp) {
				mmm_filter_event(md, input);
				mmm_filter_event(md, input);
				md->nreal = 0;
			}
			break;
			break;
		}
		}
	}
	}
@@ -255,6 +270,8 @@ static int mmm_probe(struct hid_device *hdev, const struct hid_device_id *id)
	int ret;
	int ret;
	struct mmm_data *md;
	struct mmm_data *md;


	hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;

	md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL);
	md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL);
	if (!md) {
	if (!md) {
		dev_err(&hdev->dev, "cannot allocate 3M data\n");
		dev_err(&hdev->dev, "cannot allocate 3M data\n");
Loading