diff mbox

HID: logitech - lg2ff: Add IDs for Formula Vibration Feedback Wheel

Message ID 1381164492-27145-1-git-send-email-anssi.hannula@iki.fi (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Anssi Hannula Oct. 7, 2013, 4:48 p.m. UTC
From: Elias Vanderstuyft <Elias.vds@gmail.com>

Add USB IDs for Logitech Formula Vibration Feedback Wheel (046d:ca04).

The lg2ff force feedback subdriver is used for vibration and
HID_GD_MULTIAXIS is set to avoid deadzone like other Logitech wheels.

Kconfig description etc are also updated accordingly.

Signed-off-by: Elias Vanderstuyft <Elias.vds@gmail.com>
[anssi.hannula@iki.fi: added description and CCs]
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Cc: Simon Wood <simon@mungewell.org>
Cc: <stable@vger.kernel.org>
---

Simon, does this look OK to you, or do you think it should be an lg4ff
device? Though I guess lg2ff is better than nothing even in that case.

Jiri, lets see if we get a comment from Simon before applying.

I added CC to stable since it is just ID additions (plus description
stuff), but feel free to drop that if you think it is not appropriate.


 drivers/hid/Kconfig     | 8 +++++---
 drivers/hid/hid-core.c  | 1 +
 drivers/hid/hid-ids.h   | 1 +
 drivers/hid/hid-lg.c    | 3 +++
 drivers/hid/hid-lg2ff.c | 2 +-
 5 files changed, 11 insertions(+), 4 deletions(-)

Comments

simon@mungewell.org Oct. 7, 2013, 5:48 p.m. UTC | #1
> From: Elias Vanderstuyft <Elias.vds@gmail.com>
>
> Add USB IDs for Logitech Formula Vibration Feedback Wheel (046d:ca04).
>
> The lg2ff force feedback subdriver is used for vibration and
> HID_GD_MULTIAXIS is set to avoid deadzone like other Logitech wheels.
>
> Kconfig description etc are also updated accordingly.
>
> Signed-off-by: Elias Vanderstuyft <Elias.vds@gmail.com>
> [anssi.hannula@iki.fi: added description and CCs]
> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
> Cc: Simon Wood <simon@mungewell.org>
> Cc: <stable@vger.kernel.org>
> ---
>
> Simon, does this look OK to you, or do you think it should be an lg4ff
> device? Though I guess lg2ff is better than nothing even in that case.
>
> Jiri, lets see if we get a comment from Simon before applying.
>

I've cc'ed Michal as he contributed a lot to lg4ff and is looking at
improving ff-memless.

I am unfamiliar with this wheel (180' rotation, bungee cord for autocenter
and rumble motors - or so google tells me...), it's not listed on
Wikipedia (hint, hint):
http://en.wikipedia.org/wiki/Racing_wheel

At present lg4ff does not support RUMBLE effects (only CONSTANT and
AUTOCENTER), so lg2ff seems a sensible place. The only minor concern I
would have is any confusion from the descriptions in Kconfig.

I didn't build, but think that the patch looks OK to commit.

For the other wheels we have re-written the HID descriptors to split
brake/accel into seperate axis. Do you know whether this is possible for
this wheel too?

Thanks for your patch,
Simon.

Signed-off-by: Simon Wood <simon@mungewell.org>


--
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
Anssi Hannula Oct. 7, 2013, 5:56 p.m. UTC | #2
07.10.2013 20:48, simon@mungewell.org kirjoitti:
>> From: Elias Vanderstuyft <Elias.vds@gmail.com>
>>
>> Add USB IDs for Logitech Formula Vibration Feedback Wheel (046d:ca04).
>>
>> The lg2ff force feedback subdriver is used for vibration and
>> HID_GD_MULTIAXIS is set to avoid deadzone like other Logitech wheels.
>>
>> Kconfig description etc are also updated accordingly.
>>
>> Signed-off-by: Elias Vanderstuyft <Elias.vds@gmail.com>
>> [anssi.hannula@iki.fi: added description and CCs]
>> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
>> Cc: Simon Wood <simon@mungewell.org>
>> Cc: <stable@vger.kernel.org>
>> ---
>>
>> Simon, does this look OK to you, or do you think it should be an lg4ff
>> device? Though I guess lg2ff is better than nothing even in that case.
>>
>> Jiri, lets see if we get a comment from Simon before applying.
>>
> 
> I've cc'ed Michal as he contributed a lot to lg4ff and is looking at
> improving ff-memless.
> 
> I am unfamiliar with this wheel (180' rotation, bungee cord for autocenter
> and rumble motors - or so google tells me...), it's not listed on
> Wikipedia (hint, hint):
> http://en.wikipedia.org/wiki/Racing_wheel
> 
> At present lg4ff does not support RUMBLE effects (only CONSTANT and
> AUTOCENTER), so lg2ff seems a sensible place. The only minor concern I
> would have is any confusion from the descriptions in Kconfig.
> 
> I didn't build, but think that the patch looks OK to commit.
> 
> For the other wheels we have re-written the HID descriptors to split
> brake/accel into seperate axis. Do you know whether this is possible for
> this wheel too?

Elias noted earlier that it is configurable in Windows at least, so that
might be the case. We didn't look at the HID descriptors, though, but
feel free to work with him to see if it is possible :)

