summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-lg4ff.c
diff options
context:
space:
mode:
authorSimon Wood <gitsend@mungewell.org>2016-09-18 10:55:39 -0600
committerJiri Kosina <jkosina@suse.cz>2016-09-26 15:39:55 +0200
commitb456634b8d08b184a437bba55ac0efe7ef02d3b3 (patch)
tree1fc15dce948a896775f436c2679803fd6f5398cf /drivers/hid/hid-lg4ff.c
parentc832f86effbcf8833fc2c842aa501ce1eb4d0478 (diff)
HID: hid-logitech: Compute combined pedals value
Add support for computing a combined accelerator/brake axis for wheels which don't contain combined data in their HID stream. This includes DFGT, G25, G27, G29 and Wii-Wheel. Signed-off-by: Simon Wood <simon@mungewell.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-lg4ff.c')
-rw-r--r--drivers/hid/hid-lg4ff.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 79d34c2f639b..cc5c9ebd12a1 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -332,6 +332,7 @@ int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field,
int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report,
u8 *rd, int size, struct lg_drv_data *drv_data)
{
+ int offset;
struct lg4ff_device_entry *entry = drv_data->device_props;
if (!entry)
@@ -353,9 +354,25 @@ int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report,
rd[5] = rd[4];
rd[6] = 0x7F;
return 1;
+ case USB_DEVICE_ID_LOGITECH_G25_WHEEL:
+ case USB_DEVICE_ID_LOGITECH_G27_WHEEL:
+ offset = 5;
+ break;
+ case USB_DEVICE_ID_LOGITECH_DFGT_WHEEL:
+ case USB_DEVICE_ID_LOGITECH_G29_WHEEL:
+ offset = 6;
+ break;
+ case USB_DEVICE_ID_LOGITECH_WII_WHEEL:
+ offset = 3;
+ break;
default:
return 0;
}
+
+ /* Compute a combined axis when wheel does not supply it */
+ rd[offset] = (0xFF + rd[offset] - rd[offset+1]) >> 1;
+ rd[offset+1] = 0x7F;
+ return 1;
}
return 0;