diff options
Diffstat (limited to 'usr/src/dkms_source_tree/hid-ntrig.c')
| -rw-r--r-- | usr/src/dkms_source_tree/hid-ntrig.c | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/usr/src/dkms_source_tree/hid-ntrig.c b/usr/src/dkms_source_tree/hid-ntrig.c index 7f24715..d9e55d3 100644 --- a/usr/src/dkms_source_tree/hid-ntrig.c +++ b/usr/src/dkms_source_tree/hid-ntrig.c | |||
| @@ -105,6 +105,27 @@ static inline void ntrig_set_mode(struct hid_device *hdev, const int mode) | |||
| 105 | usbhid_submit_report(hdev, report, USB_DIR_IN); | 105 | usbhid_submit_report(hdev, report, USB_DIR_IN); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | static void ntrig_set_report(struct hid_device *hdev) | ||
| 109 | { | ||
| 110 | struct hid_report *report; | ||
| 111 | |||
| 112 | /* This is needed for devices with more recent firmware versions */ | ||
| 113 | report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a]; | ||
| 114 | if (report) { | ||
| 115 | /* Let the device settle to ensure the wakeup message gets | ||
| 116 | * through */ | ||
| 117 | usbhid_wait_io(hdev); | ||
| 118 | usbhid_submit_report(hdev, report, USB_DIR_IN); | ||
| 119 | |||
| 120 | /* | ||
| 121 | * Sanity check: if the current mode is invalid reset it to | ||
| 122 | * something reasonable. | ||
| 123 | */ | ||
| 124 | if (ntrig_get_mode(hdev) >= 4) | ||
| 125 | ntrig_set_mode(hdev, 3); | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 108 | static void ntrig_report_version(struct hid_device *hdev) | 129 | static void ntrig_report_version(struct hid_device *hdev) |
| 109 | { | 130 | { |
| 110 | int ret; | 131 | int ret; |
| @@ -433,7 +454,6 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 433 | struct ntrig_data *nd; | 454 | struct ntrig_data *nd; |
| 434 | struct hid_input *hidinput; | 455 | struct hid_input *hidinput; |
| 435 | struct input_dev *input; | 456 | struct input_dev *input; |
| 436 | struct hid_report *report; | ||
| 437 | 457 | ||
| 438 | if (id->driver_data & NTRIG_DUPLICATE_USAGES) | 458 | if (id->driver_data & NTRIG_DUPLICATE_USAGES) |
| 439 | hdev->quirks |= HID_QUIRK_MULTI_INPUT; | 459 | hdev->quirks |= HID_QUIRK_MULTI_INPUT; |
| @@ -480,21 +500,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 480 | } | 500 | } |
| 481 | } | 501 | } |
| 482 | 502 | ||
| 483 | /* This is needed for devices with more recent firmware versions */ | 503 | ntrig_set_report(hdev); |
| 484 | report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a]; | ||
| 485 | if (report) { | ||
| 486 | /* Let the device settle to ensure the wakeup message gets | ||
| 487 | * through */ | ||
| 488 | usbhid_wait_io(hdev); | ||
| 489 | usbhid_submit_report(hdev, report, USB_DIR_IN); | ||
| 490 | |||
| 491 | /* | ||
| 492 | * Sanity check: if the current mode is invalid reset it to | ||
| 493 | * something reasonable. | ||
| 494 | */ | ||
| 495 | if (ntrig_get_mode(hdev) >= 4) | ||
| 496 | ntrig_set_mode(hdev, 3); | ||
| 497 | } | ||
| 498 | 504 | ||
| 499 | ntrig_report_version(hdev); | 505 | ntrig_report_version(hdev); |
| 500 | 506 | ||
| @@ -504,6 +510,14 @@ err_free: | |||
| 504 | return ret; | 510 | return ret; |
| 505 | } | 511 | } |
| 506 | 512 | ||
| 513 | #ifdef CONFIG_PM | ||
| 514 | static int ntrig_reset_resume(struct hid_device *hdev) | ||
| 515 | { | ||
| 516 | ntrig_set_report(hdev); | ||
| 517 | return 0; | ||
| 518 | } | ||
| 519 | #endif | ||
| 520 | |||
| 507 | static void ntrig_remove(struct hid_device *hdev) | 521 | static void ntrig_remove(struct hid_device *hdev) |
| 508 | { | 522 | { |
| 509 | hid_hw_stop(hdev); | 523 | hid_hw_stop(hdev); |
| @@ -534,6 +548,9 @@ static struct hid_driver ntrig_driver = { | |||
| 534 | .input_mapped = ntrig_input_mapped, | 548 | .input_mapped = ntrig_input_mapped, |
| 535 | .usage_table = ntrig_grabbed_usages, | 549 | .usage_table = ntrig_grabbed_usages, |
| 536 | .event = ntrig_event, | 550 | .event = ntrig_event, |
| 551 | #ifdef CONFIG_PM | ||
| 552 | .reset_resume = ntrig_reset_resume, | ||
| 553 | #endif | ||
| 537 | }; | 554 | }; |
| 538 | 555 | ||
| 539 | static int __init ntrig_init(void) | 556 | static int __init ntrig_init(void) |
