aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Wood <simon@mungewell.org>2013-11-06 14:30:41 -0500
committerJiri Kosina <jkosina@suse.cz>2013-11-08 08:12:07 -0500
commitd2c02da549b468bbb28e67d269bd3c9e10683ff5 (patch)
treecf11e63db6c804f8595e7bb0499ee803a7a6c6e4
parentf8c231569a7a455dfa1907294a46ba52b3aa8859 (diff)
HID:hid-lg4ff: Switch autocentering off when strength is set to zero.
When the autocenter is set to zero, this patch issues a command to totally disable the autocenter - this results in less resistance in the wheel. Reported-by: Elias Vanderstuyft <elias.vds@gmail.com> Signed-off-by: Simon Wood <simon@mungewell.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-lg4ff.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 530fcd19e90e..49f6cc0f9919 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -220,6 +220,20 @@ static void hid_lg4ff_set_autocenter_default(struct input_dev *dev, u16 magnitud
220 __s32 *value = report->field[0]->value; 220 __s32 *value = report->field[0]->value;
221 __u32 expand_a, expand_b; 221 __u32 expand_a, expand_b;
222 222
223 /* De-activate Auto-Center */
224 if (magnitude == 0) {
225 value[0] = 0xf5;
226 value[1] = 0x00;
227 value[2] = 0x00;
228 value[3] = 0x00;
229 value[4] = 0x00;
230 value[5] = 0x00;
231 value[6] = 0x00;
232
233 hid_hw_request(hid, report, HID_REQ_SET_REPORT);
234 return;
235 }
236
223 if (magnitude <= 0xaaaa) { 237 if (magnitude <= 0xaaaa) {
224 expand_a = 0x0c * magnitude; 238 expand_a = 0x0c * magnitude;
225 expand_b = 0x80 * magnitude; 239 expand_b = 0x80 * magnitude;
@@ -237,6 +251,17 @@ static void hid_lg4ff_set_autocenter_default(struct input_dev *dev, u16 magnitud
237 value[6] = 0x00; 251 value[6] = 0x00;
238 252
239 hid_hw_request(hid, report, HID_REQ_SET_REPORT); 253 hid_hw_request(hid, report, HID_REQ_SET_REPORT);
254
255 /* Activate Auto-Center */
256 value[0] = 0x14;
257 value[1] = 0x00;
258 value[2] = 0x00;
259 value[3] = 0x00;
260 value[4] = 0x00;
261 value[5] = 0x00;
262 value[6] = 0x00;
263
264 hid_hw_request(hid, report, HID_REQ_SET_REPORT);
240} 265}
241 266
242/* Sends autocentering command compatible with Formula Force EX */ 267/* Sends autocentering command compatible with Formula Force EX */