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

Commit 79084494 authored by Jiri Kosina's avatar Jiri Kosina
Browse files

Merge branches 'for-4.16/hid-quirks-cleanup/asus',...

Merge branches 'for-4.16/hid-quirks-cleanup/asus', 'for-4.16/hid-quirks-cleanup/elecom', 'for-4.16/hid-quirks-cleanup/ish', 'for-4.16/hid-quirks-cleanup/multitouch', 'for-4.16/hid-quirks-cleanup/pixart', 'for-4.16/hid-quirks-cleanup/rmi', 'for-4.16/hid-quirks-cleanup/sony' and 'for-4.16/hid-quirks-cleanup/toshiba' into for-linus

Pull assorted device driver fixes (ASUS, Elecom, Intel-ISH, Multitouch, PixArt, RMI,
Sony and Toshiba) based on top the hid-quirks revamp.
Loading
+5 −4
Original line number Diff line number Diff line
@@ -269,10 +269,11 @@ ABS_MT_ORIENTATION
    The orientation of the touching ellipse. The value should describe a signed
    quarter of a revolution clockwise around the touch center. The signed value
    range is arbitrary, but zero should be returned for an ellipse aligned with
    the Y axis of the surface, a negative value when the ellipse is turned to
    the left, and a positive value when the ellipse is turned to the
    right. When completely aligned with the X axis, the range max should be
    returned.
    the Y axis (north) of the surface, a negative value when the ellipse is
    turned to the left, and a positive value when the ellipse is turned to the
    right. When aligned with the X axis in the positive direction, the range
    max should be returned; when aligned with the X axis in the negative
    direction, the range -max should be returned.

    Touch ellipsis are symmetrical by default. For devices capable of true 360
    degree orientation, the reported orientation must exceed the range max to
+1 −0
Original line number Diff line number Diff line
@@ -280,6 +280,7 @@ config HID_ELECOM
	---help---
	Support for ELECOM devices:
	  - BM084 Bluetooth Mouse
	  - EX-G Trackball (Wired and wireless)
	  - DEFT Trackball (Wired and wireless)
	  - HUGE Trackball (Wired and wireless)

+37 −4
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
 * any later version.
 */

#include <linux/dmi.h>
#include <linux/hid.h>
#include <linux/module.h>
#include <linux/input/mt.h>
@@ -119,6 +120,24 @@ static const struct asus_touchpad_info asus_t100ta_tp = {
	.max_contacts = 5,
};

static const struct asus_touchpad_info asus_t100ha_tp = {
	.max_x = 2640,
	.max_y = 1320,
	.res_x = 30, /* units/mm */
	.res_y = 29, /* units/mm */
	.contact_size = 5,
	.max_contacts = 5,
};

static const struct asus_touchpad_info asus_t200ta_tp = {
	.max_x = 3120,
	.max_y = 1716,
	.res_x = 30, /* units/mm */
	.res_y = 28, /* units/mm */
	.contact_size = 5,
	.max_contacts = 5,
};

static const struct asus_touchpad_info asus_t100chi_tp = {
	.max_x = 2640,
	.max_y = 1320,
@@ -606,6 +625,16 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)

		if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) {
			drvdata->quirks = QUIRK_SKIP_INPUT_MAPPING;
			/*
			 * The T100HA uses the same USB-ids as the T100TAF and
			 * the T200TA uses the same USB-ids as the T100TA, while
			 * both have different max x/y values as the T100TA[F].
			 */
			if (dmi_match(DMI_PRODUCT_NAME, "T100HAN"))
				drvdata->tp = &asus_t100ha_tp;
			else if (dmi_match(DMI_PRODUCT_NAME, "T200TA"))
				drvdata->tp = &asus_t200ta_tp;
			else
				drvdata->tp = &asus_t100ta_tp;
		}
	}
