Commit 3abee352 authored by Jiri Kosina's avatar Jiri Kosina

Merge branches 'battery-scope', 'logitech' and 'multitouch' into for-linus

...@@ -354,7 +354,9 @@ config HID_MULTITOUCH ...@@ -354,7 +354,9 @@ config HID_MULTITOUCH
- LG Display panels (Dell ST2220Tc) - LG Display panels (Dell ST2220Tc)
- Lumio CrystalTouch panels - Lumio CrystalTouch panels
- MosArt dual-touch panels - MosArt dual-touch panels
- Panasonic multitouch panels
- PenMount dual touch panels - PenMount dual touch panels
- Perixx Peripad 701 touchpad
- PixArt optical touch screen - PixArt optical touch screen
- Pixcir dual touch panels - Pixcir dual touch panels
- Quanta panels - Quanta panels
......
...@@ -1232,7 +1232,6 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) ...@@ -1232,7 +1232,6 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
hdev->claimed |= HID_CLAIMED_INPUT; hdev->claimed |= HID_CLAIMED_INPUT;
if (hdev->quirks & HID_QUIRK_MULTITOUCH) { if (hdev->quirks & HID_QUIRK_MULTITOUCH) {
/* this device should be handled by hid-multitouch, skip it */ /* this device should be handled by hid-multitouch, skip it */
hdev->quirks &= ~HID_QUIRK_MULTITOUCH;
return -ENODEV; return -ENODEV;
} }
...@@ -1409,6 +1408,8 @@ static const struct hid_device_id hid_have_special_driver[] = { ...@@ -1409,6 +1408,8 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) }, { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) },
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) }, { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) },
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) }, { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) },
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) },
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) }, { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) },
{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) }, { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
...@@ -1501,6 +1502,8 @@ static const struct hid_device_id hid_have_special_driver[] = { ...@@ -1501,6 +1502,8 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PANASONIC, USB_DEVICE_ID_PANABOARD_UBT780) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PANASONIC, USB_DEVICE_ID_PANABOARD_UBT880) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_PCI) }, { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_PCI) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) }, { HID_USB_DEVICE(USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) },
...@@ -1663,6 +1666,10 @@ static int hid_bus_match(struct device *dev, struct device_driver *drv) ...@@ -1663,6 +1666,10 @@ static int hid_bus_match(struct device *dev, struct device_driver *drv)
struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
struct hid_device *hdev = container_of(dev, struct hid_device, dev); struct hid_device *hdev = container_of(dev, struct hid_device, dev);
if ((hdev->quirks & HID_QUIRK_MULTITOUCH) &&
!strncmp(hdrv->name, "hid-multitouch", 14))
return 1;
if (!hid_match_device(hdev, hdrv)) if (!hid_match_device(hdev, hdrv))
return 0; return 0;
...@@ -1687,9 +1694,12 @@ static int hid_device_probe(struct device *dev) ...@@ -1687,9 +1694,12 @@ static int hid_device_probe(struct device *dev)
if (!hdev->driver) { if (!hdev->driver) {
id = hid_match_device(hdev, hdrv); id = hid_match_device(hdev, hdrv);
if (id == NULL) { if (id == NULL) {
if (!((hdev->quirks & HID_QUIRK_MULTITOUCH) &&
!strncmp(hdrv->name, "hid-multitouch", 14))) {
ret = -ENODEV; ret = -ENODEV;
goto unlock; goto unlock;
} }
}
hdev->driver = hdrv; hdev->driver = hdrv;
if (hdrv->probe) { if (hdrv->probe) {
......
...@@ -152,6 +152,7 @@ ...@@ -152,6 +152,7 @@
#define USB_VENDOR_ID_ATMEL 0x03eb #define USB_VENDOR_ID_ATMEL 0x03eb
#define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c
#define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118
#define USB_VENDOR_ID_AVERMEDIA 0x07ca #define USB_VENDOR_ID_AVERMEDIA 0x07ca
#define USB_DEVICE_ID_AVER_FM_MR800 0xb800 #define USB_DEVICE_ID_AVER_FM_MR800 0xb800
...@@ -240,11 +241,18 @@ ...@@ -240,11 +241,18 @@
#define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001 #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D 0x480d #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D 0x480d
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E 0x480e #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E 0x480e
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207 0x7207
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C 0x720c #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C 0x720c
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224 0x7224
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A 0x722A
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E 0x725e
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262 0x7262
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B 0x726b #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B 0x726b
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA 0x72aa
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1 0x72a1 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1 0x72a1
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA 0x72fa #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA 0x72fa
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302 0x7302 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302 0x7302
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349 0x7349
#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001
#define USB_VENDOR_ID_ELECOM 0x056e #define USB_VENDOR_ID_ELECOM 0x056e
...@@ -377,6 +385,7 @@ ...@@ -377,6 +385,7 @@
#define USB_VENDOR_ID_IDEACOM 0x1cb6 #define USB_VENDOR_ID_IDEACOM 0x1cb6
#define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650 #define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650
#define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651
#define USB_VENDOR_ID_ILITEK 0x222a #define USB_VENDOR_ID_ILITEK 0x222a
#define USB_DEVICE_ID_ILITEK_MULTITOUCH 0x0001 #define USB_DEVICE_ID_ILITEK_MULTITOUCH 0x0001
...@@ -568,6 +577,10 @@ ...@@ -568,6 +577,10 @@
#define USB_DEVICE_ID_ORTEK_PKB1700 0x1700 #define USB_DEVICE_ID_ORTEK_PKB1700 0x1700
#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000 #define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
#define USB_VENDOR_ID_PANASONIC 0x04da
#define USB_DEVICE_ID_PANABOARD_UBT780 0x1044
#define USB_DEVICE_ID_PANABOARD_UBT880 0x104d
#define USB_VENDOR_ID_PANJIT 0x134c #define USB_VENDOR_ID_PANJIT 0x134c
#define USB_VENDOR_ID_PANTHERLORD 0x0810 #define USB_VENDOR_ID_PANTHERLORD 0x0810
...@@ -662,6 +675,7 @@ ...@@ -662,6 +675,7 @@
#define USB_VENDOR_ID_TOPSEED2 0x1784 #define USB_VENDOR_ID_TOPSEED2 0x1784
#define USB_DEVICE_ID_TOPSEED2_RF_COMBO 0x0004 #define USB_DEVICE_ID_TOPSEED2_RF_COMBO 0x0004
#define USB_DEVICE_ID_TOPSEED2_PERIPAD_701 0x0016
#define USB_VENDOR_ID_TOPMAX 0x0663 #define USB_VENDOR_ID_TOPMAX 0x0663
#define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 #define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103
......
...@@ -279,7 +279,8 @@ static enum power_supply_property hidinput_battery_props[] = { ...@@ -279,7 +279,8 @@ static enum power_supply_property hidinput_battery_props[] = {
POWER_SUPPLY_PROP_ONLINE, POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_STATUS POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_SCOPE,
}; };
#define HID_BATTERY_QUIRK_PERCENT (1 << 0) /* always reports percent */ #define HID_BATTERY_QUIRK_PERCENT (1 << 0) /* always reports percent */
...@@ -344,6 +345,10 @@ static int hidinput_get_battery_property(struct power_supply *psy, ...@@ -344,6 +345,10 @@ static int hidinput_get_battery_property(struct power_supply *psy,
val->intval = POWER_SUPPLY_STATUS_DISCHARGING; val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
break; break;
case POWER_SUPPLY_PROP_SCOPE:
val->intval = POWER_SUPPLY_SCOPE_DEVICE;
break;
default: default:
ret = -EINVAL; ret = -EINVAL;
break; break;
...@@ -403,6 +408,8 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type, ...@@ -403,6 +408,8 @@ static bool hidinput_setup_battery(struct hid_device *dev, unsigned report_type,
battery->name = NULL; battery->name = NULL;
} }
power_supply_powers(battery, &dev->dev);
out: out:
return true; return true;
} }
......
...@@ -445,7 +445,7 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, ...@@ -445,7 +445,7 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
dj_report.report_id = REPORT_ID_DJ_SHORT; dj_report.report_id = REPORT_ID_DJ_SHORT;
dj_report.device_index = 0xFF; dj_report.device_index = 0xFF;
dj_report.report_type = REPORT_TYPE_CMD_SWITCH; dj_report.report_type = REPORT_TYPE_CMD_SWITCH;
dj_report.report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x1F; dj_report.report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F;
dj_report.report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout; dj_report.report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout;
return logi_dj_recv_send_report(djrcv_dev, &dj_report); return logi_dj_recv_send_report(djrcv_dev, &dj_report);
} }
......
/* /*
* HID driver for multitouch panels * HID driver for multitouch panels
* *
* Copyright (c) 2010-2011 Stephane Chatty <chatty@enac.fr> * Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr>
* Copyright (c) 2010-2011 Benjamin Tissoires <benjamin.tissoires@gmail.com> * Copyright (c) 2010-2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
* Copyright (c) 2010-2011 Ecole Nationale de l'Aviation Civile, France * Copyright (c) 2010-2012 Ecole Nationale de l'Aviation Civile, France
* *
* This code is partly based on hid-egalax.c: * This code is partly based on hid-egalax.c:
* *
...@@ -67,6 +67,7 @@ struct mt_class { ...@@ -67,6 +67,7 @@ struct mt_class {
__s32 sn_height; /* Signal/noise ratio for height events */ __s32 sn_height; /* Signal/noise ratio for height events */
__s32 sn_pressure; /* Signal/noise ratio for pressure events */ __s32 sn_pressure; /* Signal/noise ratio for pressure events */
__u8 maxcontacts; __u8 maxcontacts;
bool is_indirect; /* true for touchpads */
}; };
struct mt_device { struct mt_device {
...@@ -74,11 +75,15 @@ struct mt_device { ...@@ -74,11 +75,15 @@ struct mt_device {
struct mt_class mtclass; /* our mt device class */ struct mt_class mtclass; /* our mt device class */
unsigned last_field_index; /* last field index of the report */ unsigned last_field_index; /* last field index of the report */
unsigned last_slot_field; /* the last field of a slot */ unsigned last_slot_field; /* the last field of a slot */
int last_mt_collection; /* last known mt-related collection */
__s8 inputmode; /* InputMode HID feature, -1 if non-existent */ __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
__s8 maxcontact_report_id; /* Maximum Contact Number HID feature,
-1 if non-existent */
__u8 num_received; /* how many contacts we received */ __u8 num_received; /* how many contacts we received */
__u8 num_expected; /* expected last contact index */ __u8 num_expected; /* expected last contact index */
__u8 maxcontacts; __u8 maxcontacts;
__u8 touches_by_report; /* how many touches are present in one report:
* 1 means we should use a serial protocol
* > 1 means hybrid (multitouch) protocol */
bool curvalid; /* is the current contact valid? */ bool curvalid; /* is the current contact valid? */
struct mt_slot *slots; struct mt_slot *slots;
}; };
...@@ -100,6 +105,8 @@ struct mt_device { ...@@ -100,6 +105,8 @@ struct mt_device {
#define MT_CLS_CYPRESS 0x0102 #define MT_CLS_CYPRESS 0x0102
#define MT_CLS_EGALAX 0x0103 #define MT_CLS_EGALAX 0x0103
#define MT_CLS_EGALAX_SERIAL 0x0104 #define MT_CLS_EGALAX_SERIAL 0x0104
#define MT_CLS_TOPSEED 0x0105
#define MT_CLS_PANASONIC 0x0106
#define MT_DEFAULT_MAXCONTACT 10 #define MT_DEFAULT_MAXCONTACT 10
...@@ -189,6 +196,14 @@ static struct mt_class mt_classes[] = { ...@@ -189,6 +196,14 @@ static struct mt_class mt_classes[] = {
.sn_move = 4096, .sn_move = 4096,
.sn_pressure = 32, .sn_pressure = 32,
}, },
{ .name = MT_CLS_TOPSEED,
.quirks = MT_QUIRK_ALWAYS_VALID,
.is_indirect = true,
.maxcontacts = 2,
},
{ .name = MT_CLS_PANASONIC,
.quirks = MT_QUIRK_NOT_SEEN_MEANS_UP,
.maxcontacts = 4 },
{ } { }
}; };
...@@ -241,6 +256,7 @@ static void mt_feature_mapping(struct hid_device *hdev, ...@@ -241,6 +256,7 @@ static void mt_feature_mapping(struct hid_device *hdev,
td->inputmode = field->report->id; td->inputmode = field->report->id;
break; break;
case HID_DG_CONTACTMAX: case HID_DG_CONTACTMAX:
td->maxcontact_report_id = field->report->id;
td->maxcontacts = field->value[0]; td->maxcontacts = field->value[0];
if (td->mtclass.maxcontacts) if (td->mtclass.maxcontacts)
/* check if the maxcontacts is given by the class */ /* check if the maxcontacts is given by the class */
...@@ -259,23 +275,44 @@ static void set_abs(struct input_dev *input, unsigned int code, ...@@ -259,23 +275,44 @@ static void set_abs(struct input_dev *input, unsigned int code,
input_set_abs_params(input, code, fmin, fmax, fuzz, 0); input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
} }
static void set_last_slot_field(struct hid_usage *usage, struct mt_device *td,
struct hid_input *hi)
{
if (!test_bit(usage->hid, hi->input->absbit))
td->last_slot_field = usage->hid;
}
static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, static int mt_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)
{ {
struct mt_device *td = hid_get_drvdata(hdev); struct mt_device *td = hid_get_drvdata(hdev);
struct mt_class *cls = &td->mtclass; struct mt_class *cls = &td->mtclass;
int code;
/* Only map fields from TouchScreen or TouchPad collections. /* Only map fields from TouchScreen or TouchPad collections.
* We need to ignore fields that belong to other collections * We need to ignore fields that belong to other collections
* such as Mouse that might have the same GenericDesktop usages. */ * such as Mouse that might have the same GenericDesktop usages. */
if (field->application == HID_DG_TOUCHSCREEN) if (field->application == HID_DG_TOUCHSCREEN)
set_bit(INPUT_PROP_DIRECT, hi->input->propbit); set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
else if (field->application == HID_DG_TOUCHPAD) else if (field->application != HID_DG_TOUCHPAD)
set_bit(INPUT_PROP_POINTER, hi->input->propbit);
else
return 0; return 0;
/* In case of an indirect device (touchpad), we need to add
* specific BTN_TOOL_* to be handled by the synaptics xorg
* driver.
* We also consider that touchscreens providing buttons are touchpads.
*/
if (field->application == HID_DG_TOUCHPAD ||
(usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON ||
cls->is_indirect) {
set_bit(INPUT_PROP_POINTER, hi->input->propbit);
set_bit(BTN_TOOL_FINGER, hi->input->keybit);
set_bit(BTN_TOOL_DOUBLETAP, hi->input->keybit);
set_bit(BTN_TOOL_TRIPLETAP, hi->input->keybit);
set_bit(BTN_TOOL_QUADTAP, hi->input->keybit);
}
/* eGalax devices provide a Digitizer.Stylus input which overrides /* eGalax devices provide a Digitizer.Stylus input which overrides
* the correct Digitizers.Finger X/Y ranges. * the correct Digitizers.Finger X/Y ranges.
* Let's just ignore this input. */ * Let's just ignore this input. */
...@@ -293,10 +330,8 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, ...@@ -293,10 +330,8 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
cls->sn_move); cls->sn_move);
/* touchscreen emulation */ /* touchscreen emulation */
set_abs(hi->input, ABS_X, field, cls->sn_move); set_abs(hi->input, ABS_X, field, cls->sn_move);
if (td->last_mt_collection == usage->collection_index) { set_last_slot_field(usage, td, hi);
td->last_slot_field = usage->hid;
td->last_field_index = field->index; td->last_field_index = field->index;
}
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,
...@@ -305,10 +340,8 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, ...@@ -305,10 +340,8 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
cls->sn_move); cls->sn_move);
/* touchscreen emulation */ /* touchscreen emulation */
set_abs(hi->input, ABS_Y, field, cls->sn_move); set_abs(hi->input, ABS_Y, field, cls->sn_move);
if (td->last_mt_collection == usage->collection_index) { set_last_slot_field(usage, td, hi);
td->last_slot_field = usage->hid;
td->last_field_index = field->index; td->last_field_index = field->index;
}
return 1; return 1;
} }
return 0; return 0;
...@@ -316,24 +349,18 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, ...@@ -316,24 +349,18 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
case HID_UP_DIGITIZER: case HID_UP_DIGITIZER:
switch (usage->hid) { switch (usage->hid) {
case HID_DG_INRANGE: case HID_DG_INRANGE:
if (td->last_mt_collection == usage->collection_index) { set_last_slot_field(usage, td, hi);
td->last_slot_field = usage->hid;
td->last_field_index = field->index; td->last_field_index = field->index;
}
return 1; return 1;
case HID_DG_CONFIDENCE: case HID_DG_CONFIDENCE:
if (td->last_mt_collection == usage->collection_index) { set_last_slot_field(usage, td, hi);
td->last_slot_field = usage->hid;
td->last_field_index = field->index; td->last_field_index = field->index;
}
return 1; return 1;
case HID_DG_TIPSWITCH: case HID_DG_TIPSWITCH:
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); input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
if (td->last_mt_collection == usage->collection_index) { set_last_slot_field(usage, td, hi);
td->last_slot_field = usage->hid;
td->last_field_index = field->index; td->last_field_index = field->index;
}
return 1; return 1;
case HID_DG_CONTACTID: case HID_DG_CONTACTID:
if (!td->maxcontacts) if (!td->maxcontacts)
...@@ -341,17 +368,15 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, ...@@ -341,17 +368,15 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
input_mt_init_slots(hi->input, td->maxcontacts); input_mt_init_slots(hi->input, td->maxcontacts);
td->last_slot_field = usage->hid; td->last_slot_field = usage->hid;
td->last_field_index = field->index; td->last_field_index = field->index;
td->last_mt_collection = usage->collection_index; td->touches_by_report++;
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);
set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field, set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
cls->sn_width); cls->sn_width);
if (td->last_mt_collection == usage->collection_index) { set_last_slot_field(usage, td, hi);
td->last_slot_field = usage->hid;
td->last_field_index = field->index; td->last_field_index = field->index;
}
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,
...@@ -360,10 +385,8 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, ...@@ -360,10 +385,8 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
cls->sn_height); cls->sn_height);
input_set_abs_params(hi->input, input_set_abs_params(hi->input,
ABS_MT_ORIENTATION, 0, 1, 0, 0); ABS_MT_ORIENTATION, 0, 1, 0, 0);
if (td->last_mt_collection == usage->collection_index) { set_last_slot_field(usage, td, hi);
td->last_slot_field = usage->hid;
td->last_field_index = field->index; td->last_field_index = field->index;
}
return 1; return 1;
case HID_DG_TIPPRESSURE: case HID_DG_TIPPRESSURE:
hid_map_usage(hi, usage, bit, max, hid_map_usage(hi, usage, bit, max,
...@@ -373,25 +396,31 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, ...@@ -373,25 +396,31 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
/* touchscreen emulation */ /* touchscreen emulation */
set_abs(hi->input, ABS_PRESSURE, field, set_abs(hi->input, ABS_PRESSURE, field,
cls->sn_pressure); cls->sn_pressure);
if (td->last_mt_collection == usage->collection_index) { set_last_slot_field(usage, td, hi);
td->last_slot_field = usage->hid;
td->last_field_index = field->index; td->last_field_index = field->index;
}
return 1; return 1;
case HID_DG_CONTACTCOUNT: case HID_DG_CONTACTCOUNT:
if (td->last_mt_collection == usage->collection_index)
td->last_field_index = field->index; td->last_field_index = field->index;
return 1; return 1;
case HID_DG_CONTACTMAX: case HID_DG_CONTACTMAX:
/* we don't set td->last_slot_field as contactcount and /* we don't set td->last_slot_field as contactcount and
* contact max are global to the report */ * contact max are global to the report */
if (td->last_mt_collection == usage->collection_index)
td->last_field_index = field->index; td->last_field_index = field->index;
return -1; return -1;
} }
case HID_DG_TOUCH:
/* Legacy devices use TIPSWITCH and not TOUCH.
* Let's just ignore this field. */
return -1;
/* let hid-input decide for the others */ /* let hid-input decide for the others */
return 0; return 0;
case HID_UP_BUTTON:
code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE);
hid_map_usage(hi, usage, bit, max, EV_KEY, code);
input_set_capability(hi->input, EV_KEY, code);
return 1;
case 0xff000000: case 0xff000000:
/* we do not want to map these: no input-oriented meaning */ /* we do not want to map these: no input-oriented meaning */
return -1; return -1;
...@@ -538,15 +567,17 @@ static int mt_event(struct hid_device *hid, struct hid_field *field, ...@@ -538,15 +567,17 @@ static int mt_event(struct hid_device *hid, struct hid_field *field,
if (value) if (value)
td->num_expected = value; td->num_expected = value;
break; break;
case HID_DG_TOUCH:
/* do nothing */
break;
default: default:
/* fallback to the generic hidinput handling */ /* fallback to the generic hidinput handling */
return 0; return 0;
} }
if (usage->hid == td->last_slot_field) { if (usage->hid == td->last_slot_field)
mt_complete_slot(td); mt_complete_slot(td);
}
if (field->index == td->last_field_index if (field->index == td->last_field_index
&& td->num_received >= td->num_expected) && td->num_received >= td->num_expected)
...@@ -578,23 +609,52 @@ static void mt_set_input_mode(struct hid_device *hdev) ...@@ -578,23 +609,52 @@ static void mt_set_input_mode(struct hid_device *hdev)
} }
} }
static void mt_set_maxcontacts(struct hid_device *hdev)
{
struct mt_device *td = hid_get_drvdata(hdev);
struct hid_report *r;
struct hid_report_enum *re;
int fieldmax, max;
if (td->maxcontact_report_id < 0)
return;
if (!td->mtclass.maxcontacts)
return;
re = &hdev->report_enum[HID_FEATURE_REPORT];
r = re->report_id_hash[td->maxcontact_report_id];
if (r) {
max = td->mtclass.maxcontacts;
fieldmax = r->field[0]->logical_maximum;
max = min(fieldmax, max);
if (r->field[0]->value[0] != max) {
r->field[0]->value[0] = max;
usbhid_submit_report(hdev, r, USB_DIR_OUT);
}
}
}
static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
{ {
int ret, i; int ret, i;
struct mt_device *td; struct mt_device *td;
struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
if (id) {
for (i = 0; mt_classes[i].name ; i++) { for (i = 0; mt_classes[i].name ; i++) {
if (id->driver_data == mt_classes[i].name) { if (id->driver_data == mt_classes[i].name) {
mtclass = &(mt_classes[i]); mtclass = &(mt_classes[i]);
break; break;
} }
} }
}
/* This allows the driver to correctly support devices /* This allows the driver to correctly support devices
* that emit events over several HID messages. * that emit events over several HID messages.
*/ */
hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
hdev->quirks &= ~HID_QUIRK_MULTITOUCH;
td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
if (!td) { if (!td) {
...@@ -603,7 +663,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -603,7 +663,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
} }
td->mtclass = *mtclass; td->mtclass = *mtclass;
td->inputmode = -1; td->inputmode = -1;
td->last_mt_collection = -1; td->maxcontact_report_id = -1;
hid_set_drvdata(hdev, td); hid_set_drvdata(hdev, td);
ret = hid_parse(hdev); ret = hid_parse(hdev);
...@@ -614,6 +674,15 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -614,6 +674,15 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
if (ret) if (ret)
goto fail; goto fail;
if (!id && td->touches_by_report == 1) {
/* the device has been sent by hid-generic */
mtclass = &td->mtclass;
mtclass->quirks |= MT_QUIRK_ALWAYS_VALID;
mtclass->quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;
mtclass->quirks &= ~MT_QUIRK_VALID_IS_INRANGE;
mtclass->quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;
}
td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
GFP_KERNEL); GFP_KERNEL);
if (!td->slots) { if (!td->slots) {
...@@ -625,6 +694,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -625,6 +694,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group); ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
mt_set_maxcontacts(hdev);
mt_set_input_mode(hdev); mt_set_input_mode(hdev);
return 0; return 0;
...@@ -637,6 +707,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -637,6 +707,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int mt_reset_resume(struct hid_device *hdev) static int mt_reset_resume(struct hid_device *hdev)
{ {
mt_set_maxcontacts(hdev);
mt_set_input_mode(hdev); mt_set_input_mode(hdev);
return 0; return 0;
} }
...@@ -674,6 +745,9 @@ static const struct hid_device_id mt_devices[] = { ...@@ -674,6 +745,9 @@ static const struct hid_device_id mt_devices[] = {
{ .driver_data = MT_CLS_SERIAL, { .driver_data = MT_CLS_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_ATMEL, HID_USB_DEVICE(USB_VENDOR_ID_ATMEL,
USB_DEVICE_ID_ATMEL_MULTITOUCH) }, USB_DEVICE_ID_ATMEL_MULTITOUCH) },
{ .driver_data = MT_CLS_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_ATMEL,
USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },
/* Cando panels */ /* Cando panels */
{ .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER, { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
...@@ -716,18 +790,39 @@ static const struct hid_device_id mt_devices[] = { ...@@ -716,18 +790,39 @@ static const struct hid_device_id mt_devices[] = {
{ .driver_data = MT_CLS_EGALAX, { .driver_data = MT_CLS_EGALAX,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV, HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) }, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
{ .driver_data = MT_CLS_EGALAX_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207) },
{ .driver_data = MT_CLS_EGALAX_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) },
{ .driver_data = MT_CLS_EGALAX_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) },
{ .driver_data = MT_CLS_EGALAX_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A) },
{ .driver_data = MT_CLS_EGALAX, { .driver_data = MT_CLS_EGALAX,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV, HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) }, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
{ .driver_data = MT_CLS_EGALAX_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262) },
{ .driver_data = MT_CLS_EGALAX, { .driver_data = MT_CLS_EGALAX,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV, HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) }, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) },
{ .driver_data = MT_CLS_EGALAX_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA) },
{ .driver_data = MT_CLS_EGALAX, { .driver_data = MT_CLS_EGALAX,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV, HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) }, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) },
{ .driver_data = MT_CLS_EGALAX, { .driver_data = MT_CLS_EGALAX,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV, HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) }, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
{ .driver_data = MT_CLS_EGALAX_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349) },
{ .driver_data = MT_CLS_EGALAX_SERIAL, { .driver_data = MT_CLS_EGALAX_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_DWAV, HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
...@@ -756,6 +851,9 @@ static const struct hid_device_id mt_devices[] = { ...@@ -756,6 +851,9 @@ static const struct hid_device_id mt_devices[] = {
{ .driver_data = MT_CLS_SERIAL, { .driver_data = MT_CLS_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
USB_DEVICE_ID_IDEACOM_IDC6650) }, USB_DEVICE_ID_IDEACOM_IDC6650) },
{ .driver_data = MT_CLS_SERIAL,
HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
USB_DEVICE_ID_IDEACOM_IDC6651) },
/* Ilitek dual touch panel */ /* Ilitek dual touch panel */
{ .driver_data = MT_CLS_DEFAULT, { .driver_data = MT_CLS_DEFAULT,
...@@ -791,6 +889,14 @@ static const struct hid_device_id mt_devices[] = { ...@@ -791,6 +889,14 @@ static const struct hid_device_id mt_devices[] = {
HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, HID_USB_DEVICE(USB_VENDOR_ID_TURBOX,
USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) }, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
/* Panasonic panels */
{ .driver_data = MT_CLS_PANASONIC,
HID_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
USB_DEVICE_ID_PANABOARD_UBT780) },
{ .driver_data = MT_CLS_PANASONIC,
HID_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
USB_DEVICE_ID_PANABOARD_UBT880) },
/* PenMount panels */ /* PenMount panels */
{ .driver_data = MT_CLS_CONFIDENCE, { .driver_data = MT_CLS_CONFIDENCE,
HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
...@@ -837,6 +943,11 @@ static const struct hid_device_id mt_devices[] = { ...@@ -837,6 +943,11 @@ static const struct hid_device_id mt_devices[] = {
HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX, HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
USB_DEVICE_ID_MTP_SITRONIX)}, USB_DEVICE_ID_MTP_SITRONIX)},
/* TopSeed panels */
{ .driver_data = MT_CLS_TOPSEED,
HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2,
USB_DEVICE_ID_TOPSEED2_PERIPAD_701) },
/* Touch International panels */ /* Touch International panels */
{ .driver_data = MT_CLS_DEFAULT, { .driver_data = MT_CLS_DEFAULT,
HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL, HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
......
...@@ -74,6 +74,7 @@ static const struct hid_blacklist { ...@@ -74,6 +74,7 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET }, { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment