From 1b6e65bf8882bc133eb2ba48e3d373d3fc0286dd Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 13 Oct 2015 11:42:15 +1000 Subject: [PATCH] hidpp10: implement 0x64 set usb refresh rate call Signed-off-by: Peter Hutterer --- src/hidpp10.c | 14 ++++++++++++++ src/hidpp10.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/src/hidpp10.c b/src/hidpp10.c index d04a9236..2ec908d4 100644 --- a/src/hidpp10.c +++ b/src/hidpp10.c @@ -1001,6 +1001,20 @@ hidpp10_get_usb_refresh_rate(struct hidpp10_device *dev, return 0; } +int +hidpp10_set_usb_refresh_rate(struct hidpp10_device *dev, + uint16_t rate) +{ + unsigned idx = dev->index; + union hidpp10_message refresh = CMD_USB_REFRESH_RATE(idx, GET_REGISTER_REQ); + + log_raw(dev->ratbag_device->ratbag, "Setting USB refresh rate\n"); + + refresh.msg.parameters[0] = 1000/rate; + + return hidpp10_request_command(dev, &refresh); +} + /* -------------------------------------------------------------------------- */ /* 0xA2: Reading memory */ /* -------------------------------------------------------------------------- */ diff --git a/src/hidpp10.h b/src/hidpp10.h index 6466c1c4..239c1cd0 100644 --- a/src/hidpp10.h +++ b/src/hidpp10.h @@ -290,6 +290,10 @@ int hidpp10_get_usb_refresh_rate(struct hidpp10_device *dev, uint16_t *rate); +int +hidpp10_set_usb_refresh_rate(struct hidpp10_device *dev, + uint16_t rate); + /* -------------------------------------------------------------------------- */ /* 0xF1: Device Firmware Information */ /* -------------------------------------------------------------------------- */