diff options
author | Antonio Ospite <ospite@studenti.unina.it> | 2010-05-03 16:15:55 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-09-02 03:40:40 -0400 |
commit | 816651a7d4a32664261e5f9f88ad0d558faed4cc (patch) | |
tree | 969b138b35b6706b573f370f9e3c163cfc194de3 /drivers/hid/hid-sony.c | |
parent | a10430443120205853e5f13a938e6560d027b42f (diff) |
HID: sony: Apply sixaxis quirks only to sixaxis
Be more explicit and avoid calling sony_set_operational_usb() when we
have USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE.
While at it, rename the sony_set_operational routines to
sixaxis_set_operational as they are sixaxis specific.
This is also in preparation for the sysfs interface to set and get bdaddr
over usb and for some other Sixaxis report fixup.
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-sony.c')
-rw-r--r-- | drivers/hid/hid-sony.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 402d5574b574..d61f26840afe 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -24,7 +24,9 @@ | |||
24 | 24 | ||
25 | #include "hid-ids.h" | 25 | #include "hid-ids.h" |
26 | 26 | ||
27 | #define VAIO_RDESC_CONSTANT 0x0001 | 27 | #define VAIO_RDESC_CONSTANT (1 << 0) |
28 | #define SIXAXIS_CONTROLLER_USB (1 << 1) | ||
29 | #define SIXAXIS_CONTROLLER_BT (1 << 2) | ||
28 | 30 | ||
29 | struct sony_sc { | 31 | struct sony_sc { |
30 | unsigned long quirks; | 32 | unsigned long quirks; |
@@ -49,7 +51,7 @@ static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
49 | * to "operational". Without this, the ps3 controller will not report any | 51 | * to "operational". Without this, the ps3 controller will not report any |
50 | * events. | 52 | * events. |
51 | */ | 53 | */ |
52 | static int sony_set_operational_usb(struct hid_device *hdev) | 54 | static int sixaxis_set_operational_usb(struct hid_device *hdev) |
53 | { | 55 | { |
54 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | 56 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); |
55 | struct usb_device *dev = interface_to_usbdev(intf); | 57 | struct usb_device *dev = interface_to_usbdev(intf); |
@@ -74,7 +76,7 @@ static int sony_set_operational_usb(struct hid_device *hdev) | |||
74 | return ret; | 76 | return ret; |
75 | } | 77 | } |
76 | 78 | ||
77 | static int sony_set_operational_bt(struct hid_device *hdev) | 79 | static int sixaxis_set_operational_bt(struct hid_device *hdev) |
78 | { | 80 | { |
79 | unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 }; | 81 | unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 }; |
80 | return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT); | 82 | return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT); |
@@ -108,16 +110,12 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
108 | goto err_free; | 110 | goto err_free; |
109 | } | 111 | } |
110 | 112 | ||
111 | switch (hdev->bus) { | 113 | if (sc->quirks & SIXAXIS_CONTROLLER_USB) |
112 | case BUS_USB: | 114 | ret = sixaxis_set_operational_usb(hdev); |
113 | ret = sony_set_operational_usb(hdev); | 115 | else if (sc->quirks & SIXAXIS_CONTROLLER_BT) |
114 | break; | 116 | ret = sixaxis_set_operational_bt(hdev); |
115 | case BUS_BLUETOOTH: | 117 | else |
116 | ret = sony_set_operational_bt(hdev); | ||
117 | break; | ||
118 | default: | ||
119 | ret = 0; | 118 | ret = 0; |
120 | } | ||
121 | 119 | ||
122 | if (ret < 0) | 120 | if (ret < 0) |
123 | goto err_stop; | 121 | goto err_stop; |
@@ -137,8 +135,10 @@ static void sony_remove(struct hid_device *hdev) | |||
137 | } | 135 | } |
138 | 136 | ||
139 | static const struct hid_device_id sony_devices[] = { | 137 | static const struct hid_device_id sony_devices[] = { |
140 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 138 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER), |
141 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, | 139 | .driver_data = SIXAXIS_CONTROLLER_USB }, |
140 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER), | ||
141 | .driver_data = SIXAXIS_CONTROLLER_BT }, | ||
142 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), | 142 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), |
143 | .driver_data = VAIO_RDESC_CONSTANT }, | 143 | .driver_data = VAIO_RDESC_CONSTANT }, |
144 | { } | 144 | { } |