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:
Peter Hutterer
2015-08-24 14:23:03 +10:00
parent ed320bcdea
commit adf1b9a99d
2 changed files with 29 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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