From 7555cf1607af7449c2968a5f7f8a4f51c55688cd Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen Date: Tue, 24 Oct 2017 14:49:17 +0200 Subject: [PATCH] G300: set DPIs as a fixed list Set the list of DPIs directly instead of use the _from_range call. The G300 has few and coarse resolution options. Using the exponential'ish range is not a good fit for devices with so few dpis. The logitech G300 can set: 250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2250, 2500 but piper would offer: 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500 We overpromise by offering more finegrainded options than the mouse can do and end up with three times as many options than we should. --- 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 d33743a9..5056ef3b 100644 --- a/src/driver-logitech-g300.c +++ b/src/driver-logitech-g300.c @@ -386,6 +386,8 @@ logitech_g300_read_profile(struct ratbag_profile *profile) ratbag_profile_for_each_resolution(profile, resolution) { struct logitech_g300_resolution *res = &report->dpi_levels[resolution->index]; + unsigned int dpis[10] = { 250, 500, 750, 1000, 1250, 1500, 1750, + 2000, 2250, 2500 }; resolution->dpi_x = res->dpi * 250; resolution->dpi_y = res->dpi * 250; @@ -393,9 +395,8 @@ logitech_g300_read_profile(struct ratbag_profile *profile) resolution->is_default = res->is_default; resolution->is_active = res->is_default; - ratbag_resolution_set_dpi_list_from_range(resolution, - LOGITECH_G300_DPI_MIN, - LOGITECH_G300_DPI_MAX); + ratbag_resolution_set_dpi_list(resolution, dpis, + ARRAY_LENGTH(dpis)); ratbag_resolution_set_report_rate_list(resolution, &hz, 1); }