mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 15:14:38 +01:00
hidpp10: implement get_extended_pairing_info for the serial number
This request has more information, for now we just fetch the serial number Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
committed by
Benjamin Tissoires
parent
3eb331da50
commit
bdcc194e41
@@ -1145,6 +1145,26 @@ hidpp10_get_pairing_information_device_name(struct hidpp10_device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
hidpp10_get_extended_pairing_information(struct hidpp10_device *dev,
|
||||
uint32_t *serial)
|
||||
{
|
||||
unsigned int idx = dev->index;
|
||||
union hidpp10_message info = CMD_PAIRING_INFORMATION(idx, DEVICE_EXTENDED_PAIRING_INFORMATION);
|
||||
int res;
|
||||
|
||||
hidpp_log_raw(&dev->base, "Fetching extended pairing information\n");
|
||||
|
||||
res = hidpp10_request_command(dev, &info);
|
||||
if (res)
|
||||
return -1;
|
||||
|
||||
*serial = hidpp10_get_unaligned_u16(&info.msg.string[2]) << 16;
|
||||
*serial |= hidpp10_get_unaligned_u16(&info.msg.string[4]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* 0xF1: Device Firmware Information */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
@@ -492,6 +492,9 @@ int
|
||||
hidpp10_get_pairing_information_device_name(struct hidpp10_device *dev,
|
||||
char *name,
|
||||
size_t *name_sz);
|
||||
int
|
||||
hidpp10_get_extended_pairing_information(struct hidpp10_device *dev,
|
||||
uint32_t *serial);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* 0xF1: Device Firmware Information */
|
||||
|
||||
Reference in New Issue
Block a user