Lines Matching full:hid
17 #include <linux/hid.h>
20 #include "hid-lg.h"
21 #include "hid-lg4ff.h"
22 #include "hid-ids.h"
61 static void lg4ff_set_range_dfp(struct hid_device *hid, u16 range);
62 static void lg4ff_set_range_g25(struct hid_device *hid, u16 range);
79 void (*set_range)(struct hid_device *hid, u16 range);
83 spinlock_t report_lock; /* Protect output HID report */
103 void (*set_range)(struct hid_device *hid, u16 range);
300 int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field, in lg4ff_adjust_input_event() argument
307 hid_err(hid, "Device properties not found"); in lg4ff_adjust_input_event()
335 /* adjust HID report present combined pedals data */ in lg4ff_raw_event()
408 struct hid_device *hid = input_get_drvdata(dev); in lg4ff_play() local
415 drv_data = hid_get_drvdata(hid); in lg4ff_play()
417 hid_err(hid, "Private driver data not found!\n"); in lg4ff_play()
423 hid_err(hid, "Device properties not found!\n"); in lg4ff_play()
446 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_play()
459 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_play()
470 struct hid_device *hid = input_get_drvdata(dev); in lg4ff_set_autocenter_default() local
477 drv_data = hid_get_drvdata(hid); in lg4ff_set_autocenter_default()
479 hid_err(hid, "Private driver data not found!\n"); in lg4ff_set_autocenter_default()
485 hid_err(hid, "Device properties not found!\n"); in lg4ff_set_autocenter_default()
501 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_set_autocenter_default()
532 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_set_autocenter_default()
543 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_set_autocenter_default()
550 struct hid_device *hid = input_get_drvdata(dev); in lg4ff_set_autocenter_ffex() local
557 drv_data = hid_get_drvdata(hid); in lg4ff_set_autocenter_ffex()
559 hid_err(hid, "Private driver data not found!\n"); in lg4ff_set_autocenter_ffex()
565 hid_err(hid, "Device properties not found!\n"); in lg4ff_set_autocenter_ffex()
579 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_set_autocenter_ffex()
584 static void lg4ff_set_range_g25(struct hid_device *hid, u16 range) in lg4ff_set_range_g25() argument
591 drv_data = hid_get_drvdata(hid); in lg4ff_set_range_g25()
593 hid_err(hid, "Private driver data not found!\n"); in lg4ff_set_range_g25()
599 hid_err(hid, "Device properties not found!\n"); in lg4ff_set_range_g25()
614 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_set_range_g25()
619 static void lg4ff_set_range_dfp(struct hid_device *hid, u16 range) in lg4ff_set_range_dfp() argument
627 drv_data = hid_get_drvdata(hid); in lg4ff_set_range_dfp()
629 hid_err(hid, "Private driver data not found!\n"); in lg4ff_set_range_dfp()
635 hid_err(hid, "Device properties not found!\n"); in lg4ff_set_range_dfp()
658 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_set_range_dfp()
670 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_set_range_dfp()
685 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_set_range_dfp()
763 static int lg4ff_switch_compatibility_mode(struct hid_device *hid, const struct lg4ff_compat_mode_s… in lg4ff_switch_compatibility_mode() argument
771 drv_data = hid_get_drvdata(hid); in lg4ff_switch_compatibility_mode()
773 hid_err(hid, "Private driver data not found!\n"); in lg4ff_switch_compatibility_mode()
779 hid_err(hid, "Device properties not found!\n"); in lg4ff_switch_compatibility_mode()
791 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_switch_compatibility_mode()
794 hid_hw_wait(hid); in lg4ff_switch_compatibility_mode()
800 struct hid_device *hid = to_hid_device(dev); in lg4ff_alternate_modes_show() local
806 drv_data = hid_get_drvdata(hid); in lg4ff_alternate_modes_show()
808 hid_err(hid, "Private driver data not found!\n"); in lg4ff_alternate_modes_show()
814 hid_err(hid, "Device properties not found!\n"); in lg4ff_alternate_modes_show()
819 hid_err(hid, "NULL pointer to string\n"); in lg4ff_alternate_modes_show()
849 struct hid_device *hid = to_hid_device(dev); in lg4ff_alternate_modes_store() local
857 drv_data = hid_get_drvdata(hid); in lg4ff_alternate_modes_store()
859 hid_err(hid, "Private driver data not found!\n"); in lg4ff_alternate_modes_store()
865 hid_err(hid, "Device properties not found!\n"); in lg4ff_alternate_modes_store()
905 hid_info(hid, "Requested mode \"%s\" is not supported by the device\n", lbuf); in lg4ff_alternate_modes_store()
916 …hid_info(hid, "\"%s\" cannot be switched to \"DF-EX\" mode. Load the \"hid_logitech\" module with … in lg4ff_alternate_modes_store()
924 …hid_info(hid, "\"%s\" cannot be switched back into \"%s\" mode\n", entry->wdata.real_name, lg4ff_a… in lg4ff_alternate_modes_store()
930 hid_err(hid, "Invalid target product ID %X\n", target_product_id); in lg4ff_alternate_modes_store()
934 ret = lg4ff_switch_compatibility_mode(hid, s); in lg4ff_alternate_modes_store()
942 struct hid_device *hid = to_hid_device(dev); in lg4ff_combine_show() local
947 drv_data = hid_get_drvdata(hid); in lg4ff_combine_show()
949 hid_err(hid, "Private driver data not found!\n"); in lg4ff_combine_show()
955 hid_err(hid, "Device properties not found!\n"); in lg4ff_combine_show()
966 struct hid_device *hid = to_hid_device(dev); in lg4ff_combine_store() local
971 drv_data = hid_get_drvdata(hid); in lg4ff_combine_store()
973 hid_err(hid, "Private driver data not found!\n"); in lg4ff_combine_store()
979 hid_err(hid, "Device properties not found!\n"); in lg4ff_combine_store()
995 struct hid_device *hid = to_hid_device(dev); in lg4ff_range_show() local
1000 drv_data = hid_get_drvdata(hid); in lg4ff_range_show()
1002 hid_err(hid, "Private driver data not found!\n"); in lg4ff_range_show()
1008 hid_err(hid, "Device properties not found!\n"); in lg4ff_range_show()
1021 struct hid_device *hid = to_hid_device(dev); in lg4ff_range_store() local
1026 drv_data = hid_get_drvdata(hid); in lg4ff_range_store()
1028 hid_err(hid, "Private driver data not found!\n"); in lg4ff_range_store()
1034 hid_err(hid, "Device properties not found!\n"); in lg4ff_range_store()
1044 entry->wdata.set_range(hid, range); in lg4ff_range_store()
1054 struct hid_device *hid = to_hid_device(dev); in lg4ff_real_id_show() local
1059 drv_data = hid_get_drvdata(hid); in lg4ff_real_id_show()
1061 hid_err(hid, "Private driver data not found!\n"); in lg4ff_real_id_show()
1067 hid_err(hid, "Device properties not found!\n"); in lg4ff_real_id_show()
1072 hid_err(hid, "NULL pointer to string\n"); in lg4ff_real_id_show()
1088 static void lg4ff_set_leds(struct hid_device *hid, u8 leds) in lg4ff_set_leds() argument
1095 drv_data = hid_get_drvdata(hid); in lg4ff_set_leds()
1097 hid_err(hid, "Private driver data not found!\n"); in lg4ff_set_leds()
1103 hid_err(hid, "Device properties not found!\n"); in lg4ff_set_leds()
1116 hid_hw_request(hid, entry->report, HID_REQ_SET_REPORT); in lg4ff_set_leds()
1124 struct hid_device *hid = to_hid_device(dev); in lg4ff_led_set_brightness() local
1125 struct lg_drv_data *drv_data = hid_get_drvdata(hid); in lg4ff_led_set_brightness()
1130 hid_err(hid, "Device data not found."); in lg4ff_led_set_brightness()
1137 hid_err(hid, "Device properties not found."); in lg4ff_led_set_brightness()
1147 lg4ff_set_leds(hid, entry->wdata.led_state); in lg4ff_led_set_brightness()
1150 lg4ff_set_leds(hid, entry->wdata.led_state); in lg4ff_led_set_brightness()
1159 struct hid_device *hid = to_hid_device(dev); in lg4ff_led_get_brightness() local
1160 struct lg_drv_data *drv_data = hid_get_drvdata(hid); in lg4ff_led_get_brightness()
1165 hid_err(hid, "Device data not found."); in lg4ff_led_get_brightness()
1172 hid_err(hid, "Device properties not found."); in lg4ff_led_get_brightness()
1186 static u16 lg4ff_identify_multimode_wheel(struct hid_device *hid, const u16 reported_product_id, co… in lg4ff_identify_multimode_wheel() argument
1221 static int lg4ff_handle_multimode_wheel(struct hid_device *hid, u16 *real_product_id, const u16 bcd… in lg4ff_handle_multimode_wheel() argument
1223 const u16 reported_product_id = hid->product; in lg4ff_handle_multimode_wheel()
1226 *real_product_id = lg4ff_identify_multimode_wheel(hid, reported_product_id, bcdDevice); in lg4ff_handle_multimode_wheel()
1242 hid_err(hid, "Invalid product id %X\n", *real_product_id); in lg4ff_handle_multimode_wheel()
1246 ret = lg4ff_switch_compatibility_mode(hid, s); in lg4ff_handle_multimode_wheel()
1250 hid_err(hid, "Unable to switch wheel mode, errno %d\n", ret); in lg4ff_handle_multimode_wheel()
1260 int lg4ff_init(struct hid_device *hid) in lg4ff_init() argument
1264 struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; in lg4ff_init()
1266 const struct usb_device_descriptor *udesc = &(hid_to_usb_dev(hid)->descriptor); in lg4ff_init()
1275 if (list_empty(&hid->inputs)) { in lg4ff_init()
1276 hid_err(hid, "no inputs found\n"); in lg4ff_init()
1279 hidinput = list_entry(hid->inputs.next, struct hid_input, list); in lg4ff_init()
1283 if (!hid_validate_values(hid, HID_OUTPUT_REPORT, 0, 0, 7)) in lg4ff_init()
1286 drv_data = hid_get_drvdata(hid); in lg4ff_init()
1288 hid_err(hid, "Cannot add device, private driver data not allocated\n"); in lg4ff_init()
1300 mmode_ret = lg4ff_handle_multimode_wheel(hid, &real_product_id, bcdDevice); in lg4ff_init()
1308 hid_err(hid, "Unable to switch device mode during initialization, errno %d\n", mmode_ret); in lg4ff_init()
1315 if (hid->product == lg4ff_devices[i].product_id) { in lg4ff_init()
1322 …hid_err(hid, "This device is flagged to be handled by the lg4ff module but this module does not kn… in lg4ff_init()
1336 hid_err(hid, "Device product ID %X is not listed as a multimode wheel", real_product_id); in lg4ff_init()
1372 error = device_create_file(&hid->dev, &dev_attr_combine_pedals); in lg4ff_init()
1374 hid_warn(hid, "Unable to create sysfs interface for \"combine\", errno %d\n", error); in lg4ff_init()
1375 error = device_create_file(&hid->dev, &dev_attr_range); in lg4ff_init()
1377 hid_warn(hid, "Unable to create sysfs interface for \"range\", errno %d\n", error); in lg4ff_init()
1379 error = device_create_file(&hid->dev, &dev_attr_real_id); in lg4ff_init()
1381 hid_warn(hid, "Unable to create sysfs interface for \"real_id\", errno %d\n", error); in lg4ff_init()
1382 error = device_create_file(&hid->dev, &dev_attr_alternate_modes); in lg4ff_init()
1384 hid_warn(hid, "Unable to create sysfs interface for \"alternate_modes\", errno %d\n", error); in lg4ff_init()
1391 entry->wdata.set_range(hid, entry->wdata.range); in lg4ff_init()
1405 lg4ff_set_leds(hid, 0); in lg4ff_init()
1407 name_sz = strlen(dev_name(&hid->dev)) + 8; in lg4ff_init()
1412 hid_err(hid, "can't allocate memory for LED %d\n", j); in lg4ff_init()
1417 snprintf(name, name_sz, "%s::RPM%d", dev_name(&hid->dev), j+1); in lg4ff_init()
1425 error = led_classdev_register(&hid->dev, led); in lg4ff_init()
1428 hid_err(hid, "failed to register LED %d. Aborting.\n", j); in lg4ff_init()
1445 hid_info(hid, "Force feedback support for Logitech Gaming Wheels\n"); in lg4ff_init()
1454 int lg4ff_deinit(struct hid_device *hid) in lg4ff_deinit() argument
1459 drv_data = hid_get_drvdata(hid); in lg4ff_deinit()
1461 hid_err(hid, "Error while deinitializing device, no private driver data.\n"); in lg4ff_deinit()
1470 device_remove_file(&hid->dev, &dev_attr_real_id); in lg4ff_deinit()
1471 device_remove_file(&hid->dev, &dev_attr_alternate_modes); in lg4ff_deinit()
1474 device_remove_file(&hid->dev, &dev_attr_combine_pedals); in lg4ff_deinit()
1475 device_remove_file(&hid->dev, &dev_attr_range); in lg4ff_deinit()