From cbc0f0c4c7b0074ecfd5c37cfe93a65c785dd3b5 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen Date: Thu, 17 Sep 2015 17:05:14 +0200 Subject: [PATCH 1/2] hidpp10: Read colors in profiles --- src/hidpp10.c | 8 +++++++- src/hidpp10.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/hidpp10.c b/src/hidpp10.c index ee0db4d5..0e875564 100644 --- a/src/hidpp10.c +++ b/src/hidpp10.c @@ -389,7 +389,10 @@ union _hidpp10_button_binding { _Static_assert(sizeof(union _hidpp10_button_binding) == 3, "Invalid size"); struct _hidpp10_profile { - uint8_t unknown[4]; + uint8_t red; + uint8_t green; + uint8_t blue; + uint8_t unknown; struct _hidpp10_dpi_mode dpi_modes[PROFILE_NUM_DPI_MODES]; uint8_t angle_correction; uint8_t default_dpi_mode; @@ -450,6 +453,9 @@ hidpp10_get_profile(struct hidpp10_device *dev, int8_t number, struct hidpp10_pr return res; } + profile.red = p->red; + profile.green = p->green; + profile.blue = p->blue; profile.angle_correction = p->angle_correction; profile.default_dpi_mode = p->default_dpi_mode; profile.refresh_rate = p->usb_refresh_rate ? 1000/p->usb_refresh_rate : 0; diff --git a/src/hidpp10.h b/src/hidpp10.h index 54e9798c..494290a8 100644 --- a/src/hidpp10.h +++ b/src/hidpp10.h @@ -132,6 +132,9 @@ struct hidpp10_profile { } dpi_modes[5]; size_t num_dpi_modes; + uint8_t red; + uint8_t green; + uint8_t blue; bool angle_correction; uint8_t default_dpi_mode; uint16_t refresh_rate; From 5ee30e5a65cbec89711b9453c8aab612199e943d Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen Date: Thu, 17 Sep 2015 17:06:50 +0200 Subject: [PATCH 2/2] hidpp10: don't skip the first profile Only skip the first two profiles that seem like garbage. --- src/hidpp10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hidpp10.c b/src/hidpp10.c index 0e875564..0976e837 100644 --- a/src/hidpp10.c +++ b/src/hidpp10.c @@ -443,7 +443,7 @@ hidpp10_get_profile(struct hidpp10_device *dev, int8_t number, struct hidpp10_pr struct hidpp10_profile profile; /* FIXME: profile offset appears to be 3, 1 and 2 are garbage */ - number += 3; + number += 2; log_raw(dev->ratbag_device->ratbag, "Fetching profile %d\n", number);