Skip to contentSkip to conversation

hid: driver for PS2/3 Buzz controllers

PATCH In review Colin Leitner 3 participants 7 messages May 26, 2013 – May 28, 2013 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hid: driver for PS2/3 Buzz controllers

Added a driver for PlayStation 2/3 Buzz controllers, which exposes the LEDs and maps all buttons to BTN_TRIGGER_HAPPY1 to 20.

Applies to kernel version 3.10.0-rc2. Tested with Debian 7 and with a minor change on kernel 3.8.5 on Fedora 18. Couldn't test the wireless version, but what can be gathered on information from the net, both should be identical in their report structure.

---
 drivers/hid/Kconfig    |  10 ++
 drivers/hid/Makefile   |   1 +
 drivers/hid/hid-buzz.c | 309 +++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/hid/hid-core.c |   4 +
 drivers/hid/hid-ids.h  |   2 +
 5 files changed, 326 insertions(+)
 create mode 100644 drivers/hid/hid-buzz.c
drivers/hid/Kconfig +10 -0
index fb52f3f..b9f6877 100644
@@ -146,6 +146,16 @@ config HID_BELKIN
 	---help---
 	Support for Belkin Flip KVM and Wireless keyboard.
 
+config HID_BUZZ
+	tristate "PS2/3 Buzz controller support"
+	depends on USB_HID
+	select NEW_LEDS
+	select LEDS_CLASS
+	---help---
+	Say Y here if you want to enable the enhanced support for Buzz
+	controllers. This driver exports the four LEDs and remaps the keys to a
+	more sane setting.
+
 config HID_CHERRY
 	tristate "Cherry Cymotion keyboard" if EXPERT
 	depends on HID
drivers/hid/Makefile +1 -0
index 2065694..70bfbde 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_HID_APPLE)		+= hid-apple.o
 obj-$(CONFIG_HID_APPLEIR)	+= hid-appleir.o
 obj-$(CONFIG_HID_AUREAL)        += hid-aureal.o
 obj-$(CONFIG_HID_BELKIN)	+= hid-belkin.o
+obj-$(CONFIG_HID_BUZZ)		+= hid-buzz.o
 obj-$(CONFIG_HID_CHERRY)	+= hid-cherry.o
 obj-$(CONFIG_HID_CHICONY)	+= hid-chicony.o
 obj-$(CONFIG_HID_CYPRESS)	+= hid-cypress.o
drivers/hid/hid-buzz.c new file +309 -0

309 lines not on this page · raw message

drivers/hid/hid-core.c +4 -0
index 264f550..006340f 100644
@@ -1680,6 +1680,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
+#if IS_ENABLED(CONFIG_HID_BUZZ)
+	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) },
+#endif
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_BDREMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) },
drivers/hid/hid-ids.h +2 -0
index 38535c9..508c007 100644
@@ -734,6 +734,8 @@
 #define USB_DEVICE_ID_SONY_PS3_BDREMOTE		0x0306
 #define USB_DEVICE_ID_SONY_PS3_CONTROLLER	0x0268
 #define USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER	0x042f
+#define USB_DEVICE_ID_SONY_BUZZ_CONTROLLER		0x0002
+#define USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER	0x1000
 
 #define USB_VENDOR_ID_SOUNDGRAPH	0x15c2
 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST	0x0034
#1 lore raw
Quoted 12 lines · Colin Leitner

Added a driver for PlayStation 2/3 Buzz controllers, which exposes the LEDs and maps all buttons to BTN_TRIGGER_HAPPY1 to 20.

Applies to kernel version 3.10.0-rc2. Tested with Debian 7 and with a minor change on kernel 3.8.5 on Fedora 18. Couldn't test the wireless version, but what can be gathered on information from the net, both should be identical in their report structure.

