From a55297e0fa288cf2f109d6fd0ad4026c511b029e Mon Sep 17 00:00:00 2001 From: Ilya Guterman Date: Sun, 17 Oct 2021 11:12:07 +0300 Subject: [PATCH] fix button count and default report rate always zero --- src/driver-hidpp20.c | 5 ++++- src/libratbag-data.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/driver-hidpp20.c b/src/driver-hidpp20.c index e0d969c4..b776301c 100644 --- a/src/driver-hidpp20.c +++ b/src/driver-hidpp20.c @@ -1096,6 +1096,7 @@ hidpp20drv_read_special_key_mouse(struct ratbag_device *device) drv_data->controls = NULL; drv_data->num_controls = 0; rc = hidpp20_special_key_mouse_get_controls(drv_data->dev, &drv_data->controls); + log_raw(device->ratbag, "num_control %d\n", rc); if (rc > 0) { drv_data->num_controls = rc; rc = 0; @@ -1646,7 +1647,9 @@ hidpp20drv_init_device(struct ratbag_device *device, if (num >= 0) drv_data->num_buttons = num; - drv_data->report_rates[0] = ratbag_device_data_hidpp20_get_report_rate(device->data);; + num = ratbag_device_data_hidpp20_get_report_rate(device->data); + if (num >= 0) + drv_data->report_rates[0] = num; ratbag_device_init_profiles(device, drv_data->num_profiles, diff --git a/src/libratbag-data.c b/src/libratbag-data.c index b4583a38..10389ffb 100644 --- a/src/libratbag-data.c +++ b/src/libratbag-data.c @@ -165,8 +165,10 @@ init_data_hidpp20(struct ratbag *ratbag, int num; char *str; + data->hidpp20.button_count = -1; data->hidpp20.index = -1; data->hidpp20.led_count = -1; + data->hidpp20.report_rate = -1; num = g_key_file_get_integer(keyfile, group, "Buttons", &error); if (num > 0 || !error)