Skip to content

Commit b77b907

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: fix suspend crash by moving initializations earlier HID: sony: fix sony_set_operational_bt HID: ntrig: Remove unused macro, TripleTap and QuadTap HID: ntrig: TipSwitch for single touch mode touch. HID: hidraw: fix numbered reports HID: wacom: remove annoying non-error printk HID: ntrig: Emit TOUCH with DOUBLETAP for single touch HID: add support for cymotion master solar keyboard HID: ntrig: explain firmware quirk HID: fix N-trig touch panel with recent firmware
2 parents b57f95a + fde4e2f commit b77b907

File tree

7 files changed

+46
-54
lines changed

7 files changed

+46
-54
lines changed

drivers/hid/hid-cherry.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
5959

6060
static const struct hid_device_id ch_devices[] = {
6161
{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
62+
{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) },
6263
{ }
6364
};
6465
MODULE_DEVICE_TABLE(hid, ch_devices);

drivers/hid/hid-core.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,13 +1043,8 @@ void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
10431043

10441044
if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
10451045
hid->hiddev_report_event(hid, report);
1046-
if (hid->claimed & HID_CLAIMED_HIDRAW) {
1047-
/* numbered reports need to be passed with the report num */
1048-
if (report_enum->numbered)
1049-
hidraw_report_event(hid, data - 1, size + 1);
1050-
else
1051-
hidraw_report_event(hid, data, size);
1052-
}
1046+
if (hid->claimed & HID_CLAIMED_HIDRAW)
1047+
hidraw_report_event(hid, data, size);
10531048

