forked from drath/libratbag
hidpp10: convert get_usb_refresh_rate to a proper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -433,23 +433,22 @@ hidpp10_get_current_resolution(struct ratbag_device *device, struct hidpp10_devi
|
||||
} \
|
||||
}
|
||||
|
||||
static int
|
||||
hidpp10_get_usb_refresh_rate(struct ratbag_device *device, struct hidpp10_device *dev)
|
||||
int
|
||||
hidpp10_get_usb_refresh_rate(struct ratbag_device *device,
|
||||
struct hidpp10_device *dev,
|
||||
uint16_t *rate)
|
||||
{
|
||||
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];
|
||||
*rate = 1000/refresh.msg.parameters[0];
|
||||
|
||||
log_debug(device->ratbag, "Refresh rate: %dHz\n", rate);
|
||||
|
||||
dev->refresh_rate = rate;
|
||||
log_debug(device->ratbag, "Refresh rate: %dHz\n", *rate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -637,7 +636,7 @@ hidpp10_get_device_info(struct ratbag_device *device, struct hidpp10_device *dev
|
||||
hidpp10_get_current_resolution(device, dev, &dev->xres, &dev->yres);
|
||||
hidpp10_get_led_status(device, dev, dev->led);
|
||||
hidpp10_get_optical_sensor_settings(device, dev);
|
||||
hidpp10_get_usb_refresh_rate(device, dev);
|
||||
hidpp10_get_usb_refresh_rate(device, dev, &dev->refresh_rate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -140,6 +140,15 @@ int
|
||||
hidpp10_get_current_resolution(struct ratbag_device *device,
|
||||
struct hidpp10_device *dev,
|
||||
uint16_t *xres, uint16_t *yres);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* 0x64: Device Firmware Information */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
int
|
||||
hidpp10_get_usb_refresh_rate(struct ratbag_device *device,
|
||||
struct hidpp10_device *dev,
|
||||
uint16_t *rate);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* 0xF1: Device Firmware Information */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user