From 051f92f9800ef05250d7dcb8ebe09b6c0710699d Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 1 Sep 2015 09:41:31 -0400 Subject: [PATCH] etekcity: fix support of per axis resolution In the end, we just ignore the sensitivity setting. On the Etekcity, it looks like it is ignored by the mouse, or maybe the Windows software just messes things up and should not update the per-axis dpi when playing with sensitivity. Signed-off-by: Benjamin Tissoires --- src/driver-etekcity.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/driver-etekcity.c b/src/driver-etekcity.c index e3abdd65..a5cd54d5 100644 --- a/src/driver-etekcity.c +++ b/src/driver-etekcity.c @@ -453,10 +453,11 @@ etekcity_read_profile(struct ratbag_profile *profile, unsigned int index) struct etekcity_data *drv_data; struct ratbag_resolution *resolution; struct etekcity_settings_report *setting_report; - int rc; - uint8_t *buf, *dpi_list; + uint8_t *buf; unsigned int report_rate; unsigned int i, j; + int dpi_x, dpi_y, hz; + int rc; assert(index <= ETEKCITY_PROFILE_MAX); @@ -487,23 +488,10 @@ etekcity_read_profile(struct ratbag_profile *profile, unsigned int index) profile->resolution.num_modes = ETEKCITY_NUM_DPI; - /* this will be optimized out by the compiler, but: - * - if one of the 2 X or Y sensitivity is set to 0 (0x0a), we read the - * dpi settings from here - * - if not, then we take the ones from X and pray they have a meaning - */ - /* FIXME: yeah, xres and yres would be even better */ - if (setting_report->x_sensitivity == 0x0a) - dpi_list = setting_report->xres; - else if (setting_report->y_sensitivity == 0x0a) - dpi_list = setting_report->yres; - else - dpi_list = setting_report->xres; - for (i = 0; i < ETEKCITY_NUM_DPI; i++) { - int dpi, hz; resolution = &profile->resolution.modes[i]; - dpi = dpi_list[i] * 50; + dpi_x = setting_report->xres[i] * 50; + dpi_y = setting_report->yres[i] * 50; hz = report_rate; if (!(setting_report->dpi_mask & (1 << i))) { /* the profile is disabled, overwrite it */ @@ -511,8 +499,9 @@ etekcity_read_profile(struct ratbag_profile *profile, unsigned int index) resolution->dpi_y = 0; resolution->hz = 0; } - /* FIXME */ - ratbag_resolution_init(profile, i, dpi, dpi, hz); + ratbag_resolution_init(profile, i, dpi_x, dpi_y, hz); + ratbag_resolution_set_cap(resolution, + RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION); resolution->is_active = (i == setting_report->current_dpi); }