aboutsummaryrefslogtreecommitdiff
path: root/drivers/hid/hid-multitouch.c
AgeCommit message (Collapse)Author
2013-12-05Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-androidMark Brown
Conflicts (add/add): drivers/input/evdev.c
2013-12-04HID: multicouh: add PID VID to support 1 new Wistron optical touch deviceKaiChung Cheng
commit bf9d121efc18c30caa2caad85358cf9408eca117 upstream. This patch adds PID VID to support for the Wistron Inc. Optical touch panel. Signed-off-by: KaiChung Cheng <kenny_cheng@wistron.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-04HID: hid-multitouch: add support for SiS panelsForest Bond
commit a6802e008e19845fd9669511b895f7515ef9c48b upstream. Add support for SiS multitouch panels. Signed-off-by: Forest Bond <forest.bond@rapidrollout.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-04HID: multitouch: Fix GeneralTouch products and add more PIDsLuosong
commit 7b2262920db2b98fe2cd32cde52141f02fd9eecf upstream. GeneralTouch products should use the quirk SLOT_IS_CONTACTID instead of SLOT_IS_CONTACTNUMBER. Adding PIDs 0101,e100,0102,0106,010a from the new products. Tested on new and older products by GeneralTouch engineers. Signed-off-by: Luosong <android@generaltouch.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-04Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-androidMark Brown
2013-10-01HID: multitouch: validate indexes detailsBenjamin Tissoires
commit 8821f5dc187bdf16cfb32ef5aa8c3035273fa79a upstream. When working on report indexes, always validate that they are in bounds. Without this, a HID device could report a malicious feature report that could trick the driver into a heap overflow: [ 634.885003] usb 1-1: New USB device found, idVendor=0596, idProduct=0500 ... [ 676.469629] BUG kmalloc-192 (Tainted: G W ): Redzone overwritten Note that we need to change the indexes from s8 to s16 as they can be between -1 and 255. CVE-2013-2897 Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-01HID: Add input_register callback.Jaikumar Ganesh
Add input_register callback which gets called after hid_configure_usage is called for all the reports and before the input device is registered. This allows individual drivers to do extra work like input mapping just before device registration. Based on discussions with David Herrmann <dh.herrmann@googlemail.com> Change-Id: Idab6fb4f7b1e5e569bd0410967288717e9d34c98 Signed-off-by: Jaikumar Ganesh <jaikumarg@android.com> Changed to add return code to input_configured instead of adding input_register Signed-off-by: Arve Hjønnevåg <arve@android.com>
2013-07-01hid-multitouch: Filter collections by application usage.Jeff Brown
This change fixes two problems. First, it ensures that the hid-multitouch driver does not incorrectly map GenericDesktop usages that are intended for other applications, such as a Mouse. Second, it sets the appropriate input properties so that user-space can distinguish TouchScreen devices (INPUT_PROP_DIRECT) from TouchPad devices (INPUT_PROP_POINTER) and configure them accordingly. Change-Id: I8c2d947929186ffe7cf04b37c76e29b9abecf8cb Signed-off-by: jeffbrown@android.com
2013-06-12HID: multitouch: prevent memleak with the allocated nameBenjamin Tissoires
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-04-30Merge branch 'for-3.10/mt-hybrid-finger-pen' into for-linusJiri Kosina
Conflicts: drivers/hid/hid-multitouch.c
2013-04-30Merge branches 'for-3.10/appleir', 'for-3.10/hid-debug', ↵Jiri Kosina
'for-3.10/hid-driver-transport-cleanups', 'for-3.10/i2c-hid' and 'for-3.10/logitech' into for-linus
2013-03-27HID: multitouch: fix touchpad buttonsBenjamin Tissoires
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-27HID: multitouch: force BTN_STYLUS for pen devicesBenjamin Tissoires
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-27HID: multitouch: append " Pen" to the name of the stylus inputBenjamin Tissoires
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-27HID: multitouch: add handling for pen in dual-sensors deviceBenjamin Tissoires
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-27HID: multitouch: change touch sensor detection in mt_input_configured()Benjamin Tissoires
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-27HID: multitouch: do not map usage from non used reportsBenjamin Tissoires
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-27HID: multitouch: breaks out touch handling in specific functionsBenjamin Tissoires
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-27Merge branch 'for-3.10/hid-driver-transport-cleanups' into ↵Jiri Kosina
for-3.10/mt-hybrid-finger-pen
2013-03-07HID: multitouch: remove last usb dependencyBenjamin Tissoires
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-07HID: multitouch: remove useless last_field_index fieldBenjamin Tissoires
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-02-25HID: multitouch: Copyright and note on regression testsBenjamin Tissoires
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-25HID: multitouch: remove explicit usbhid dependencyBenjamin Tissoires
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-25HID: use hid_hw_request() instead of direct call to usbhidBenjamin Tissoires
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-21Merge branches 'for-3.9/logitech', 'for-3.9/multitouch', 'for-3.9/ntrig', ↵Jiri Kosina
'for-3.9/thingm' and 'for-3.9/upstream' into for-linus
2013-02-07HID: multitouch: do not use pointers towards hid-coreBenjamin Tissoires
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-05HID: multitouch: make MT_CLS_ALWAYS_TRUE the new default classBenjamin Tissoires
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-05HID: multitouch: fix protocol for Elo panelsBenjamin Tissoires
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-05HID: multitouch: fix protocol for Cando 2087:0a02Benjamin Tissoires
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-05HID: multitouch: fix protocol for Sitronix 1403:5001Benjamin Tissoires
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-05HID: multitouch: ensure that serial devices make no use of contact countBenjamin Tissoires
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-05HID: multitouch: fix Win8 protocol for Sharp like devicesBenjamin Tissoires
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-05HID: multitouch: add support for Nexio 42" panelBenjamin Tissoires
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-05HID: multitouch: use the callback "report" instead of sequential eventsBenjamin Tissoires
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-01-03HID: Use module_hid_driver macroH Hartley Sweeten
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>
2012-11-15HID: multitouch: fix Win 8 protocolBenjamin Tissoires
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-15HID: multitouch: support for hovering devicesBenjamin Tissoires
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-15HID: multitouch: add MT_QUIRK_IGNORE_DUPLICATESBenjamin Tissoires
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-15HID: multitouch: move ALWAYS_VALID quirk checkBenjamin Tissoires
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-15HID: multitouch: support T and C for win8 devicesBenjamin Tissoires
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-15HID: multitouch: get maxcontacts also from logical_max valueBenjamin Tissoires
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-15HID: multitouch: support arrays for the split of the touches in a reportBenjamin Tissoires
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-15HID: export hidinput_calc_abs_resBenjamin Tissoires
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-10-31HID: multitouch: fix maxcontacts problem on GeneralTouchXianhan Yu
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-31HID: multitouch: put the case in the right switch statementAlan Cox
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-01Merge branch 'multitouch' into for-linusJiri Kosina
Conflicts: drivers/hid/hid-multitouch.c
2012-10-01HID: multitouch: add support for GeneralTouch multi-touchscreenXianhan Yu
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-09-19HID: hid-multitouch: Add Flatfrog supportHenrik Rydberg
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-19HID: hid-multitouch: Fix contact count on 3M panelsHenrik Rydberg
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-19HID: hid-multitouch: Remove the redundant touch stateHenrik Rydberg
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>