Quoted 7 lines
---
 drivers/hid/Kconfig    |  10 ++
 drivers/hid/Makefile   |   1 +
 drivers/hid/hid-buzz.c | 309 +++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/hid/hid-core.c |   4 +
 drivers/hid/hid-ids.h  |   2 +
 5 files changed, 326 insertions(+)

Hi Colin,

thanks a lot for the support.

I this it'd actually make more sense to add this support to one of the two existing drivers (*) we already have for Sony remote controllers -- either hid-sony or hid-ps3remote both seem appropriate.

(*) I think we should even merge hid-ps3remote into hid-sony.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
#2 lore raw

Hi Jiri,

Quoted 4 lines

I this it'd actually make more sense to add this support to one of the two existing drivers (*) we already have for Sony remote controllers -- either hid-sony or hid-ps3remote both seem appropriate.

I'll integrate the buzz code to hid-sony. Unfortunatly I can't test against the six-axis controller as I don't own a Playstation.

Greetings,
Colin

#3 lore raw
In reply to Jiri Kosina

This patch adds support for PS2/3 Buzz controllers into hid-sony

It has been tested on Debian 7 with kernel version 3.10.0-rc2. Unfortunately I can't test the patch with a regular six-axis controller myself.

---
 drivers/hid/Kconfig    |    9 +-
 drivers/hid/hid-core.c |    2 +
 drivers/hid/hid-ids.h  |    2 +
 drivers/hid/hid-sony.c |  310 ++++++++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 312 insertions(+), 11 deletions(-)
drivers/hid/Kconfig +7 -2
index fb52f3f..53caf0b 100644
@@ -594,10 +594,15 @@ config HID_SAMSUNG
 	Support for Samsung InfraRed remote control or keyboards.
 
 config HID_SONY
-	tristate "Sony PS3 controller"
+	tristate "Sony PS2/3 accessories"
 	depends on USB_HID
+	select NEW_LEDS
+	select LEDS_CLASS
 	---help---
-	Support for Sony PS3 6-axis controllers.
+	Support for
+	  
+	  * Sony PS3 6-axis controllers
+	  * Buzz controllers
 
 	Support for the Sony PS3 BD Remote is provided by HID_PS3REMOTE.
 
drivers/hid/hid-core.c +2 -0
index 264f550..ecd1107 100644
@@ -1680,6 +1680,8 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_BDREMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER) },
drivers/hid/hid-ids.h +2 -0
index 38535c9..508c007 100644
@@ -734,6 +734,8 @@
 #define USB_DEVICE_ID_SONY_PS3_BDREMOTE		0x0306
 #define USB_DEVICE_ID_SONY_PS3_CONTROLLER	0x0268
 #define USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER	0x042f
+#define USB_DEVICE_ID_SONY_BUZZ_CONTROLLER		0x0002
+#define USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER	0x1000
 
 #define USB_VENDOR_ID_SOUNDGRAPH	0x15c2
 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST	0x0034
drivers/hid/hid-sony.c +301 -9

377 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#4 lore raw
Quoted 1 line · Colin Leitner

This patch adds support for PS2/3 Buzz controllers into hid-sony

Thanks, now applied.

As a followup, I think I'll merge hid-ps3remote into hid-sony as well.

Signature · 2 lines
Jiri Kosina
SUSE Labs
#5 lore raw
Quoted 5 lines · Jiri Kosina
Quoted 1 line · Colin Leitner

This patch adds support for PS2/3 Buzz controllers into hid-sony

Thanks, now applied.

I would have preferred it if the single device (the USB adapter) showed 4 input devices each with 5 buttons and a LED, rather than a single device with 4 LEDs and 20 buttons.

Cheers

#6 lore raw
Quoted 1 line

I would have preferred it if the single device (the USB adapter)

showed

Quoted 2 lines

4 input devices each with 5 buttons and a LED, rather than a single device with 4 LEDs and 20 buttons.

That's quite a good idea. Are there any existing drivers with a similiar feature?