From 23d1290b220c17cb38f6c4e665eb831e38633f5f Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen Date: Thu, 21 Sep 2017 00:13:38 +0200 Subject: [PATCH] G300: set the active resolution It was implemented but never used before. Use it when writing the active profile.O --- src/driver-logitech-g300.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/driver-logitech-g300.c b/src/driver-logitech-g300.c index 3cd621b6..f913b562 100644 --- a/src/driver-logitech-g300.c +++ b/src/driver-logitech-g300.c @@ -267,11 +267,10 @@ logitech_g300_set_active_profile(struct ratbag_device *device, unsigned int inde return 0; } -#if 0 static int logitech_g300_set_current_resolution(struct ratbag_device *device, unsigned int index) { - uint8_t buf[] = {LOGITECH_G300_REPORT_ID_SET_ACTIVE, 0x40 + index*2, 0x00, 0x00}; + uint8_t buf[] = {LOGITECH_G300_REPORT_ID_SET_ACTIVE, 0x40 | (index << 1), 0x00, 0x00}; int ret; if (index >= LOGITECH_G300_NUM_DPI) @@ -282,7 +281,6 @@ logitech_g300_set_current_resolution(struct ratbag_device *device, unsigned int return ret == sizeof(buf) ? 0 : ret; } -#endif static void logitech_g300_read_profile(struct ratbag_profile *profile, unsigned int index) @@ -452,6 +450,9 @@ logitech_g300_write_profile(struct ratbag_profile *profile) res->dpi = resolution->dpi_x / 250; res->is_default = resolution->is_default; + + if (profile->is_active && resolution->is_active) + logitech_g300_set_current_resolution(device, i); } list_for_each(button, &profile->buttons, link) {