mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
hidpp10: implement refresh rate
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -383,6 +383,25 @@ hidpp10_get_optical_sensor_settings(struct ratbag_device *device, struct hidpp10
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
hidpp10_get_usb_refresh_rate(struct ratbag_device *device, struct hidpp10_device *dev)
|
||||
{
|
||||
unsigned idx = dev->index;
|
||||
union hidpp10_message refresh = CMD_USB_REFRESH_RATE(idx, GET_REGISTER_REQ);
|
||||
int res;
|
||||
int rate;
|
||||
|
||||
res = hidpp10_request_command(device, &refresh);
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
rate = 1000/refresh.msg.parameters[0];
|
||||
|
||||
log_debug(device->ratbag, "Refresh rate: %dHz\n", rate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
hidpp10_get_device_info(struct ratbag_device *device, struct hidpp10_device *dev)
|
||||
{
|
||||
@@ -395,6 +414,7 @@ hidpp10_get_device_info(struct ratbag_device *device, struct hidpp10_device *dev
|
||||
hidpp10_get_current_resolution(device, dev);
|
||||
hidpp10_get_led_status(device, dev);
|
||||
hidpp10_get_optical_sensor_settings(device, dev);
|
||||
hidpp10_get_usb_refresh_rate(device, dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -93,6 +93,8 @@
|
||||
|
||||
#define __CMD_OPTICAL_SENSOR_SETTINGS 0x61
|
||||
|
||||
#define __CMD_USB_REFRESH_RATE 0x64
|
||||
|
||||
#define CMD_PAIRING_INFORMATION(idx, type) { \
|
||||
.msg = { \
|
||||
.report_id = REPORT_ID_SHORT, \
|
||||
@@ -163,6 +165,16 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#define CMD_USB_REFRESH_RATE(idx, sub) { \
|
||||
.msg = { \
|
||||
.report_id = REPORT_ID_SHORT, \
|
||||
.device_idx = idx, \
|
||||
.sub_id = sub, \
|
||||
.address = __CMD_USB_REFRESH_RATE, \
|
||||
.parameters = {0x00, 0x00, 0x00 }, \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CMD_OPTICAL_SENSOR_SETTINGS(idx, sub) { \
|
||||
.msg = { \
|
||||
.report_id = REPORT_ID_SHORT, \
|
||||
|
||||
Reference in New Issue
Block a user