diff mbox

hid: Fix Speedlink VAD Cezanne support for some devices

Message ID 5219C455.7040309@stefankriwanek.de
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Stefan Kriwanek Aug. 25, 2013, 8:46 a.m. UTC
Some devices of the "Speedlink VAD Cezanne" model need more aggressive fixing than already done.

I made sure through testing that this patch would not interfere with the proper working of a device that is bug-free. (The driver drops EV_REL events with abs(val) >= 256, which are not achievable even on the highest laser resolution hardware setting.) Hence, I believe it is safe to also apply to older kernels (that is, if your policy allows).

The patch applies to any kernel from 3.1 to current 3.11-rc6.


Signed-off-by: Stefan Kriwanek <mail@stefankriwanek.de>

---


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jiri Kosina Aug. 26, 2013, 11:51 a.m. UTC | #1
On Sun, 25 Aug 2013, Stefan Kriwanek wrote:

> Some devices of the "Speedlink VAD Cezanne" model need more aggressive fixing than already done.

Applied, thanks Stefan.
diff mbox

Patch

--- linux-source-3.5.0/drivers/hid/hid-speedlink.c
+++ linux-source-3.5.0-speedlink/drivers/hid/hid-speedlink.c
@@ -3,7 +3,7 @@ 
  *  Fixes "jumpy" cursor and removes nonexistent keyboard LEDS from
  *  the HID descriptor.
  *
- *  Copyright (c) 2011 Stefan Kriwanek <mail@stefankriwanek.de>
+ *  Copyright (c) 2011, 2013 Stefan Kriwanek <dev@stefankriwanek.de>
  */
 
 /*
@@ -48,8 +48,13 @@  static int speedlink_event(struct hid_de
 		struct hid_usage *usage, __s32 value)
 {
 	/* No other conditions due to usage_table. */
-	/* Fix "jumpy" cursor (invalid events sent by device). */
-	if (value == 256)
+
+	/* This fixes the "jumpy" cursor occuring due to invalid events sent
+	 * by the device. Some devices only send them with value==+256, others
+	 * don't. However, catching abs(value)>=256 is restrictive enough not
+	 * to interfere with devices that were bug-free (has been tested).
+	 */
+	if (abs(value) >= 256)
 		return 1;
 	/* Drop useless distance 0 events (on button clicks etc.) as well */
 	if (value == 0)