> Thanks for your patch,
> Simon.
> 
> Signed-off-by: Simon Wood <simon@mungewell.org>
simon@mungewell.org Oct. 7, 2013, 8:03 p.m. UTC | #3
> I don't really know what you need for the HID descriptors, but I thought
> maybe I should post usbmon output when plugging in the wheel:

I'm not sure I can do anything with that file. It would be great if you
could dump/attach the report descriptor file. This can be found in the
/sys folder structure under the USB ID for your device.

ie. for my Sony Dual Shock controller
--
simon@simon-virtual-machine:/sys/bus/usb/devices/1-1:1.0/0003:054C:0268.0001$
hexdump -C report_descriptor
00000000  05 01 09 04 a1 01 a1 02  85 01 75 08 95 01 15 00 
|..........u.....|
00000010  26 ff 00 81 03 75 01 95  13 15 00 25 01 35 00 45 
|&....u.....%.5.E|
00000020  01 05 09 19 01 29 13 81  02 75 01 95 0d 06 00 ff 
|.....)...u......|
00000030  81 03 15 00 26 ff 00 05  01 09 01 a1 00 75 08 95 
|....&........u..|
00000040  04 35 00 46 ff 00 09 30  09 31 09 32 09 35 81 02 
|.5.F...0.1.2.5..|
00000050  c0 05 01 95 13 09 01 81  02 95 0c 81 01 75 10 95 
|.............u..|
00000060  04 26 ff 03 46 ff 03 09  01 81 02 c0 a1 02 85 02 
|.&..F...........|
00000070  75 08 95 30 09 01 b1 02  c0 a1 02 85 ee 75 08 95 
|u..0.........u..|
00000080  30 09 01 b1 02 c0 a1 02  85 ef 75 08 95 30 09 01 
|0.........u..0..|
00000090  b1 02 c0 c0                                       |....|
00000094
--

To confirm which bits of the HID stream actually change when the pedals
are pushed you could run the command as root.
--
$ hexdump -v -e '17/1 "%02x " "\n"' < /dev/hidraw0
--

You'll have to change the '17' to match the actual number of bytes your
wheel sends, when you get it right the columns of values will change
'nicely' as you steer/depress the pedals/etc.

I'm expecting to see one column (or two adjacent if the bits don't align)
change as you press the brake/etc. If you can send a small capture showing
values changing for each of brake and accel that should be enough
information.

When we know where the data is, we can tell Linux's HID system which bits
to interpret as Y and Z axis.

Cheers,
Simon


--
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
Michal MalĂ˝ Oct. 8, 2013, 10 a.m. UTC | #4
Hey guys,

I assume that we're talking about this wheel (http://www.logitech.com/en-roeu/support/298)?

Does the wheel have an actual FFB servo or does it have just a rumble motor that shakes the wheel? If it's the latter, supporting it in lg2ff is a way to go. Description in KConfig should probably be updated to reflect this.

As for the HID descriptors, Simon's suggestion will work just fine. Alternatively you can use Wireshark which can use usbmon to capture USB traffic. (Wireshark must run as root and usbmon module must be loaded before Wireshark starts). We can hack the descriptor in hid-logitech just like we did it for DFP. If we come across more wheels that need a hacked descriptor, perhaps we should consider handling the raw data ourselves (check out the Wii remote driver for details)...

Michal.
--
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
simon@mungewell.org Oct. 8, 2013, 6:24 p.m. UTC | #5
> We can hack the descriptor in hid-logitech just
> like we did it for DFP. If we come across more wheels that need a hacked
> descriptor, perhaps we should consider handling the raw data ourselves
> (check out the Wii remote driver for details)...

