Skip to contentSkip to conversation

HID: add BETOP game controller force feedback support

PATCH Applied Huang Bo 2 participants 6 messages Nov 27, 2014 – Dec 22, 2014 HID

lore
Share & tools
lore

Huang Bo

author
#0 lore raw

PATCH v3 1/1 HID: add BETOP game controller force feedback support

From: Huang Bo <[email protected]>

Adds force feedback support for BETOP USB game controllers. These devices are mass produced in China.

---
 drivers/hid/Kconfig       |   10 +++
 drivers/hid/Makefile      |    1 +
 drivers/hid/hid-betopff.c |  152 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/hid/hid-core.c    |    4 ++
 drivers/hid/hid-ids.h     |    5 ++
 5 files changed, 172 insertions(+)
 create mode 100644 drivers/hid/hid-betopff.c
drivers/hid/Kconfig +10 -0
index 4938bd3..3b4c47d 100755
@@ -146,6 +146,16 @@ config HID_BELKIN
     ---help---
     Support for Belkin Flip KVM and Wireless keyboard.
 
+config HID_BETOP_FF
+    tristate "Betop Production Inc. force feedback support"
+    depends on USB_HID
+    select INPUT_FF_MEMLESS
+    ---help---
+    Say Y here if you want to enable force feedback support for devices by
+    BETOP Production Ltd.
+    Currently the following devices are known to be supported:
+     - BETOP 2185 PC & BFM MODE
+
 config HID_CHERRY
     tristate "Cherry Cymotion keyboard" if EXPERT
     depends on HID
drivers/hid/Makefile +1 -0
index 4113999..edd4825 100755
@@ -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_BETOP_FF)    += hid-betopff.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-betopff.c new file +152 -0

152 lines not on this page · raw message

