Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: hid-logitech: Add combined pedal support Logitech wheels

Add support for reporting a combined accelerator/brake axis for wheels
which contain combined data in their HID stream.

This includes DF, MOMO, MOMO2 and DFP.

Signed-off-by: Simon Wood <simon@mungewell.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Simon Wood and committed by
Jiri Kosina
c832f86e 961af46f

+48
+12
drivers/hid/hid-lg.c
··· 657 657 return 0; 658 658 } 659 659 660 + static int lg_raw_event(struct hid_device *hdev, struct hid_report *report, 661 + u8 *rd, int size) 662 + { 663 + struct lg_drv_data *drv_data = hid_get_drvdata(hdev); 664 + 665 + if (drv_data->quirks & LG_FF4) 666 + return lg4ff_raw_event(hdev, report, rd, size, drv_data); 667 + 668 + return 0; 669 + } 670 + 660 671 static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) 661 672 { 662 673 struct usb_interface *iface = to_usb_interface(hdev->dev.parent); ··· 841 830 .input_mapping = lg_input_mapping, 842 831 .input_mapped = lg_input_mapped, 843 832 .event = lg_event, 833 + .raw_event = lg_raw_event, 844 834 .probe = lg_probe, 845 835 .remove = lg_remove, 846 836 };
+32
drivers/hid/hid-lg4ff.c
··· 329 329 } 330 330 } 331 331 332 + int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report, 333 + u8 *rd, int size, struct lg_drv_data *drv_data) 334 + { 335 + struct lg4ff_device_entry *entry = drv_data->device_props; 336 + 337 + if (!entry) 338 + return 0; 339 + 340 + /* adjust HID report present combined pedals data */ 341 + if (entry->wdata.combine) { 342 + switch (entry->wdata.product_id) { 343 + case USB_DEVICE_ID_LOGITECH_WHEEL: 344 + rd[5] = rd[3]; 345 + rd[6] = 0x7F; 346 + return 1; 347 + case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL: 348 + case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2: 349 + rd[4] = rd[3]; 350 + rd[5] = 0x7F; 351 + return 1; 352 + case USB_DEVICE_ID_LOGITECH_DFP_WHEEL: 353 + rd[5] = rd[4]; 354 + rd[6] = 0x7F; 355 + return 1; 356 + default: 357 + return 0; 358 + } 359 + } 360 + 361 + return 0; 362 + } 363 + 332 364 static void lg4ff_init_wheel_data(struct lg4ff_wheel_data * const wdata, const struct lg4ff_wheel *wheel, 333 365 const struct lg4ff_multimode_wheel *mmode_wheel, 334 366 const u16 real_product_id)
+4
drivers/hid/hid-lg4ff.h
··· 6 6 7 7 int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field, 8 8 struct hid_usage *usage, s32 value, struct lg_drv_data *drv_data); 9 + int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report, 10 + u8 *rd, int size, struct lg_drv_data *drv_data); 9 11 int lg4ff_init(struct hid_device *hdev); 10 12 int lg4ff_deinit(struct hid_device *hdev); 11 13 #else 12 14 static inline int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field, 13 15 struct hid_usage *usage, s32 value, struct lg_drv_data *drv_data) { return 0; } 16 + static inline int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report, 17 + u8 *rd, int size, struct lg_drv_data *drv_data) { return 0; } 14 18 static inline int lg4ff_init(struct hid_device *hdev) { return -1; } 15 19 static inline int lg4ff_deinit(struct hid_device *hdev) { return -1; } 16 20 #endif