10541049
for (a = 0; a < report->maxfield; a++)
10551050
hid_input_field(hid, report->field[a], cdata, interrupt);
@@ -1296,6 +1291,7 @@ static const struct hid_device_id hid_blacklist[] = {
12961291
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
12971292
{ HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
12981293
{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
1294+
{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) },
12991295
{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
13001296
{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
13011297
{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131

132132
#define USB_VENDOR_ID_CHERRY 0x046a
133133
#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023
134+
#define USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR 0x0027
134135

135136
#define USB_VENDOR_ID_CHIC 0x05fe
136137
#define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014

drivers/hid/hid-ntrig.c

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* HID driver for N-Trig touchscreens
33
*
4-
* Copyright (c) 2008 Rafi Rubin
5-
* Copyright (c) 2009 Stephane Chatty
4+
* Copyright (c) 2008-2010 Rafi Rubin
5+
* Copyright (c) 2009-2010 Stephane Chatty
66
*
77
*/
88

@@ -15,24 +15,25 @@
1515

1616
#include <linux/device.h>
1717
#include <linux/hid.h>
18+
#include <linux/usb.h>
19+
#include "usbhid/usbhid.h"
1820
#include <linux/module.h>
1921
#include <linux/slab.h>
2022

2123
#include "hid-ids.h"
2224

2325
#define NTRIG_DUPLICATE_USAGES 0x001
2426

25-
#define nt_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
26-
EV_KEY, (c))
27-
2827
struct ntrig_data {
2928
/* Incoming raw values for a single contact */
3029
__u16 x, y, w, h;
3130
__u16 id;
32-
__u8 confidence;
31+
32+
bool tipswitch;
33+
bool confidence;
34+
bool first_contact_touch;
3335

3436
bool reading_mt;
35-
__u8 first_contact_confidence;
3637

3738
__u8 mt_footer[4];
3839
__u8 mt_foot_count;
@@ -139,9 +140,10 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
139140
case 0xff000001:
140141
/* Tag indicating the start of a multitouch group */
141142
nd->reading_mt = 1;
142-
nd->first_contact_confidence = 0;
143+
nd->first_contact_touch = 0;
143144
break;
144145
case HID_DG_TIPSWITCH:
146+
nd->tipswitch = value;
145147
/* Prevent emission of touch until validated */
146148
return 1;
147149
case HID_DG_CONFIDENCE:
@@ -169,8 +171,14 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
169171
* to emit a normal (X, Y) position
170172
*/
171173
if (!nd->reading_mt) {
174+
/*
175+
* TipSwitch indicates the presence of a
176+
* finger in single touch mode.
177+
*/
178+
input_report_key(input, BTN_TOUCH,
179+
nd->tipswitch);
172180
input_report_key(input, BTN_TOOL_DOUBLETAP,
173-
(nd->confidence != 0));
181+
nd->tipswitch);
174182
input_event(input, EV_ABS, ABS_X, nd->x);
175183
input_event(input, EV_ABS, ABS_Y, nd->y);
176184
}
@@ -209,7 +217,13 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
209217

210218
/* emit a normal (X, Y) for the first point only */
211219
if (nd->id == 0) {
212-
nd->first_contact_confidence = nd->confidence;
220+
/*
221+
* TipSwitch is superfluous in multitouch
222+
* mode. The footer events tell us
223+
* if there is a finger on the screen or
224+
* not.
225+
*/
226+
nd->first_contact_touch = nd->confidence;
213227
input_event(input, EV_ABS, ABS_X, nd->x);
214228
input_event(input, EV_ABS, ABS_Y, nd->y);
215229
}
@@ -239,30 +253,11 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
239253

240254
nd->reading_mt = 0;
241255

242-
if (nd->first_contact_confidence) {
243-
switch (value) {
244-
case 0: /* for single touch devices */
245-
case 1:
246-
input_report_key(input,
247-
BTN_TOOL_DOUBLETAP, 1);
248-
break;
249-
case 2:
250-
input_report_key(input,
251-
BTN_TOOL_TRIPLETAP, 1);
252-
break;
253-
case 3:
254-
default:
255-
input_report_key(input,
256-
BTN_TOOL_QUADTAP, 1);
257-
}
256+
if (nd->first_contact_touch) {
257+
input_report_key(input, BTN_TOOL_DOUBLETAP, 1);
258258
input_report_key(input, BTN_TOUCH, 1);
259259
} else {
260-
input_report_key(input,
261-
BTN_TOOL_DOUBLETAP, 0);
262-
input_report_key(input,
263-
BTN_TOOL_TRIPLETAP, 0);
264-
input_report_key(input,
265-
BTN_TOOL_QUADTAP, 0);
260+
input_report_key(input, BTN_TOOL_DOUBLETAP, 0);
266261
input_report_key(input, BTN_TOUCH, 0);
267262
}
268263
break;
@@ -286,6 +281,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
286281
struct ntrig_data *nd;
287282
struct hid_input *hidinput;
288283
struct input_dev *input;
284+
struct hid_report *report;
289285

290286
if (id->driver_data)
291287
hdev->quirks |= HID_QUIRK_MULTI_INPUT;
@@ -327,13 +323,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
327323
__clear_bit(BTN_TOOL_PEN, input->keybit);
328324
__clear_bit(BTN_TOOL_FINGER, input->keybit);
329325
__clear_bit(BTN_0, input->keybit);
330-
/*
331-
* A little something special to enable
332-
* two and three finger taps.
333-
*/
334326
__set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
335-
__set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
336-
__set_bit(BTN_TOOL_QUADTAP, input->keybit);
337327
/*
338328
* The physical touchscreen (single touch)
339329
* input has a value for physical, whereas
@@ -349,6 +339,12 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
349339
}
350340
}
351341

342+
/* This is needed for devices with more recent firmware versions */
343+
report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a];
344+
if (report)
345+
usbhid_submit_report(hdev, report, USB_DIR_OUT);
346+
347+
352348
return 0;
353349
err_free:
354350
kfree(nd);

drivers/hid/hid-sony.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static int sony_set_operational_usb(struct hid_device *hdev)
7676

7777
static int sony_set_operational_bt(struct hid_device *hdev)
7878
{
79-
unsigned char buf[] = { 0x53, 0xf4, 0x42, 0x03, 0x00, 0x00 };
79+
unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 };
8080
return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
8181
}
8282

drivers/hid/hid-wacom.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ static int __init wacom_init(void)
277277
ret = hid_register_driver(&wacom_driver);
278278
if (ret)
279279
printk(KERN_ERR "can't register wacom driver\n");
280-
printk(KERN_ERR "wacom driver registered\n");
281280
return ret;
282281
}
283282

drivers/hid/usbhid/hid-core.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -999,13 +999,6 @@ static int usbhid_start(struct hid_device *hid)
999999
}
10001000
}
10011001

1002-
init_waitqueue_head(&usbhid->wait);
1003-
INIT_WORK(&usbhid->reset_work, hid_reset);
1004-
INIT_WORK(&usbhid->restart_work, __usbhid_restart_queues);
1005-
setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
1006-
1007-
spin_lock_init(&usbhid->lock);
1008-
10091002
usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL);
10101003
if (!usbhid->urbctrl) {
10111004
ret = -ENOMEM;
@@ -1179,6 +1172,12 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
11791172
usbhid->intf = intf;
11801173
usbhid->ifnum = interface->desc.bInterfaceNumber;
11811174

1175+
init_waitqueue_head(&usbhid->wait);
1176+
INIT_WORK(&usbhid->reset_work, hid_reset);
1177+
INIT_WORK(&usbhid->restart_work, __usbhid_restart_queues);
1178+
setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
1179+
spin_lock_init(&usbhid->lock);
1180+
11821181
ret = hid_add_device(hid);
11831182
if (ret) {
11841183
if (ret != -ENODEV)

0 commit comments

Comments
 (0)