@@ -686,9 +715,10 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
		hid_info(hdev, "Fixing up Asus notebook report descriptor\n");
		rdesc[55] = 0xdd;
	}
	/* For the T100TA keyboard dock */
	/* For the T100TA/T200TA keyboard dock */
	if (drvdata->quirks & QUIRK_T100_KEYBOARD &&
		 *rsize == 76 && rdesc[73] == 0x81 && rdesc[74] == 0x01) {
		 (*rsize == 76 || *rsize == 101) &&
		 rdesc[73] == 0x81 && rdesc[74] == 0x01) {
		hid_info(hdev, "Fixing up Asus T100 keyb report descriptor\n");
		rdesc[74] &= ~HID_MAIN_ITEM_CONSTANT;
	}
@@ -751,7 +781,10 @@ static const struct hid_device_id asus_devices[] = {
	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
		USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD3), QUIRK_G752_KEYBOARD },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
		USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD),
		USB_DEVICE_ID_ASUSTEK_T100TA_KEYBOARD),
	  QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
		USB_DEVICE_ID_ASUSTEK_T100TAF_KEYBOARD),
	  QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES },
	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_ASUS_AK1D) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_ASUS_MD_5110) },
+42 −36
Original line number Diff line number Diff line
/*
 *  HID driver for ELECOM devices.
 *  HID driver for ELECOM devices:
 *  - BM084 Bluetooth Mouse
 *  - EX-G Trackball (Wired and wireless)
 *  - DEFT Trackball (Wired and wireless)
 *  - HUGE Trackball (Wired and wireless)
 *
 *  Copyright (c) 2010 Richard Nauber <Richard.Nauber@gmail.com>
 *  Copyright (c) 2016 Yuxuan Shui <yshuiv7@gmail.com>
 *  Copyright (c) 2017 Diego Elio Pettenò <flameeyes@flameeyes.eu>
 *  Copyright (c) 2017 Alex Manoussakis <amanou@gnu.org>
 *  Copyright (c) 2017 Tomasz Kramkowski <tk@the-tk.com>
 */

/*
@@ -19,6 +25,34 @@

#include "hid-ids.h"

/*
 * Certain ELECOM mice misreport their button count meaning that they only work
 * correctly with the ELECOM mouse assistant software which is unavailable for
 * Linux. A four extra INPUT reports and a FEATURE report are described by the
 * report descriptor but it does not appear that these enable software to
 * control what the extra buttons map to. The only simple and straightforward
 * solution seems to involve fixing up the report descriptor.
 *
 * Report descriptor format:
 * Positions 13, 15, 21 and 31 store the button bit count, button usage minimum,
 * button usage maximum and padding bit count respectively.
 */
#define MOUSE_BUTTONS_MAX 8
static void mouse_button_fixup(struct hid_device *hdev,
			       __u8 *rdesc, unsigned int rsize,
			       int nbuttons)
{
	if (rsize < 32 || rdesc[12] != 0x95 ||
	    rdesc[14] != 0x75 || rdesc[15] != 0x01 ||
	    rdesc[20] != 0x29 || rdesc[30] != 0x75)
		return;
	hid_info(hdev, "Fixing up Elecom mouse button count\n");
	nbuttons = clamp(nbuttons, 0, MOUSE_BUTTONS_MAX);
	rdesc[13] = nbuttons;
	rdesc[21] = nbuttons;
	rdesc[31] = MOUSE_BUTTONS_MAX - nbuttons;
}

