mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
hidpp10: add Optical sensor settings command
From: https://github.com/cvuchener/g500/blob/master/doc/report.md but we don't know what the return value is... Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -367,6 +367,22 @@ hidpp10_get_led_status(struct ratbag_device *device, struct hidpp10_device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
hidpp10_get_optical_sensor_settings(struct ratbag_device *device, struct hidpp10_device *dev)
|
||||
{
|
||||
unsigned idx = dev->index;
|
||||
union hidpp10_message sensor = CMD_OPTICAL_SENSOR_SETTINGS(idx, GET_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
res = hidpp10_request_command(device, &sensor);
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
/* Don't know what the return value is here */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
hidpp10_get_device_info(struct ratbag_device *device, struct hidpp10_device *dev)
|
||||
{
|
||||
@@ -378,6 +394,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);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -91,6 +91,8 @@
|
||||
|
||||
#define __CMD_CURRENT_RESOLUTION 0x63
|
||||
|
||||
#define __CMD_OPTICAL_SENSOR_SETTINGS 0x61
|
||||
|
||||
#define CMD_PAIRING_INFORMATION(idx, type) { \
|
||||
.msg = { \
|
||||
.report_id = REPORT_ID_SHORT, \
|
||||
@@ -161,6 +163,16 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#define CMD_OPTICAL_SENSOR_SETTINGS(idx, sub) { \
|
||||
.msg = { \
|
||||
.report_id = REPORT_ID_SHORT, \
|
||||
.device_idx = idx, \
|
||||
.sub_id = sub, \
|
||||
.address = __CMD_OPTICAL_SENSOR_SETTINGS, \
|
||||
.parameters = {0x00, 0x00, 0x00}, \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ERR_SUCCESS 0x00
|
||||
#define ERR_INVALID_SUBID 0x01
|
||||
#define ERR_INVALID_ADDRESS 0x02
|
||||
|
||||
Reference in New Issue
Block a user