Commit 8dba3026d5453aa6de00f8726fdcde45d5c57484
Committed by
Jiri Kosina
1 parent
351744aa0f
HID: logitech-dj: allow devices to request full pairing information
Register 0xB5 should be handled specially no matter what function is used. This allows to retrieve the serial and the Quad ID from hid-logitech-hidpp directly. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Tested-by: Bastien Nocera <hadess@hadess.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Showing 1 changed file with 11 additions and 8 deletions Side-by-side Diff
drivers/hid/hid-logitech-dj.c
... | ... | @@ -692,8 +692,12 @@ |
692 | 692 | dbg_hid("%s:%s\n", __func__, hid->phys); |
693 | 693 | } |
694 | 694 | |
695 | -static u8 unifying_name_query[] = {0x10, 0xff, 0x83, 0xb5, 0x40, 0x00, 0x00}; | |
696 | -static u8 unifying_name_answer[] = {0x11, 0xff, 0x83, 0xb5}; | |
695 | +/* | |
696 | + * Register 0xB5 is "pairing information". It is solely intended for the | |
697 | + * receiver, so do not overwrite the device index. | |
698 | + */ | |
699 | +static u8 unifying_pairing_query[] = {0x10, 0xff, 0x83, 0xb5}; | |
700 | +static u8 unifying_pairing_answer[] = {0x11, 0xff, 0x83, 0xb5}; | |
697 | 701 | |
698 | 702 | static int logi_dj_ll_raw_request(struct hid_device *hid, |
699 | 703 | unsigned char reportnum, __u8 *buf, |
... | ... | @@ -712,9 +716,9 @@ |
712 | 716 | |
713 | 717 | /* special case where we should not overwrite |
714 | 718 | * the device_index */ |
715 | - if (count == 7 && !memcmp(buf, unifying_name_query, | |
716 | - sizeof(unifying_name_query))) | |
717 | - buf[4] |= djdev->device_index - 1; | |
719 | + if (count == 7 && !memcmp(buf, unifying_pairing_query, | |
720 | + sizeof(unifying_pairing_query))) | |
721 | + buf[4] = (buf[4] & 0xf0) | (djdev->device_index - 1); | |
718 | 722 | else |
719 | 723 | buf[1] = djdev->device_index; |
720 | 724 | return hid_hw_raw_request(djrcv_dev->hdev, reportnum, buf, |
... | ... | @@ -911,9 +915,8 @@ |
911 | 915 | /* special case were the device wants to know its unifying |
912 | 916 | * name */ |
913 | 917 | if (size == HIDPP_REPORT_LONG_LENGTH && |
914 | - !memcmp(data, unifying_name_answer, | |
915 | - sizeof(unifying_name_answer)) && | |
916 | - ((data[4] & 0xF0) == 0x40)) | |
918 | + !memcmp(data, unifying_pairing_answer, | |
919 | + sizeof(unifying_pairing_answer))) | |
917 | 920 | device_index = (data[4] & 0x0F) + 1; |
918 | 921 | else |
919 | 922 | return false; |