static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
		unsigned int *rsize)
{
@@ -31,45 +65,15 @@ static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
			rdesc[47] = 0x00;
		}
		break;
	case USB_DEVICE_ID_ELECOM_EX_G_WIRED:
	case USB_DEVICE_ID_ELECOM_EX_G_WIRELESS:
		mouse_button_fixup(hdev, rdesc, *rsize, 6);
		break;
	case USB_DEVICE_ID_ELECOM_DEFT_WIRED:
	case USB_DEVICE_ID_ELECOM_DEFT_WIRELESS:
	case USB_DEVICE_ID_ELECOM_HUGE_WIRED:
	case USB_DEVICE_ID_ELECOM_HUGE_WIRELESS:
		/* The DEFT/HUGE trackball has eight buttons, but its descriptor
		 * only reports five, disabling the three Fn buttons on the top
		 * of the mouse.
		 *
		 * Apply the following diff to the descriptor:
		 *
		 * Collection (Physical),              Collection (Physical),
		 *     Report ID (1),                      Report ID (1),
		 *     Report Count (5),           ->      Report Count (8),
		 *     Report Size (1),                    Report Size (1),
		 *     Usage Page (Button),                Usage Page (Button),
		 *     Usage Minimum (01h),                Usage Minimum (01h),
		 *     Usage Maximum (05h),        ->      Usage Maximum (08h),
		 *     Logical Minimum (0),                Logical Minimum (0),
		 *     Logical Maximum (1),                Logical Maximum (1),
		 *     Input (Variable),                   Input (Variable),
		 *     Report Count (1),           ->      Report Count (0),
		 *     Report Size (3),                    Report Size (3),
		 *     Input (Constant),                   Input (Constant),
		 *     Report Size (16),                   Report Size (16),
		 *     Report Count (2),                   Report Count (2),
		 *     Usage Page (Desktop),               Usage Page (Desktop),
		 *     Usage (X),                          Usage (X),
		 *     Usage (Y),                          Usage (Y),
		 *     Logical Minimum (-32768),           Logical Minimum (-32768),
		 *     Logical Maximum (32767),            Logical Maximum (32767),
		 *     Input (Variable, Relative),         Input (Variable, Relative),
		 * End Collection,                     End Collection,
		 */
		if (*rsize == 213 && rdesc[13] == 5 && rdesc[21] == 5) {
			hid_info(hdev, "Fixing up Elecom DEFT/HUGE Fn buttons\n");
			rdesc[13] = 8; /* Button/Variable Report Count */
			rdesc[21] = 8; /* Button/Variable Usage Maximum */
			rdesc[29] = 0; /* Button/Constant Report Count */
		}
		mouse_button_fixup(hdev, rdesc, *rsize, 8);
		break;
	}
	return rdesc;
@@ -77,6 +81,8 @@ static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,

static const struct hid_device_id elecom_devices[] = {
	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_EX_G_WIRED) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_EX_G_WIRELESS) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRED) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRELESS) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_HUGE_WIRED) },
+6 −1
Original line number Diff line number Diff line
@@ -178,7 +178,8 @@
#define USB_VENDOR_ID_ASUSTEK		0x0b05
#define USB_DEVICE_ID_ASUSTEK_LCM	0x1726
#define USB_DEVICE_ID_ASUSTEK_LCM2	0x175b
#define USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD	0x17e0
#define USB_DEVICE_ID_ASUSTEK_T100TA_KEYBOARD	0x17e0
#define USB_DEVICE_ID_ASUSTEK_T100TAF_KEYBOARD	0x1807
#define USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD	0x8502
#define USB_DEVICE_ID_ASUSTEK_T304_KEYBOARD	0x184a
#define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD	0x8585
@@ -370,6 +371,8 @@

#define USB_VENDOR_ID_ELECOM		0x056e
#define USB_DEVICE_ID_ELECOM_BM084	0x0061
#define USB_DEVICE_ID_ELECOM_EX_G_WIRED	0x00fb
#define USB_DEVICE_ID_ELECOM_EX_G_WIRELESS	0x00fc
#define USB_DEVICE_ID_ELECOM_DEFT_WIRED	0x00fe
#define USB_DEVICE_ID_ELECOM_DEFT_WIRELESS	0x00ff
#define USB_DEVICE_ID_ELECOM_HUGE_WIRED	0x010c
@@ -535,6 +538,7 @@
#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A	0x0a4a
#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A	0x0b4a
#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE		0x134a
#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A	0x094a

#define USB_VENDOR_ID_HUION		0x256c
#define USB_DEVICE_ID_HUION_TABLET	0x006e
@@ -1156,6 +1160,7 @@
#define USB_VENDOR_ID_PRIMAX	0x0461
#define USB_DEVICE_ID_PRIMAX_MOUSE_4D22	0x4d22
#define USB_DEVICE_ID_PRIMAX_KEYBOARD	0x4e05
#define USB_DEVICE_ID_PRIMAX_REZEL	0x4e72


#define USB_VENDOR_ID_RISO_KAGAKU	0x1294	/* Riso Kagaku Corp. */
Loading