1
0
forked from drath/libratbag

Merge pull request #10 from phomes/master

Fixes timeout problems with M705 and adds G9
This commit is contained in:
Peter Hutterer
2015-09-16 23:52:46 +10:00
3 changed files with 18 additions and 2 deletions

View File

@@ -285,6 +285,9 @@ static const struct ratbag_id hidpp10drv_table[] = {
/* G5 */
{ .id = LOGITECH_DEVICE(BUS_USB, 0xc041) },
/* G9 */
{ .id = LOGITECH_DEVICE(BUS_USB, 0xc048) },
/* G500s */
{ .id = LOGITECH_DEVICE(BUS_USB, 0xc24e),
.svg_filename = "logitech-g500s.svg" },

View File

@@ -138,6 +138,12 @@ hidpp10_request_command(struct hidpp10_device *dev, union hidpp10_message *msg)
do {
ret = ratbag_hidraw_read_input_report(device, read_buffer.data, LONG_MESSAGE_LENGTH);
/* Wait and retry if the USB timed out */
if (ret == -ETIMEDOUT) {
msleep(10);
ret = ratbag_hidraw_read_input_report(device, read_buffer.data, LONG_MESSAGE_LENGTH);
}
/* Overwrite the return device index with ours. The kernel
* sets our device index on write, but gives us the real
* device index on reply. Overwrite it with our index so the
@@ -145,7 +151,7 @@ hidpp10_request_command(struct hidpp10_device *dev, union hidpp10_message *msg)
*/
read_buffer.msg.device_idx = msg->msg.device_idx;
log_buf_raw(ratbag, " *** received: ", read_buffer.data, ret);
log_buf_raw(ratbag, " *** received: ", read_buffer.data, ret > 0 ? ret : 0);
/* actual answer */

View File

@@ -116,7 +116,14 @@ hidpp20_request_command_allow_error(struct ratbag_device *device, union hidpp20_
*/
do {
ret = ratbag_hidraw_read_input_report(device, read_buffer.data, LONG_MESSAGE_LENGTH);
log_buf_raw(ratbag, " *** received: ", read_buffer.data, ret);
/* Wait and retry if the USB timed out */
if (ret == -ETIMEDOUT) {
msleep(10);
ret = ratbag_hidraw_read_input_report(device, read_buffer.data, LONG_MESSAGE_LENGTH);
}
log_buf_raw(ratbag, " *** received: ", read_buffer.data, ret > 0 ? ret : 0);
if (read_buffer.msg.report_id != REPORT_ID_SHORT &&
read_buffer.msg.report_id != REPORT_ID_LONG)