diff --git a/src/driver-hidpp10.c b/src/driver-hidpp10.c index f7f23cc6..3ae71786 100644 --- a/src/driver-hidpp10.c +++ b/src/driver-hidpp10.c @@ -136,6 +136,7 @@ hidpp10drv_read_profile(struct ratbag_profile *profile, unsigned int index) int rc; unsigned int i; uint16_t xres, yres; + int8_t idx; drv_data = ratbag_get_drv_data(device); hidpp10 = drv_data->dev; @@ -143,6 +144,10 @@ hidpp10drv_read_profile(struct ratbag_profile *profile, unsigned int index) if (rc) return; + rc = hidpp10_get_current_profile(hidpp10, &idx); + if (rc == 0 && (unsigned int)idx == profile->index) + profile->is_active = true; + rc = hidpp10_get_current_resolution(hidpp10, &xres, &yres); if (rc) xres = 0xffff; @@ -153,10 +158,7 @@ hidpp10drv_read_profile(struct ratbag_profile *profile, unsigned int index) profile->resolution.modes[i].dpi = p.dpi_modes[i].xres; profile->resolution.modes[i].hz = p.refresh_rate; profile->resolution.modes[i].is_active = false; - /* FIXME: active != default. p.default_dpi_mode is the - * default, we can only tick the active in the currently - * active profile */ - if (profile->resolution.modes[i].dpi == xres) + if (profile->is_active && profile->resolution.modes[i].dpi == xres) profile->resolution.modes[i].is_active = true; if (i == p.default_dpi_mode) profile->resolution.modes[i].is_default = true; diff --git a/src/hidpp10.c b/src/hidpp10.c index 6a783fef..40f28745 100644 --- a/src/hidpp10.c +++ b/src/hidpp10.c @@ -398,8 +398,9 @@ hidpp10_get_current_profile(struct hidpp10_device *dev, int8_t *current_profile) page = profile.msg.parameters[0]; /* FIXME: my mouse is always 0 */ *current_profile = page; - /* FIXME: my mouse appears to be on profile 5, not sure how to - * change this */ + /* FIXME: my mouse appears to be on page 5, but with the offset of + * 3, it's actually profile 2. not sure how to change this */ + *current_profile = 2; return 0; }