drivers/hid/hid-core.c +4 -0
index a622590..e64ccfc 100755
@@ -1642,6 +1642,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
     { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
     { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
     { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
+    { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+    { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+    { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+    { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
     { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
     { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
     { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
drivers/hid/hid-ids.h +5 -0
index 161ee89..c432be9 100755
@@ -185,6 +185,11 @@
 #define USB_VENDOR_ID_BERKSHIRE        0x0c98
 #define USB_DEVICE_ID_BERKSHIRE_PCWD    0x1140
 
+#define USB_VENDOR_ID_BETOP_2185BFM    0x11c2
+#define USB_VENDOR_ID_BETOP_2185PC    0x11c0
+#define USB_VENDOR_ID_BETOP_2185V2PC    0x8380
+#define USB_VENDOR_ID_BETOP_2185V2BFM    0x20bc
+
 #define USB_VENDOR_ID_BTC        0x046e
 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE    0x5578
 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2    0x5577
Signature · 1 line
1.7.9.5
Quoted 1 line

From 65290060fb6a13808454b8535f3e8cf4ad7d3a01 Mon Sep 17 00:00:00 2001

From: Huang Bo <[email protected]>
Date: Wed, 26 Nov 2014 18:21:03 +0800
Subject: [PATCH] HID: add BETOP game controller force feedback support

Adds force feedback support for BETOP USB game controllers. These devices are mass produced in China.

---
 drivers/hid/Kconfig       |   10 +++
 drivers/hid/Makefile      |    1 +
 drivers/hid/hid-betopff.c |  152 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/hid/hid-core.c    |    4 ++
 drivers/hid/hid-ids.h     |    5 ++
 5 files changed, 172 insertions(+)
 create mode 100644 drivers/hid/hid-betopff.c
drivers/hid/Kconfig +10 -0
index 4938bd3..3b4c47d 100755
@@ -146,6 +146,16 @@ config HID_BELKIN
 	---help---
 	Support for Belkin Flip KVM and Wireless keyboard.
 
+config HID_BETOP_FF
+	tristate "Betop Production Inc. force feedback support"
+	depends on USB_HID
+	select INPUT_FF_MEMLESS
+	---help---
+	Say Y here if you want to enable force feedback support for devices by
+	BETOP Production Ltd.
+	Currently the following devices are known to be supported:
+	 - BETOP 2185 PC & BFM MODE
+
 config HID_CHERRY
 	tristate "Cherry Cymotion keyboard" if EXPERT
 	depends on HID
drivers/hid/Makefile +1 -0
index 4113999..edd4825 100755
@@ -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_BETOP_FF)	+= hid-betopff.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-betopff.c new file +152 -0

152 lines not on this page · raw message

drivers/hid/hid-core.c +4 -0
index a622590..e64ccfc 100755
@@ -1642,6 +1642,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
drivers/hid/hid-ids.h +5 -0
index 161ee89..c432be9 100755
@@ -185,6 +185,11 @@
 #define USB_VENDOR_ID_BERKSHIRE		0x0c98
 #define USB_DEVICE_ID_BERKSHIRE_PCWD	0x1140
 
+#define USB_VENDOR_ID_BETOP_2185BFM	0x11c2
+#define USB_VENDOR_ID_BETOP_2185PC	0x11c0
+#define USB_VENDOR_ID_BETOP_2185V2PC	0x8380
+#define USB_VENDOR_ID_BETOP_2185V2BFM	0x20bc
+
 #define USB_VENDOR_ID_BTC		0x046e
 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE	0x5578
 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2	0x5577
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 4 lines · Huang Bo

From: Huang Bo <[email protected]>

Adds force feedback support for BETOP USB game controllers. These devices are mass produced in China.

Thanks. We are almost there, except ...

[ ... snip ... ]

Quoted 12 lines
drivers/hid/hid-betopff.c new file +12 -0
+static int betopff_init(struct hid_device *hid)
+{
+    struct betopff_device *betopff;
+    struct hid_report *report;
+    struct hid_input *hidinput =
+            list_first_entry(&hid->inputs, struct hid_input, list);
+    struct list_head *report_list =
+            &hid->report_enum[HID_OUTPUT_REPORT].report_list;
+    struct input_dev *dev = hidinput->input;
+    int field_count = 0;
+    int error;
+    int i, j;

drivers/hid/hid-betopff.c line 79

Quoted 10 lines
drivers/hid/hid-betopff.c new file +10 -0
+
+    if (list_empty(report_list)) {
+        hid_err(hid, "no output reports found\n");
+        return -ENODEV;
+    }
+
+    report = list_first_entry(report_list, struct hid_report, list);
+    for (i = 0; i < report->maxfield; i++) {
+        for (j = 0; j < report->field[i]->report_count; j++) {
+            report->field[i]->value[j] = 0x00;

I asked for a comment to be added here why you are zeroing those out.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
author
#2 lore raw
Quoted 1 line · Jiri Kosina

except ...

thanks firstly.
1. tested the BETOP2185 gamecontroller, it really not need it.
2. check with engineers of Betop, they design only one report descriptor.

so I modify it.

#3 lore raw
Quoted 7 lines · Huang Bo
Quoted 1 line · Jiri Kosina

except ...

thanks firstly.
1. tested the BETOP2185 gamecontroller, it really not need it.
2. check with engineers of Betop, they design only one report descriptor.

so I modify it.

Thanks, but please put the comment into the code (jus before you are zeroing the fields), so that it's immediately obvious to everybody who is reading the code.

Other than that, I am OK with the patch and will be applying it once you resend it with the comments added.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
author
#4 lore raw
Quoted 9 lines · Jiri Kosina
Quoted 7 lines · Huang Bo
Quoted 1 line · Jiri Kosina

except ...

thanks firstly.
1. tested the BETOP2185 gamecontroller, it really not need it.
2. check with engineers of Betop, they design only one report descriptor.

so I modify it.

Quoted 9 lines

Thanks, but please put the comment into the code (jus before you are zeroing the fields), so that it's immediately obvious to everybody who is reading the code.

Other than that, I am OK with the patch and will be applying it once you resend it with the comments added.

Thanks,

From: Huang Bo <[email protected]>

Adds force feedback support for BETOP USB game controllers. These devices are mass produced in China.

---
 drivers/hid/Kconfig       |   10 +++
 drivers/hid/Makefile      |    1 +
 drivers/hid/hid-betopff.c |  160 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/hid/hid-core.c    |    4 ++
 drivers/hid/hid-ids.h     |    5 ++
 5 files changed, 180 insertions(+)
 create mode 100644 drivers/hid/hid-betopff.c
drivers/hid/Kconfig +10 -0
index 4938bd3..3b4c47d 100755
@@ -146,6 +146,16 @@ config HID_BELKIN
     ---help---
     Support for Belkin Flip KVM and Wireless keyboard.
 
+config HID_BETOP_FF
+    tristate "Betop Production Inc. force feedback support"
+    depends on USB_HID
+    select INPUT_FF_MEMLESS
+    ---help---
+    Say Y here if you want to enable force feedback support for devices by
+    BETOP Production Ltd.
+    Currently the following devices are known to be supported:
+     - BETOP 2185 PC & BFM MODE
+
 config HID_CHERRY
     tristate "Cherry Cymotion keyboard" if EXPERT
     depends on HID
drivers/hid/Makefile +1 -0
index 4113999..edd4825 100755
@@ -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_BETOP_FF)    += hid-betopff.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-betopff.c new file +160 -0

160 lines not on this page · raw message

drivers/hid/hid-core.c +4 -0
index a622590..e64ccfc 100755
@@ -1642,6 +1642,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
     { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
     { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
     { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
+    { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+    { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+    { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+    { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
     { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
     { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
     { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
drivers/hid/hid-ids.h +5 -0
index 161ee89..c432be9 100755
@@ -185,6 +185,11 @@
 #define USB_VENDOR_ID_BERKSHIRE        0x0c98
 #define USB_DEVICE_ID_BERKSHIRE_PCWD    0x1140
 
+#define USB_VENDOR_ID_BETOP_2185BFM    0x11c2
+#define USB_VENDOR_ID_BETOP_2185PC    0x11c0
+#define USB_VENDOR_ID_BETOP_2185V2PC    0x8380
+#define USB_VENDOR_ID_BETOP_2185V2BFM    0x20bc
+
 #define USB_VENDOR_ID_BTC        0x046e
 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE    0x5578
 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2    0x5577
Signature · 1 line
1.7.9.5
Quoted 1 line

From b362f0b16c2376103237931307f927eca32219b3 Mon Sep 17 00:00:00 2001

From: Huang Bo <[email protected]>
Date: Wed, 26 Nov 2014 18:21:03 +0800
Subject: [PATCH] HID: add BETOP game controller force feedback support

Adds force feedback support for BETOP USB game controllers. These devices are mass produced in China.

---
 drivers/hid/Kconfig       |   10 +++
 drivers/hid/Makefile      |    1 +
 drivers/hid/hid-betopff.c |  160 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/hid/hid-core.c    |    4 ++
 drivers/hid/hid-ids.h     |    5 ++
 5 files changed, 180 insertions(+)
 create mode 100644 drivers/hid/hid-betopff.c
drivers/hid/Kconfig +10 -0
index 4938bd3..3b4c47d 100755
@@ -146,6 +146,16 @@ config HID_BELKIN
 	---help---
 	Support for Belkin Flip KVM and Wireless keyboard.
 
+config HID_BETOP_FF
+	tristate "Betop Production Inc. force feedback support"
+	depends on USB_HID
+	select INPUT_FF_MEMLESS
+	---help---
+	Say Y here if you want to enable force feedback support for devices by
+	BETOP Production Ltd.
+	Currently the following devices are known to be supported:
+	 - BETOP 2185 PC & BFM MODE
+
 config HID_CHERRY
 	tristate "Cherry Cymotion keyboard" if EXPERT
 	depends on HID
drivers/hid/Makefile +1 -0
index 4113999..edd4825 100755
@@ -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_BETOP_FF)	+= hid-betopff.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-betopff.c new file +160 -0

160 lines not on this page · raw message

drivers/hid/hid-core.c +4 -0
index a622590..e64ccfc 100755
@@ -1642,6 +1642,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
drivers/hid/hid-ids.h +5 -0
index 161ee89..c432be9 100755
@@ -185,6 +185,11 @@
 #define USB_VENDOR_ID_BERKSHIRE		0x0c98
 #define USB_DEVICE_ID_BERKSHIRE_PCWD	0x1140
 
+#define USB_VENDOR_ID_BETOP_2185BFM	0x11c2
+#define USB_VENDOR_ID_BETOP_2185PC	0x11c0
+#define USB_VENDOR_ID_BETOP_2185V2PC	0x8380
+#define USB_VENDOR_ID_BETOP_2185V2BFM	0x20bc
+
 #define USB_VENDOR_ID_BTC		0x046e
 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE	0x5578
 #define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2	0x5577
Signature · 1 line
1.7.9.5