* hid-lg2ff handling of zero/low magnitude rumble effects @ 2014-03-27 22:13 Elias Vanderstuyft 2014-04-04 20:10 ` Elias Vanderstuyft 0 siblings, 1 reply; 4+ messages in thread From: Elias Vanderstuyft @ 2014-03-27 22:13 UTC (permalink / raw) To: Simon Wood, Anssi Hannula; +Cc: linux-input Hi, I noticed that my rumble wheel (Logitech Formula Vibration Feedback) reacts in a strange way when sending low rumble magnitudes to the device: Assume the following USB command to be send to emit rumble: report->field[0]->value[0] = 0x51; report->field[0]->value[2] = weak; report->field[0]->value[4] = strong; When 'weak' or 'strong' is lower than 0x02 (i.e. 0x01 or 0x00), then the corresponding rumble motor begins to rumble intermittently, this resembles a bit to forcing a 2-state light-switch to be in the middle position. Now my question is whether all other devices (e.g. "Logitech RumblePad", "Rumblepad 2") experience this behaviour? (If you own such a device, please verify this.) Best regards, Elias ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: hid-lg2ff handling of zero/low magnitude rumble effects 2014-03-27 22:13 hid-lg2ff handling of zero/low magnitude rumble effects Elias Vanderstuyft @ 2014-04-04 20:10 ` Elias Vanderstuyft 2014-04-04 23:02 ` Hendrik Iben 0 siblings, 1 reply; 4+ messages in thread From: Elias Vanderstuyft @ 2014-04-04 20:10 UTC (permalink / raw) To: Hendrik_Iben, Edgar Simo-Serra, Anssi Hannula Cc: linux-input, Simon Wood, Michal Malý [-- Attachment #1: Type: text/plain, Size: 3160 bytes --] Hi guys, I'm about to release a patch (see attachment "0001-HID-lg2ff-add-rumble-magnitude-clamping-quirk.patch") for the lg2ff driver to account for some weird quirks concerning the magnitude of a rumble effect. You can read the description in that patch too get more details on it. The reason I sent this to you, is because I only own and tested this on a Logitech Vibration Feedback wheel, and not on a Rumblepad (2). I saw that Hendrik might have a Wingman Rumblepad, and Edgar a Rumblepad 2 device. But if other people have such lg2ff-compatible device as well, feel free to cooperate. May I ask you to perform some simple tests (see next paragraph) to verify that these quirks are also valid on those devices? To test sending some USB commands, I attached "USBCommander.zip" which contains a program made with Qt4 by Michal (Cc'd; thanks Michal!) To build it, you will need to run 'qmake-qt4' and 'make' in the top-level directory. It's simple to use USBCommander: enter the Vendor ID ("046d") and Product ID ("c20a" for Rumblepad, or "c218" for Rumblepad 2), then press 'Open', enter the to-be-tested command in the 'Command:' field, and finally press 'Send command'. After testing, press 'Release' and then quit the application. You will need to run 'USBCommander' as root to send the USB commands. Commands to test: ============== Send the following commands (without parentheses): "51 00 xx 00 yy 00 00" with yy (strong rumble) = "02" and: xx = "00" => You should feel an irregular weak rumble xx = "01" => You should feel an irregular weak rumble xx = "02" => You should feel (almost) no rumble xx = "03" => You should feel (almost) no rumble xx = "FC" => You should feel much weak rumble xx = "FD" => You should feel much weak rumble xx = "FE" => You should feel much irregular weak rumble, but less than with xx = FD xx = "FF" => You should feel much irregular weak rumble, but less than with xx = FD Test the same for the other rumble motor type (swap xx with yy). To stop the rumble, send the following command: "F3 00 00 00 00 00 00" If you discover that the results do not match my assumptions, please tell what happens in that case. Thank you very much, Elias On Thu, Mar 27, 2014 at 11:13 PM, Elias Vanderstuyft <elias.vds@gmail.com> wrote: > Hi, > > > I noticed that my rumble wheel (Logitech Formula Vibration Feedback) > reacts in a strange way when sending low rumble magnitudes to the > device: > > Assume the following USB command to be send to emit rumble: > report->field[0]->value[0] = 0x51; > report->field[0]->value[2] = weak; > report->field[0]->value[4] = strong; > When 'weak' or 'strong' is lower than 0x02 (i.e. 0x01 or 0x00), then > the corresponding rumble motor begins to rumble intermittently, this > resembles a bit to forcing a 2-state light-switch to be in the middle > position. > > Now my question is whether all other devices (e.g. "Logitech > RumblePad", "Rumblepad 2") experience this behaviour? > (If you own such a device, please verify this.) > > > Best regards, > > Elias [-- Attachment #2: USBCommander.zip --] [-- Type: application/zip, Size: 9947 bytes --] [-- Attachment #3: 0001-HID-lg2ff-add-rumble-magnitude-clamping-quirk.patch --] [-- Type: text/x-patch, Size: 1897 bytes --] From 528b4c7e78429672538a65287160ad5498aafd05 Mon Sep 17 00:00:00 2001 From: Elias Vanderstuyft <elias.vds@gmail.com> Date: Thu, 3 Apr 2014 19:25:58 +0200 Subject: [PATCH] HID: lg2ff: add rumble magnitude clamping quirk If a magnitude in the output report is lower than 2, i.e. 1 or 0, the corresponding rumble motor shakes irregularly, instead of being turned (almost) off like when magnitude 2 is used. On the other hand, if a magnitude is higher than 0xfd, i.e 0xfe or 0xff, the corresponding rumble motor shakes irregularly with a rotation speed lower than when magnitude 0xfd is used. From 0x02 to 0xfd, the device behaves well: a monotonic increase of rotation speed. This applies to both weak and strong rumble motor types. This patch fixes this issue by clamping magnitudes from 0x02 to 0xfd. Note: The same thing appears to happen in the Windows Logitech driver, except the max clamping bound is not 0xfd, but 0xfe. Experimentally, I proved this to be wrong. Signed-off-by: Elias Vanderstuyft <elias.vds@gmail.com> Cc: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/hid/hid-lg2ff.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hid/hid-lg2ff.c b/drivers/hid/hid-lg2ff.c index 0e3fb1a..e180e1e 100644 --- a/drivers/hid/hid-lg2ff.c +++ b/drivers/hid/hid-lg2ff.c @@ -38,12 +38,17 @@ static int play_effect(struct input_dev *dev, void *data, struct lg2ff_device *lg2ff = data; int weak, strong; +#define CLAMP_QUIRK(x) do { if (x < 2) x = 2; else if (x > 0xfd) x = 0xfd; } \ + while (0) + strong = effect->u.rumble.strong_magnitude; weak = effect->u.rumble.weak_magnitude; if (weak || strong) { weak = weak * 0xff / 0xffff; strong = strong * 0xff / 0xffff; + CLAMP_QUIRK(weak); + CLAMP_QUIRK(strong); lg2ff->report->field[0]->value[0] = 0x51; lg2ff->report->field[0]->value[2] = weak; -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: hid-lg2ff handling of zero/low magnitude rumble effects 2014-04-04 20:10 ` Elias Vanderstuyft @ 2014-04-04 23:02 ` Hendrik Iben 2014-04-05 7:31 ` Elias Vanderstuyft 0 siblings, 1 reply; 4+ messages in thread From: Hendrik Iben @ 2014-04-04 23:02 UTC (permalink / raw) To: Elias Vanderstuyft, Edgar Simo-Serra, Anssi Hannula Cc: linux-input, Simon Wood, Michal Malý Hi Elias, First of all - thanks for caring about compatibility with old devices. It would be really annoying if something that worked once stopped working on an update. I just dug out my old Wingman Rumblepad (VID 046d PID c20a) and did the test cases (thanks for the tool by the way - might come in handy for other things). The first motor for this device controls a weak/smooth rumble effect and the second one a strong/coarse one. For both motors, values from 00 to 03 have no effect on the haptic side. You can hear the motors spinning a bit higher if you hold the pad to your ear... :-) - but it sounds like a linear increase. It similar for the high values. FC-FF produce the same high amount of rumble. There might be a small increase but not really any difference. >From these observations I would say that clamping is fine for the Rumblepad although not needed. But a special case handling would have no positive effect. Best regards, Hendrik Am 04.04.2014 22:10, schrieb Elias Vanderstuyft: > Hi guys, > > > I'm about to release a patch (see attachment > "0001-HID-lg2ff-add-rumble-magnitude-clamping-quirk.patch") for the > lg2ff driver to account for some weird quirks concerning the magnitude > of a rumble effect. > You can read the description in that patch too get more details on it. > > The reason I sent this to you, is because I only own and tested this > on a Logitech Vibration Feedback wheel, and not on a Rumblepad (2). I > saw that Hendrik might have a Wingman Rumblepad, and Edgar a Rumblepad > 2 device. But if other people have such lg2ff-compatible device as > well, feel free to cooperate. > May I ask you to perform some simple tests (see next paragraph) to > verify that these quirks are also valid on those devices? > > To test sending some USB commands, I attached "USBCommander.zip" which > contains a program made with Qt4 by Michal (Cc'd; thanks Michal!) To > build it, you will need to run 'qmake-qt4' and 'make' in the top-level > directory. > It's simple to use USBCommander: enter the Vendor ID ("046d") and > Product ID ("c20a" for Rumblepad, or "c218" for Rumblepad 2), then > press 'Open', enter the to-be-tested command in the 'Command:' field, > and finally press 'Send command'. > After testing, press 'Release' and then quit the application. > You will need to run 'USBCommander' as root to send the USB commands. > > Commands to test: > ============== > > Send the following commands (without parentheses): > "51 00 xx 00 yy 00 00" > with yy (strong rumble) = "02" and: > xx = "00" => You should feel an irregular weak rumble > xx = "01" => You should feel an irregular weak rumble > xx = "02" => You should feel (almost) no rumble > xx = "03" => You should feel (almost) no rumble > xx = "FC" => You should feel much weak rumble > xx = "FD" => You should feel much weak rumble > xx = "FE" => You should feel much irregular weak rumble, > but less than with xx = FD > xx = "FF" => You should feel much irregular weak rumble, > but less than with xx = FD > > Test the same for the other rumble motor type (swap xx with yy). > > To stop the rumble, send the following command: > "F3 00 00 00 00 00 00" > > If you discover that the results do not match my assumptions, please > tell what happens in that case. > > > Thank you very much, > > Elias > > On Thu, Mar 27, 2014 at 11:13 PM, Elias Vanderstuyft > <elias.vds@gmail.com> wrote: >> Hi, >> >> >> I noticed that my rumble wheel (Logitech Formula Vibration Feedback) >> reacts in a strange way when sending low rumble magnitudes to the >> device: >> >> Assume the following USB command to be send to emit rumble: >> report->field[0]->value[0] = 0x51; >> report->field[0]->value[2] = weak; >> report->field[0]->value[4] = strong; >> When 'weak' or 'strong' is lower than 0x02 (i.e. 0x01 or 0x00), then >> the corresponding rumble motor begins to rumble intermittently, this >> resembles a bit to forcing a 2-state light-switch to be in the middle >> position. >> >> Now my question is whether all other devices (e.g. "Logitech >> RumblePad", "Rumblepad 2") experience this behaviour? >> (If you own such a device, please verify this.) >> >> >> Best regards, >> >> Elias ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: hid-lg2ff handling of zero/low magnitude rumble effects 2014-04-04 23:02 ` Hendrik Iben @ 2014-04-05 7:31 ` Elias Vanderstuyft 0 siblings, 0 replies; 4+ messages in thread From: Elias Vanderstuyft @ 2014-04-05 7:31 UTC (permalink / raw) To: Hendrik Iben Cc: Edgar Simo-Serra, Anssi Hannula, linux-input, Simon Wood, Michal Malý On Sat, Apr 5, 2014 at 1:02 AM, Hendrik Iben <Hendrik_Iben@web.de> wrote: > Hi Elias, > > First of all - thanks for caring about compatibility with old devices. > It would be really annoying if something that worked once stopped > working on an update. > > I just dug out my old Wingman Rumblepad (VID 046d PID c20a) and did the > test cases (thanks for the tool by the way - might come in handy for > other things). The first motor for this device controls a weak/smooth > rumble effect and the second one a strong/coarse one. For both motors, > values from 00 to 03 have no effect on the haptic side. You can hear the > motors spinning a bit higher if you hold the pad to your ear... :-) - > but it sounds like a linear increase. It similar for the high values. > FC-FF produce the same high amount of rumble. There might be a small > increase but not really any difference. > From these observations I would say that clamping is fine for the > Rumblepad although not needed. But a special case handling would have no > positive effect. OK, thanks for testing! I agree that a special case handling would have no positive effect. I tried to contact Edgar earlier past month, but until now I can't seem to get in touch with him. If there is no reply in a reasonable amount of time, I'll release the patch, it won't hurt anyone ;) Again thanks, Elias ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-05 7:31 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-03-27 22:13 hid-lg2ff handling of zero/low magnitude rumble effects Elias Vanderstuyft 2014-04-04 20:10 ` Elias Vanderstuyft 2014-04-04 23:02 ` Hendrik Iben 2014-04-05 7:31 ` Elias Vanderstuyft
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).