Commit Graph

129 Commits

Author SHA1 Message Date
Benjamin Tissoires 5939212df8 HID: multitouch: prevent memleak with the allocated name
mt_free_input_name() was never called during .remove():
hid_hw_stop() removes the hid_input items in hdev->inputs, and so the
list is therefore empty after the call. In the end, we never free the
special names that has been allocated during .probe().

Restore the original name before freeing it to avoid acessing already
freed pointer.

This fixes a regression introduced by 49a5a827a ("HID: multitouch: append " Pen" to
the name of the stylus input")

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-06-12 11:13:38 +02:00
Jiri Kosina 72c16d9a5c Merge branch 'for-3.10/mt-hybrid-finger-pen' into for-linus
Conflicts:
	drivers/hid/hid-multitouch.c
2013-04-30 10:17:48 +02:00
Jiri Kosina 4f5a810429 Merge branches 'for-3.10/appleir', 'for-3.10/hid-debug', 'for-3.10/hid-driver-transport-cleanups', 'for-3.10/i2c-hid' and 'for-3.10/logitech' into for-linus 2013-04-30 10:12:44 +02:00
Benjamin Tissoires 4c43755506 HID: multitouch: fix touchpad buttons
Commit "HID: multitouch: use the callback "report" instead..." breaks the
buttons of touchpads following the HID multitouch specification.
The buttons were emmitted through hid-input, but as now the events
are generated only in hid-multitouch, the buttons are not emmitted anymore.

The input_event() call is far much simpler than the hid-input one as
many of the different tests do not apply to multitouch touchpads.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-03-27 14:09:40 +01:00
Benjamin Tissoires fb4d8d98dc HID: multitouch: force BTN_STYLUS for pen devices
The "tablet" udev rule relies on BTN_STYLUS to be set.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-03-27 14:02:47 +01:00
Benjamin Tissoires 49a5a827a0 HID: multitouch: append " Pen" to the name of the stylus input
This is not just cosmetics, it can help to write udev and X.org
rules.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-03-27 14:02:47 +01:00
Benjamin Tissoires fa11aa72bd HID: multitouch: add handling for pen in dual-sensors device
Dual sensors devices reports pen and touch on two different reports.
Using the quirk HID_QUIRK_MULTI_INPUT allows us to create a new input
device to forward pen events.

The quirk HID_QUIRK_NO_EMPTY_INPUT avoids the creation of input devices
for the not used mouse emulation present on Win7 certified devices.

Since hid-multitouch sets the quirk HID_QUIRK_NO_INPUT_SYNC, we need
to manually send SYN events for pen report too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-03-27 14:02:46 +01:00
Benjamin Tissoires 5b6498a1c8 HID: multitouch: change touch sensor detection in mt_input_configured()
To implement different methods for pen and touch, the previous
implementation has to be reworked.

This detection of the input attached to the touch sensor is the same
than the one used in mt_report().

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-03-27 14:02:46 +01:00
Benjamin Tissoires 6f492f2877 HID: multitouch: do not map usage from non used reports
hid-multitouch only handles touch events, so there is no point in
mapping other kind of events.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-03-27 14:02:46 +01:00
Benjamin Tissoires a69c5f8b16 HID: multitouch: breaks out touch handling in specific functions
This will allow easier integration of hybrid pen and touch devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-03-27 14:02:45 +01:00
Jiri Kosina b3fecf8cab Merge branch 'for-3.10/hid-driver-transport-cleanups' into for-3.10/mt-hybrid-finger-pen 2013-03-27 14:02:27 +01:00
Benjamin Tissoires 4ba25d3f87 HID: multitouch: remove last usb dependency
hid-multitouch used to direclty call for a set_idle in the .resume()
callback. With the new hid_hw_idle(), this can be dropped and
hid-multitouch is now freed from its transport layer.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-03-07 15:58:46 +01:00
Benjamin Tissoires 5b62efd825 HID: multitouch: remove useless last_field_index field
The aim of last_field_index was to detect the end of the report.
With the introduction of .report(), it is not required anymore to
detect it on the fly as we can put it in the right place during the
.report().

The resulting code path is simpler to read because the terminating
condition is not evaluated after each field.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-03-07 15:20:25 +01:00
Benjamin Tissoires b0a7868181 HID: multitouch: Copyright and note on regression tests
This reflects my new company and officialize the regression tests I'm
conducting between each change.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-25 13:26:42 +01:00
Benjamin Tissoires 4ebc9b636c HID: multitouch: remove explicit usbhid dependency
This patch is part of the cleanup of the HID drivers
against their low-level transport layer.
With new touchscreens relying on I2C, it's better to
handle now these dependencies before users get kernel oopses.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-25 13:26:41 +01:00
Benjamin Tissoires d881427253 HID: use hid_hw_request() instead of direct call to usbhid
This allows the hid drivers to be independent from the transport layer.

The patch was constructed by replacing all occurences of
usbhid_submit_report() by its hid_hw_request() counterpart.
Then, drivers not requiring USB_HID anymore have their USB_HID
dependency cleaned in the Kconfig file.

Finally, few drivers still depends on USB_HID. Many of them
are requiring the io wait callback. They are found in the next patch.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

For the sensor-hub part:
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-25 13:26:41 +01:00
Jiri Kosina 73759518d6 Merge branches 'for-3.9/logitech', 'for-3.9/multitouch', 'for-3.9/ntrig', 'for-3.9/thingm' and 'for-3.9/upstream' into for-linus 2013-02-21 10:45:01 +01:00
Benjamin Tissoires 7e3cc447ff HID: multitouch: do not use pointers towards hid-core
The previous implementation registered a pointer towards hid-core
to the value of contact count. This is not safe and may be difficult
to debug if hid-core ever changes its implementation.
The use of regular indexes is a better choice.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-07 15:13:14 +01:00
Benjamin Tissoires dc3e1d8052 HID: multitouch: make MT_CLS_ALWAYS_TRUE the new default class
By running a test on all the traces of the devices I have,
I noticed that the class MT_CLS_ALWAYS_TRUE could handle all
the devices I've seen so far without any other quirks.
I guess this is the behavior Win 7 requires in its driver.

We can change the default class then and keep the existing classes
for backward compatibility and performances for some of them.

Two operations have been done:
 * replaced MT_CLS_DEFAULT by MT_CLS_NSMU
 * then replaced MT_CLS_ALWAYS_TRUE by MT_CLS_DEFAULT

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-05 12:07:42 +01:00
Benjamin Tissoires e325905c6c HID: multitouch: fix protocol for Elo panels
The previous protocol was nearly working, but when several fingers were
present on the sensor, those that were not moving were not updated
in the next report, introducing a lot of releases.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>

Conflicts:
	drivers/hid/hid-multitouch.c
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-05 12:07:41 +01:00
Benjamin Tissoires efc16787cf HID: multitouch: fix protocol for Cando 2087:0a02
Cando 2087:0a02 was broken, this fixes it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-05 12:07:41 +01:00
Benjamin Tissoires 51377fed20 HID: multitouch: fix protocol for Sitronix 1403:5001
Since the inclusion of this device in hid-multitouch, the device
did not forward any events. Using the serial class makes it working
again.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-05 12:07:41 +01:00
Benjamin Tissoires e0bb8f9adf HID: multitouch: ensure that serial devices make no use of contact count
The serial protocol makes contact count a redondant information, and
sometimes it is not reliable (TRS-Star are in this case).
Disabling the use of contact count for these devices is thus safer.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-05 12:07:40 +01:00
Benjamin Tissoires c629dd7eb3 HID: multitouch: fix Win8 protocol for Sharp like devices
The Sharp LC-20FE1-W screen (04dd:9681) behaves like the Nexio 42".
It may report out of ranges values that are filtered out by relying
on the Contact Count HID field.
Adding the quirk MT_QUIRK_CONTACT_CNT_ACCURATE makes hid-multitouch
strongest against this kind of device, without breaking the current
devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-05 12:07:40 +01:00
Benjamin Tissoires c2517f62da HID: multitouch: add support for Nexio 42" panel
This device is the worst device I saw. It keeps TipSwitch and InRange
at 1 for fingers that are not touching the panel.
The solution is to rely on the field ContactCount, which is accurate
as the correct information are packed at the begining of the frame.

Unfortunately, CountactCount is most of the time at the end of the report.
The solution is to pick it when we have the whole report in raw_event.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-05 12:07:40 +01:00
Benjamin Tissoires 55978fa9dc HID: multitouch: use the callback "report" instead of sequential events
Nexio 42" devices requires to rely on the HID field Contact
Count to compute the valid values. However, this field is
most of the time at the end of the report, meaning that we
need to get the all report parsed before processing it.

This patch does not introduce functional changes.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-02-05 12:07:39 +01:00
H Hartley Sweeten f425458eaf HID: Use module_hid_driver macro
Use the new module_hid_driver macro in all HID drivers that have
a simple register/unregister init/exit.

This also converts the hid drivers that test for a failure of
hid_register_driver() and report the failure. Using module_hid_driver
in those drivers removes the failure message.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-01-03 10:27:31 +01:00
Benjamin Tissoires 1b42fc4a28 HID: multitouch: fix Win 8 protocol
The Win 8 protocol specify the fact that each valid touch must be reported
within a frame until it is released.
We can therefore use the always_valid quirk and dismiss reports when we see
duplicate contacts ID.

We recognize Win8 certified devices from their vendor feature 0xff0000c5
where Microsoft put a signed blob in the report to check if the device
passed the certification.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-15 10:19:00 +01:00
Benjamin Tissoires 9b3bb9b8b6 HID: multitouch: support for hovering devices
Win8 devices supporting hovering must provides InRange HID field.
The information that the finger is here but is not touching the surface
is sent to the user space through ABS_MT_DISTANCE as required by the
multitouch protocol.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-15 10:17:52 +01:00
Benjamin Tissoires 2872839904 HID: multitouch: add MT_QUIRK_IGNORE_DUPLICATES
This quirk allows a device to reuse a contact id when sending garbage
inactive contacts at the end of a report.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-15 10:17:21 +01:00
Benjamin Tissoires 20b60e6dee HID: multitouch: move ALWAYS_VALID quirk check
Win 8 device specification changed the requirements for the hid usages
of the multitouch devices. Now InRange is optional and must be only
used when the device supports hovering.

This ensures that the quirk ALWAYS_VALID is taken into account and
also ensures its precedence over the other VALID* quirks.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-15 10:09:48 +01:00
Benjamin Tissoires 349fd6705b HID: multitouch: support T and C for win8 devices
Win8 input specification clarifies the X and Y sent by devices.
It distincts the position where the user wants to Touch (T) from
the center of the ellipsoide (C). This patch enable supports for this
distinction in hid-multitouch.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-15 10:09:12 +01:00
Benjamin Tissoires afbcb04c18 HID: multitouch: get maxcontacts also from logical_max value
Win8 devices are required to present the feature "Maximum Contact Number".
Fortunately all win7 devices I've seen presents this feature.
If the current value is 0, then, the driver can get the actual supported
contact count by refering to the logical_max.
This win8 specification ensures that logical_max may not be above 250.
This also allows us to detect when devices like irtouch or stantum reports
an obviously wrong value of 255.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-15 10:08:56 +01:00
Benjamin Tissoires 54f4c0c3e9 HID: multitouch: support arrays for the split of the touches in a report
Win8 certification introduced the ability to transmit two X and two Y per
touch. The specification precises that it must be used in an array.

This test guarantees that we split the touches on the last element
in this array.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-15 10:08:40 +01:00
Benjamin Tissoires 37cf6e6fc3 HID: export hidinput_calc_abs_res
Exporting the function allows us to calculate the resolution in third
party drivers like hid-multitouch.
This patch also complete the function with additional valid axes.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-11-15 10:06:28 +01:00
Xianhan Yu 58ad34bf62 HID: multitouch: fix maxcontacts problem on GeneralTouch
Fix maxcontacts problem for PWT GeneralTouch multi-touchscreen.

Our device didn't contain HID_DG_CONTACTMAX usage. This usage use to describe
touchscreen's maxcontacts for hid-multitouch.c to get maxcontacts automatic. We
fix the device that driver can get maxcontact from our device, hence it doesn't
need .maxcontact=10. Now there is just one device class can fix all our PWT
touchscreen.

Signed-off-by: Xianhan Yu <aroundight77@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-10-31 10:42:32 +01:00
Alan Cox 65b258e9b5 HID: multitouch: put the case in the right switch statement
Signed-off-by: Alan Cox <alan@linux.intel.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-10-31 10:42:32 +01:00
Jiri Kosina cdcd3ac4e9 Merge branch 'multitouch' into for-linus
Conflicts:
	drivers/hid/hid-multitouch.c
2012-10-01 14:38:54 +02:00
Xianhan Yu f5ff4e1e62 HID: multitouch: add support for GeneralTouch multi-touchscreen
Fix the touch-up no response problem on GeneralTouch twofingers touchscreen and
modify the driver for new GeneralTouch PWT touchscreen.

Signed-off-by: Xianhan Yu <aroundight77@gmail.com>
Reviewed-by Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-10-01 10:15:02 +02:00
Henrik Rydberg 77723e3bc7 HID: hid-multitouch: Add Flatfrog support
Add support for the Flatfrog Multitouch 3200 panel. This panel
advertises some fields that it does not use, hence the new quirk.

Cc: Pablo Cases <pablo.cases@flatfrog.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2012-09-19 19:50:21 +02:00
Henrik Rydberg c5d40be5f5 HID: hid-multitouch: Fix contact count on 3M panels
Some devices report the number of contacts via the unreliable
CONTACTCOUNT usage, rather than using the CONTACTMAX feature.
Without this patch, the 3M devices are constrained to the default
maximum of ten fingers.

Cc: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2012-09-19 19:50:21 +02:00
Henrik Rydberg 3e1b5015d9 HID: hid-multitouch: Remove the redundant touch state
With the input_mt_sync_frame() function in place, there is no longer
any need to keep the full touch state in the driver. This patch
removes the slot state and replaces the lookup code with the input-mt
equivalent.

Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2012-09-19 19:50:20 +02:00
Henrik Rydberg 76f5902aeb HID: hid-multitouch: Simplify setup and frame synchronization
With the input_configured() callback in place, the setup and frame
synchronization can be simplified. The input device initialization is
moved to mt_input_configured(), to make sure the full HID report has been
seen.

Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2012-09-19 19:50:20 +02:00
Henrik Rydberg b4adbbefc2 Input: MT - Add flags to input_mt_init_slots()
Preparing to move more repeated code into the mt core, add a flags
argument to the input_mt_slots_init() function.

Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Tested-by: Ping Cheng <pingc@wacom.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
2012-09-19 19:50:18 +02:00
Scott Liu dfeefd108a HID: multitouch: Add ELAN production request when resume.
Add ELAN production request when resume.

Some Elan legacy devices require SET_IDLE to be set on resume.
It should be safe to send it to other devices too.
Tested on 3M, Stantum, Cypress, Zytronic, eGalax, and Elan panels.

Suggested by Benjamin Tissoires <benjamin.tissoires@enac.fr>

Signed-off-by: Scott Liu <scott.liu@emc.com.tw>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-15 11:37:27 +02:00
Thierry Reding ae01c9e53f HID: multitouch: Add support for eGalax 0x73f7
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-15 10:38:57 +02:00
Henrik Rydberg 94b5485cdd HID: hid-multitouch: Remove misleading null test
A null test was left behind during the autoloading work;
the test was introduced by 8d179a9e, but was never completely
reverted.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-15 10:37:23 +02:00
Jiri Kosina 3d77104adb HID: multitouch: add support for Touch Revolution touchscreens
Reported-by: Tom Mealey <thecompwiz@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-08-15 10:01:01 +02:00
Benjamin Tissoires 82d069822f HID: hid-multitouch: add support for Zytronic panels
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-06-28 10:29:55 +02:00
Benjamin Tissoires 4aceed37e3 HID: hid-multitouch: fix input mode feature command
Zytronic panels shows a new way of setting the Input Mode feature.
This feature is put in the second usage in the HID feature, instead
of the first, as the majority of the multitouch devices.

This patch adds a detection step when the feature is presented to know
where the feature is located in the report. We can then trigger the right
command to the device. This removes the magic number "0" in the function
mt_set_input_mode.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-06-28 10:29:38 +02:00