aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-ids.h1
-rw-r--r--drivers/hid/hid-sony.c44
3 files changed, 45 insertions, 1 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 339b90135d37..743e6f8cb202 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1294,6 +1294,7 @@ static const struct hid_device_id hid_blacklist[] = {
1294 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, 1294 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
1295 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, 1295 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
1296 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1296 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1297 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
1297 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, 1298 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
1298 1299
1299 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, 1300 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 1635ccd877d7..a0d6a6cb1842 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -350,6 +350,7 @@
350#define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 350#define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001
351 351
352#define USB_VENDOR_ID_SONY 0x054c 352#define USB_VENDOR_ID_SONY 0x054c
353#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b
353#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 354#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268
354 355
355#define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 356#define USB_VENDOR_ID_SOUNDGRAPH 0x15c2
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 3af8095a7de1..86e563b8d644 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -4,9 +4,9 @@
4 * Copyright (c) 1999 Andreas Gal 4 * Copyright (c) 1999 Andreas Gal
5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> 5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc 6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
7 * Copyright (c) 2006-2007 Jiri Kosina
8 * Copyright (c) 2007 Paul Walmsley 7 * Copyright (c) 2007 Paul Walmsley
9 * Copyright (c) 2008 Jiri Slaby 8 * Copyright (c) 2008 Jiri Slaby
9 * Copyright (c) 2006-2008 Jiri Kosina
10 */ 10 */
11 11
12/* 12/*
@@ -23,6 +23,26 @@
23 23
24#include "hid-ids.h" 24#include "hid-ids.h"
25 25
26#define VAIO_RDESC_CONSTANT 0x0001
27
28struct sony_sc {
29 unsigned long quirks;
30};
31
32/* Sony Vaio VGX has wrongly mouse pointer declared as constant */
33static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc,
34 unsigned int rsize)
35{
36 struct sony_sc *sc = hid_get_drvdata(hdev);
37
38 if ((sc->quirks & VAIO_RDESC_CONSTANT) &&
39 rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) {
40 dev_info(&hdev->dev, "Fixing up Sony Vaio VGX report "
41 "descriptor\n");
42 rdesc[55] = 0x06;
43 }
44}
45
26/* 46/*
27 * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller 47 * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller
28 * to "operational". Without this, the ps3 controller will not report any 48 * to "operational". Without this, the ps3 controller will not report any
@@ -56,6 +76,17 @@ static int sony_set_operational(struct hid_device *hdev)
56static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) 76static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
57{ 77{
58 int ret; 78 int ret;
79 unsigned long quirks = id->driver_data;
80 struct sony_sc *sc;
81
82 sc = kzalloc(sizeof(*sc), GFP_KERNEL);
83 if (sc == NULL) {
84 dev_err(&hdev->dev, "can't alloc apple descriptor\n");
85 return -ENOMEM;
86 }
87
88 sc->quirks = quirks;
89 hid_set_drvdata(hdev, sc);
59 90
60 ret = hid_parse(hdev); 91 ret = hid_parse(hdev);
61 if (ret) { 92 if (ret) {
@@ -78,11 +109,20 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
78err_stop: 109err_stop:
79 hid_hw_stop(hdev); 110 hid_hw_stop(hdev);
80err_free: 111err_free:
112 kfree(sc);
81 return ret; 113 return ret;
82} 114}
83 115
116static void sony_remove(struct hid_device *hdev)
117{
118 hid_hw_stop(hdev);
119 kfree(hid_get_drvdata(hdev));
120}
121
84static const struct hid_device_id sony_devices[] = { 122static const struct hid_device_id sony_devices[] = {
85 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 123 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
124 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE),
125 .driver_data = VAIO_RDESC_CONSTANT },
86 { } 126 { }
87}; 127};
88MODULE_DEVICE_TABLE(hid, sony_devices); 128MODULE_DEVICE_TABLE(hid, sony_devices);
@@ -91,6 +131,8 @@ static struct hid_driver sony_driver = {
91 .name = "sony", 131 .name = "sony",
92 .id_table = sony_devices, 132 .id_table = sony_devices,
93 .probe = sony_probe, 133 .probe = sony_probe,
134 .remove = sony_remove,
135 .report_fixup = sony_report_fixup,
94}; 136};
95 137
96static int sony_init(void) 138static int sony_init(void)