aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2014-09-30 13:18:31 -0400
committerJiri Kosina <jkosina@suse.cz>2014-10-29 05:51:40 -0400
commit6a9ddc8978835deae0b2d918df74fc83588a4104 (patch)
tree82faeebc849df53288386b07602e17abfb3974ad /drivers/hid
parent33797820af98cde5c7cee00d00f0d8e255ea199f (diff)
HID: logitech-dj: enable notifications on connect/disconnect
The receiver can send HID++ notifications to the DJ devices when the physical devices are connected/disconnected. Enable this feature by default. This command uses a HID++ command instead of a DJ one, so use a direct call to usbhid instead of using logi_dj_recv_send_report() Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Tested-by: Andrew de los Reyes <adlr@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-logitech-dj.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 9bc39421627f..c917ab61aafa 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -630,7 +630,9 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
630static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, 630static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
631 unsigned timeout) 631 unsigned timeout)
632{ 632{
633 struct hid_device *hdev = djrcv_dev->hdev;
633 struct dj_report *dj_report; 634 struct dj_report *dj_report;
635 u8 *buf;
634 int retval; 636 int retval;
635 637
636 dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); 638 dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL);
@@ -642,7 +644,6 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
642 dj_report->report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F; 644 dj_report->report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F;
643 dj_report->report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout; 645 dj_report->report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout;
644 retval = logi_dj_recv_send_report(djrcv_dev, dj_report); 646 retval = logi_dj_recv_send_report(djrcv_dev, dj_report);
645 kfree(dj_report);
646 647
647 /* 648 /*
648 * Ugly sleep to work around a USB 3.0 bug when the receiver is still 649 * Ugly sleep to work around a USB 3.0 bug when the receiver is still
@@ -651,6 +652,30 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
651 */ 652 */
652 msleep(50); 653 msleep(50);
653 654
655 /*
656 * Magical bits to set up hidpp notifications when the dj devices
657 * are connected/disconnected.
658 *
659 * We can reuse dj_report because HIDPP_REPORT_SHORT_LENGTH is smaller
660 * than DJREPORT_SHORT_LENGTH.
661 */
662 buf = (u8 *)dj_report;
663
664 memset(buf, 0, HIDPP_REPORT_SHORT_LENGTH);
665
666 buf[0] = REPORT_ID_HIDPP_SHORT;
667 buf[1] = 0xFF;
668 buf[2] = 0x80;
669 buf[3] = 0x00;
670 buf[4] = 0x00;
671 buf[5] = 0x09;
672 buf[6] = 0x00;
673
674 hid_hw_raw_request(hdev, REPORT_ID_HIDPP_SHORT, buf,
675 HIDPP_REPORT_SHORT_LENGTH, HID_OUTPUT_REPORT,
676 HID_REQ_SET_REPORT);
677
678 kfree(dj_report);
654 return retval; 679 return retval;
655} 680}
656 681