Commit b456634b authored by Simon Wood's avatar Simon Wood Committed by Jiri Kosina

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: default avatarSimon Wood <simon@mungewell.org>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent c832f86e
...@@ -332,6 +332,7 @@ int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field, ...@@ -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, int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report,
u8 *rd, int size, struct lg_drv_data *drv_data) u8 *rd, int size, struct lg_drv_data *drv_data)
{ {
int offset;
struct lg4ff_device_entry *entry = drv_data->device_props; struct lg4ff_device_entry *entry = drv_data->device_props;
if (!entry) if (!entry)
...@@ -353,9 +354,25 @@ int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report, ...@@ -353,9 +354,25 @@ int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report,
rd[5] = rd[4]; rd[5] = rd[4];
rd[6] = 0x7F; rd[6] = 0x7F;
return 1; 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: default:
return 0; 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; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment