Skip to content

Commit 30307c6

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: Revert "HID: multitouch: decide if hid-multitouch needs to handle mt devices" HID: drivers/hid/hid-roccat.c: eliminate a null pointer dereference HID: hid-apple: add device ID of another wireless aluminium HID: Add device IDs for Macbook Pro 8 keyboards
2 parents 4536e4d + d682bd7 commit 30307c6

File tree

5 files changed

+33
-52
lines changed

5 files changed

+33
-52
lines changed

drivers/hid/hid-apple.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,9 @@ static const struct hid_device_id apple_devices[] = {
458458
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO),
459459
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
460460
APPLE_ISO_KEYBOARD },
461+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO),
462+
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
463+
APPLE_ISO_KEYBOARD },
461464
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS),
462465
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
463466
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI),
@@ -508,6 +511,12 @@ static const struct hid_device_id apple_devices[] = {
508511
.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
509512
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS),
510513
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
514+
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI),
515+
.driver_data = APPLE_HAS_FN },
516+
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO),
517+
.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
518+
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS),
519+
.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
511520
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
512521
.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
513522
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),

drivers/hid/hid-core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
13621362
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) },
13631363
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) },
13641364
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) },
1365+
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) },
1366+
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) },
1367+
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) },
13651368
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ANSI) },
13661369
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_ISO) },
13671370
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_REVB_JIS) },
@@ -1374,6 +1377,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
13741377
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
13751378
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
13761379
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
1380+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) },
13771381
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
13781382
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
13791383
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) },
@@ -1942,6 +1946,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
19421946
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI) },
19431947
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO) },
19441948
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS) },
1949+
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI) },
1950+
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO) },
1951+
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS) },
19451952
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI) },
19461953
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO) },
19471954
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS) },

drivers/hid/hid-ids.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@
112112
#define USB_DEVICE_ID_APPLE_ALU_REVB_ANSI 0x024f
113113
#define USB_DEVICE_ID_APPLE_ALU_REVB_ISO 0x0250
114114
#define USB_DEVICE_ID_APPLE_ALU_REVB_JIS 0x0251
115+
#define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252
116+
#define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253
117+
#define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254
115118
#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249
116119
#define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a
117120
#define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b
@@ -121,6 +124,7 @@
121124
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
122125
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
123126
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
127+
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256
124128
#define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
125129
#define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
126130
#define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241

drivers/hid/hid-multitouch.c

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
291291
td->last_slot_field = usage->hid;
292292
td->last_field_index = field->index;
293293
td->last_mt_collection = usage->collection_index;
294-
hdev->quirks &= ~HID_QUIRK_MULTITOUCH;
295294
return 1;
296295
case HID_DG_WIDTH:
297296
hid_map_usage(hi, usage, bit, max,
@@ -530,51 +529,23 @@ static void mt_set_input_mode(struct hid_device *hdev)
530529
}
531530
}
532531

533-
/* a list of devices for which there is a specialized multitouch driver */
534-
static const struct hid_device_id mt_have_special_driver[] = {
535-
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, 0x0001) },
536-
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, 0x0006) },
537-
{ HID_USB_DEVICE(USB_VENDOR_ID_QUANTA,
538-
USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) },
539-
{ HID_USB_DEVICE(USB_VENDOR_ID_QUANTA,
540-
USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
541-
{ }
542-
};
543-
544-
static bool mt_match_one_id(struct hid_device *hdev,
545-
const struct hid_device_id *id)
546-
{
547-
return id->bus == hdev->bus &&
548-
(id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) &&
549-
(id->product == HID_ANY_ID || id->product == hdev->product);
550-
}
551-
552-
static const struct hid_device_id *mt_match_id(struct hid_device *hdev,
553-
const struct hid_device_id *id)
554-
{
555-
for (; id->bus; id++)
556-
if (mt_match_one_id(hdev, id))
557-
return id;
558-
559-
return NULL;
560-
}
561-
562532
static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
563533
{
564534
int ret, i;
565535
struct mt_device *td;
566536
struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
567537

568-
if (mt_match_id(hdev, mt_have_special_driver))
569-
return -ENODEV;
570-
571538
for (i = 0; mt_classes[i].name ; i++) {
572539
if (id->driver_data == mt_classes[i].name) {
573540
mtclass = &(mt_classes[i]);
574541
break;
575542
}
576543
}
577544

545+
/* This allows the driver to correctly support devices
546+
* that emit events over several HID messages.
547+
*/
548+
hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
578549

579550
td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
580551
if (!td) {
@@ -590,16 +561,10 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
590561
if (ret != 0)
591562
goto fail;
592563

593-
hdev->quirks |= HID_QUIRK_MULTITOUCH;
594564
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
595565
if (ret)
596566
goto fail;
597567

598-
/* This allows the driver to correctly support devices
599-
* that emit events over several HID messages.
600-
*/
601-
hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
602-
603568
td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
604569
GFP_KERNEL);
605570
if (!td->slots) {
@@ -793,10 +758,6 @@ static const struct hid_device_id mt_devices[] = {
793758
HID_USB_DEVICE(USB_VENDOR_ID_XAT,
794759
USB_DEVICE_ID_XAT_CSR) },
795760

796-
/* Rest of the world */
797-
{ .driver_data = MT_CLS_DEFAULT,
798-
HID_USB_DEVICE(HID_ANY_ID, HID_ANY_ID) },
799-
800761
{ }
801762
};
802763
MODULE_DEVICE_TABLE(hid, mt_devices);

drivers/hid/hid-roccat.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,27 +162,27 @@ static int roccat_open(struct inode *inode, struct file *file)
162162

163163
device = devices[minor];
164164

165-
mutex_lock(&device->readers_lock);
166-
167165
if (!device) {
168166
pr_emerg("roccat device with minor %d doesn't exist\n", minor);
169167
error = -ENODEV;
170-
goto exit_err;
168+
goto exit_err_devices;
171169
}
172170

171+
mutex_lock(&device->readers_lock);
172+
173173
if (!device->open++) {
174174
/* power on device on adding first reader */
175175
error = hid_hw_power(device->hid, PM_HINT_FULLON);
176176
if (error < 0) {
177177
--device->open;
178-
goto exit_err;
178+
goto exit_err_readers;
179179
}
180180

181181
error = hid_hw_open(device->hid);
182182
if (error < 0) {
183183
hid_hw_power(device->hid, PM_HINT_NORMAL);
184184
--device->open;
185-
goto exit_err;
185+
goto exit_err_readers;
186186
}
187187
}
188188

@@ -193,13 +193,13 @@ static int roccat_open(struct inode *inode, struct file *file)
193193
list_add_tail(&reader->node, &device->readers);
194194
file->private_data = reader;
195195

196-
exit_unlock:
196+
exit_err_readers:
197197
mutex_unlock(&device->readers_lock);
198+
exit_err_devices:
198199
mutex_unlock(&devices_lock);
200+
if (error)
201+
kfree(reader);
199202
return error;
200-
exit_err:
201-
kfree(reader);
202-
goto exit_unlock;
203203
}
204204

205205
static int roccat_release(struct inode *inode, struct file *file)

0 commit comments

Comments
 (0)