* [patch] HID: add support for another version of 0e8f:0003 device in hid-pl
@ 2009-02-27 21:47 Anssi Hannula
2009-03-02 15:20 ` Jiri Kosina
0 siblings, 1 reply; 3+ messages in thread
From: Anssi Hannula @ 2009-02-27 21:47 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, Pantelis Koukousoulas
Add support for another version of 0e8f:0003 device into hid-pl driver.
This device has the values in separate fields and resembles devices
handled by hid-zpff.
Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Tested-by: Pantelis Koukousoulas <pktoss@gmail.com>
--- linux-2629-pidff/drivers/hid/hid-pl.c.old 2009-02-13 03:47:15.000000000 +0200
+++ linux-2629-pidff/drivers/hid/hid-pl.c 2009-02-27 21:40:58.000000000 +0200
@@ -9,9 +9,12 @@
* - contains two reports, one for each port (HID_QUIRK_MULTI_INPUT)
*
* 0e8f:0003 "GreenAsia Inc. USB Joystick "
- * - tested with K??ng Gaming gamepad
+ * - tested with König Gaming gamepad
*
- * Copyright (c) 2007 Anssi Hannula <anssi.hannula@gmail.com>
+ * 0e8f:0003 "GASIA USB Gamepad"
+ * - another version of the König gamepad
+ *
+ * Copyright (c) 2007, 2009 Anssi Hannula <anssi.hannula@gmail.com>
*/
/*
@@ -46,6 +49,8 @@
struct plff_device {
struct hid_report *report;
+ s32 *strong;
+ s32 *weak;
};
static int hid_plff_play(struct input_dev *dev, void *data,
@@ -62,8 +67,8 @@ static int hid_plff_play(struct input_de
left = left * 0x7f / 0xffff;
right = right * 0x7f / 0xffff;
- plff->report->field[0]->value[2] = left;
- plff->report->field[0]->value[3] = right;
+ *plff->strong = left;
+ *plff->weak = right;
debug("running with 0x%02x 0x%02x", left, right);
usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
@@ -80,6 +85,8 @@ static int plff_init(struct hid_device *
struct list_head *report_ptr = report_list;
struct input_dev *dev;
int error;
+ s32 *strong;
+ s32 *weak;
/* The device contains one output report per physical device, all
containing 1 field, which contains 4 ff00.0002 usages and 4 16bit
@@ -87,7 +94,12 @@ static int plff_init(struct hid_device *
The input reports also contain a field which contains
8 ff00.0001 usages and 8 boolean values. Their meaning is
- currently unknown. */
+ currently unknown.
+
+ A version of the 0e8f:0003 exists that has all the values in
+ separate fields and misses the extra input field, thus resembling
+ Zeroplus (hid-zpff) devices.
+ */
if (list_empty(report_list)) {
dev_err(&hid->dev, "no output reports found\n");
@@ -110,8 +122,21 @@ static int plff_init(struct hid_device *
return -ENODEV;
}
- if (report->field[0]->report_count < 4) {
- dev_err(&hid->dev, "not enough values in the field\n");
+ if (report->field[0]->report_count >= 4) {
+ report->field[0]->value[0] = 0x00;
+ report->field[0]->value[1] = 0x00;
+ strong = &report->field[0]->value[2];
+ weak = &report->field[0]->value[3];
+ debug("detected single-field device");
+ } else if (report->maxfield >= 4 && report->field[0]->maxusage == 1 &&
+ report->field[0]->usage[0].hid == (HID_UP_LED | 0x43)) {
+ report->field[0]->value[0] = 0x00;
+ report->field[1]->value[0] = 0x00;
+ strong = &report->field[2]->value[0];
+ weak = &report->field[3]->value[0];
+ debug("detected 4-field device");
+ } else {
+ dev_err(&hid->dev, "not enough fields or values\n");
return -ENODEV;
}
@@ -130,10 +155,11 @@ static int plff_init(struct hid_device *
}
plff->report = report;
- plff->report->field[0]->value[0] = 0x00;
- plff->report->field[0]->value[1] = 0x00;
- plff->report->field[0]->value[2] = 0x00;
- plff->report->field[0]->value[3] = 0x00;
+ plff->strong = strong;
+ plff->weak = weak;
+
+ *strong = 0x00;
+ *weak = 0x00;
usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
}
@@ -180,7 +206,7 @@ static const struct hid_device_id pl_dev
.driver_data = 1 }, /* Twin USB Joystick */
{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR),
.driver_data = 1 }, /* Twin USB Joystick */
- { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003), }, /* GreenAsia Inc. USB Joystick */
+ { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003), },
{ }
};
MODULE_DEVICE_TABLE(hid, pl_devices);
--
Anssi Hannula
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] HID: add support for another version of 0e8f:0003 device in hid-pl
2009-02-27 21:47 [patch] HID: add support for another version of 0e8f:0003 device in hid-pl Anssi Hannula
@ 2009-03-02 15:20 ` Jiri Kosina
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2009-03-02 15:20 UTC (permalink / raw)
To: Anssi Hannula; +Cc: linux-input, Pantelis Koukousoulas
On Fri, 27 Feb 2009, Anssi Hannula wrote:
> Add support for another version of 0e8f:0003 device into hid-pl driver.
Applied, thanks Anssi and Pantelis.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] HID: add support for another version of 0e8f:0003 device in hid-pl
@ 2009-03-04 17:09 Pantelis Koukousoulas
0 siblings, 0 replies; 3+ messages in thread
From: Pantelis Koukousoulas @ 2009-03-04 17:09 UTC (permalink / raw)
To: linux-input
Given that this code is trivial enough to incur practically zero risk
for serious regressions
it would be nice if it were nominated for 2.6.29 (i.e., about 15 days)
instead of 2.6.30
(several months).
After reading today's announcement that -rc7 contains 2 new drivers
(less trivial than this
code for sure), I believe linus would be ok with it.
It should also be noted that adding this code saves users from a "wtf
moment" because
the way things are now in mainline it *looks* like their device is
supported (a driver is
loaded, prints the right VID:PID) yet it doesn't work. So it is
"almost" a bugfix.
In any case, thanks a lot for merging,
one less broken device for me :-)
Pantelis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-04 17:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-27 21:47 [patch] HID: add support for another version of 0e8f:0003 device in hid-pl Anssi Hannula
2009-03-02 15:20 ` Jiri Kosina
-- strict thread matches above, loose matches on Subject: below --
2009-03-04 17:09 Pantelis Koukousoulas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).