diff options
| -rw-r--r-- | drivers/hid/Kconfig | 7 | ||||
| -rw-r--r-- | drivers/hid/Makefile | 1 | ||||
| -rw-r--r-- | drivers/hid/hid-core.c | 2 | ||||
| -rw-r--r-- | drivers/hid/hid-elo.c | 131 |
4 files changed, 141 insertions, 0 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index fb52f3f6de80..dd4fdb67c974 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
| @@ -217,6 +217,13 @@ config HID_ELECOM | |||
| 217 | ---help--- | 217 | ---help--- |
| 218 | Support for the ELECOM BM084 (bluetooth mouse). | 218 | Support for the ELECOM BM084 (bluetooth mouse). |
| 219 | 219 | ||
| 220 | config HID_ELO | ||
| 221 | tristate "ELO USB 4000/4500 touchscreen" | ||
| 222 | depends on USB_HID | ||
| 223 | ---help--- | ||
| 224 | Support for the ELO USB 4000/4500 touchscreens. Note that this is for | ||
| 225 | different devices than those handled by CONFIG_TOUCHSCREEN_USB_ELO. | ||
| 226 | |||
| 220 | config HID_EZKEY | 227 | config HID_EZKEY |
| 221 | tristate "Ezkey BTC 8193 keyboard" if EXPERT | 228 | tristate "Ezkey BTC 8193 keyboard" if EXPERT |
| 222 | depends on HID | 229 | depends on HID |
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 2065694f57ab..d1841ce0a30b 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile | |||
| @@ -48,6 +48,7 @@ obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o | |||
| 48 | obj-$(CONFIG_HID_DRAGONRISE) += hid-dr.o | 48 | obj-$(CONFIG_HID_DRAGONRISE) += hid-dr.o |
| 49 | obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o | 49 | obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o |
| 50 | obj-$(CONFIG_HID_ELECOM) += hid-elecom.o | 50 | obj-$(CONFIG_HID_ELECOM) += hid-elecom.o |
| 51 | obj-$(CONFIG_HID_ELO) += hid-elo.o | ||
| 51 | obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o | 52 | obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o |
| 52 | obj-$(CONFIG_HID_GYRATION) += hid-gyration.o | 53 | obj-$(CONFIG_HID_GYRATION) += hid-gyration.o |
| 53 | obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o | 54 | obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 264f55099940..b06bac2f04ed 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -1573,6 +1573,8 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
| 1573 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, | 1573 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, |
| 1574 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, | 1574 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, |
| 1575 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, | 1575 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, |
| 1576 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0009) }, | ||
| 1577 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0030) }, | ||
| 1576 | { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) }, | 1578 | { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) }, |
| 1577 | { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, | 1579 | { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, |
| 1578 | { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, | 1580 | { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, |
diff --git a/drivers/hid/hid-elo.c b/drivers/hid/hid-elo.c new file mode 100644 index 000000000000..56143e011f22 --- /dev/null +++ b/drivers/hid/hid-elo.c | |||
| @@ -0,0 +1,131 @@ | |||
| 1 | /* | ||
| 2 | * HID driver for ELO usb touchscreen 4000/4500 | ||
| 3 | * | ||
| 4 | * Copyright (c) 2013 Jiri Slaby | ||
| 5 | * | ||
| 6 | * Data parsing taken from elousb driver by Vojtech Pavlik. | ||
| 7 | * | ||
| 8 | * This driver is licensed under the terms of GPLv2. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #include <linux/hid.h> | ||
| 12 | #include <linux/input.h> | ||
| 13 | #include <linux/module.h> | ||
| 14 | |||
| 15 | #include "hid-ids.h" | ||
| 16 | |||
| 17 | static void elo_input_configured(struct hid_device *hdev, | ||
| 18 | struct hid_input *hidinput) | ||
| 19 | { | ||
| 20 | struct input_dev *input = hidinput->input; | ||
| 21 | |||
| 22 | set_bit(BTN_TOUCH, input->keybit); | ||
| 23 | set_bit(ABS_PRESSURE, input->absbit); | ||
| 24 | input_set_abs_params(input, ABS_PRESSURE, 0, 256, 0, 0); | ||
| 25 | } | ||
| 26 | |||
| 27 | static void elo_process_data(struct input_dev *input, const u8 *data, int size) | ||
| 28 | { | ||
| 29 | int press; | ||
| 30 | |||
| 31 | input_report_abs(input, ABS_X, (data[3] << 8) | data[2]); | ||
| 32 | input_report_abs(input, ABS_Y, (data[5] << 8) | data[4]); | ||
| 33 | |||
| 34 | press = 0; | ||
| 35 | if (data[1] & 0x80) | ||
| 36 | press = (data[7] << 8) | data[6]; | ||
| 37 | input_report_abs(input, ABS_PRESSURE, press); | ||
| 38 | |||
| 39 | if (data[1] & 0x03) { | ||
| 40 | input_report_key(input, BTN_TOUCH, 1); | ||
| 41 | input_sync(input); | ||
| 42 | } | ||
| 43 | |||
| 44 | if (data[1] & 0x04) | ||
| 45 | input_report_key(input, BTN_TOUCH, 0); | ||
| 46 | |||
| 47 | input_sync(input); | ||
| 48 | } | ||
| 49 | |||
| 50 | static int elo_raw_event(struct hid_device *hdev, struct hid_report *report, | ||
| 51 | u8 *data, int size) | ||
| 52 | { | ||
| 53 | struct hid_input *hidinput; | ||
| 54 | |||
| 55 | if (!(hdev->claimed & HID_CLAIMED_INPUT) || list_empty(&hdev->inputs)) | ||
| 56 | return 0; | ||
| 57 | |||
| 58 | hidinput = list_first_entry(&hdev->inputs, struct hid_input, list); | ||
| 59 | |||
| 60 | switch (report->id) { | ||
| 61 | case 0: | ||
| 62 | if (data[0] == 'T') { /* Mandatory ELO packet marker */ | ||
| 63 | elo_process_data(hidinput->input, data, size); | ||
| 64 | return 1; | ||
| 65 | } | ||
| 66 | break; | ||
| 67 | default: /* unknown report */ | ||
| 68 | /* Unknown report type; pass upstream */ | ||
| 69 | hid_info(hdev, "unknown report type %d\n", report->id); | ||
| 70 | break; | ||
| 71 | } | ||
| 72 | |||
| 73 | return 0; | ||
| 74 | } | ||
| 75 | |||
| 76 | static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
| 77 | { | ||
| 78 | int ret; | ||
| 79 | |||
| 80 | ret = hid_parse(hdev); | ||
| 81 | if (ret) { | ||
| 82 | hid_err(hdev, "parse failed\n"); | ||
| 83 | goto err_free; | ||
| 84 | } | ||
| 85 | |||
| 86 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
| 87 | if (ret) { | ||
| 88 | hid_err(hdev, "hw start failed\n"); | ||
| 89 | goto err_free; | ||
| 90 | } | ||
| 91 | |||
| 92 | return 0; | ||
| 93 | err_free: | ||
| 94 | return ret; | ||
| 95 | } | ||
| 96 | |||
| 97 | static void elo_remove(struct hid_device *hdev) | ||
| 98 | { | ||
| 99 | hid_hw_stop(hdev); | ||
| 100 | } | ||
| 101 | |||
| 102 | static const struct hid_device_id elo_devices[] = { | ||
| 103 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0009), }, | ||
| 104 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0030), }, | ||
| 105 | { } | ||
| 106 | }; | ||
| 107 | MODULE_DEVICE_TABLE(hid, elo_devices); | ||
| 108 | |||
| 109 | static struct hid_driver elo_driver = { | ||
| 110 | .name = "elo", | ||
| 111 | .id_table = elo_devices, | ||
| 112 | .probe = elo_probe, | ||
| 113 | .remove = elo_remove, | ||
| 114 | .raw_event = elo_raw_event, | ||
| 115 | .input_configured = elo_input_configured, | ||
| 116 | }; | ||
| 117 | |||
| 118 | static int __init elo_driver_init(void) | ||
| 119 | { | ||
| 120 | return hid_register_driver(&elo_driver); | ||
| 121 | } | ||
| 122 | module_init(elo_driver_init); | ||
| 123 | |||
| 124 | static void __exit elo_driver_exit(void) | ||
| 125 | { | ||
| 126 | hid_unregister_driver(&elo_driver); | ||
| 127 | } | ||
| 128 | module_exit(elo_driver_exit); | ||
| 129 | |||
| 130 | MODULE_AUTHOR("Jiri Slaby <jslaby@suse.cz>"); | ||
| 131 | MODULE_LICENSE("GPL"); | ||