We currently 'hack HID desc.' for the DF, DFP and MOMO-Red. The DFGT, G25
and G27 are pushed into native mode and automatically split the brake and
accel axis.

I'll get the 'hack HID desc.' done for Elias' wheel and the MOMO-black I
picked last week. Should be done this week sometime.

I think we've got every wheel variant covered.... unless the release more
with different IDs (recently saw a new DFGT version).

In the longer term we may wish to add an option/control to split (or not)
the brake/accel as the user requests. I don't actually think that anyone
wants combined axis, but there's no telling with some people ;-)

Simon

--
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
Jiri Kosina Oct. 9, 2013, 10:09 a.m. UTC | #6
On Mon, 7 Oct 2013, simon@mungewell.org wrote:

> > The lg2ff force feedback subdriver is used for vibration and
> > HID_GD_MULTIAXIS is set to avoid deadzone like other Logitech wheels.
> >
> > Kconfig description etc are also updated accordingly.
> >
> > Signed-off-by: Elias Vanderstuyft <Elias.vds@gmail.com>
> > [anssi.hannula@iki.fi: added description and CCs]
> > Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
> > Cc: Simon Wood <simon@mungewell.org>
> > Cc: <stable@vger.kernel.org>
> > ---
> >
> > Simon, does this look OK to you, or do you think it should be an lg4ff
> > device? Though I guess lg2ff is better than nothing even in that case.
> 
> Signed-off-by: Simon Wood <simon@mungewell.org>

Thanks, I have now applied the patch. In case you are going to work 
further on splitting break/accel into different axes, please send it as a 
followup patch.

Thanks.
diff mbox

Patch

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 71b70e3..42c2a8b 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -368,12 +368,14 @@  config LOGITECH_FF
 	  force feedback.
 
 config LOGIRUMBLEPAD2_FF
-	bool "Logitech RumblePad/Rumblepad 2 force feedback support"
+	bool "Logitech force feedback support (variant 2)"
 	depends on HID_LOGITECH
 	select INPUT_FF_MEMLESS
 	help
-	  Say Y here if you want to enable force feedback support for Logitech
-	  RumblePad and Rumblepad 2 devices.
+	  Say Y here if you want to enable force feedback support for:
+	  - Logitech RumblePad
+	  - Logitech Rumblepad 2
+	  - Logitech Formula Vibration Feedback Wheel
 
 config LOGIG940_FF
 	bool "Logitech Flight System G940 force feedback support"
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index b8470b1..037915f 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1752,6 +1752,7 @@  static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFP_WHEEL) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index e60e8d5..0ff958b 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -570,6 +570,7 @@ 
 #define USB_DEVICE_ID_DINOVO_EDGE	0xc714
 #define USB_DEVICE_ID_DINOVO_MINI	0xc71f
 #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2	0xca03
+#define USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL	0xca04
 
 #define USB_VENDOR_ID_LUMIO		0x202e
 #define USB_DEVICE_ID_CRYSTALTOUCH	0x0006
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index 6f12ecd..c2c7dab 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -492,6 +492,7 @@  static int lg_input_mapped(struct hid_device *hdev, struct hid_input *hi,
 		case USB_DEVICE_ID_LOGITECH_G27_WHEEL:
 		case USB_DEVICE_ID_LOGITECH_WII_WHEEL:
 		case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:
+		case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL:
 			field->application = HID_GD_MULTIAXIS;
 			break;
 		default:
@@ -639,6 +640,8 @@  static const struct hid_device_id lg_devices[] = {
 		.driver_data = LG_NOGET | LG_FF4 },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2),
 		.driver_data = LG_FF4 },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL),
+		.driver_data = LG_FF2 },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL),
 		.driver_data = LG_FF4 },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL),
diff --git a/drivers/hid/hid-lg2ff.c b/drivers/hid/hid-lg2ff.c
index 1a42eaa..0e3fb1a 100644
--- a/drivers/hid/hid-lg2ff.c
+++ b/drivers/hid/hid-lg2ff.c
@@ -95,7 +95,7 @@  int lg2ff_init(struct hid_device *hid)
 
 	hid_hw_request(hid, report, HID_REQ_SET_REPORT);
 
-	hid_info(hid, "Force feedback for Logitech RumblePad/Rumblepad 2 by Anssi Hannula <anssi.hannula@gmail.com>\n");
+	hid_info(hid, "Force feedback for Logitech variant 2 rumble devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
 
 	return 0;
 }