1
0
forked from drath/libratbag

driver-hidpp10: hook up the active profile bits

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2015-08-28 11:10:58 +10:00
parent 49d70577c0
commit 0d951724dc
2 changed files with 9 additions and 6 deletions

View File

@@ -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;

View File

@@ -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;
}