From 5f0f5d2843bd87c1dbe358bb1982493f28b077d9 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 26 Sep 2018 15:01:20 +1000 Subject: [PATCH] driver-hidpp10: force the single profile to be active If we can successfully read a profile but hidpp10_get_current_profile() fails we end up with one profile, but not set to active. Fix this by always forcing the single profile to be active. Fixes #526 --- src/driver-hidpp10.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/driver-hidpp10.c b/src/driver-hidpp10.c index 65c7b1dd..42c632c5 100644 --- a/src/driver-hidpp10.c +++ b/src/driver-hidpp10.c @@ -696,6 +696,18 @@ hidpp10drv_probe(struct ratbag_device *device) ratbag_device_for_each_profile(device, profile) hidpp10drv_read_profile(profile); + if (device->num_profiles == 1) { + _cleanup_profile_ struct ratbag_profile *profile; + + profile = ratbag_device_get_profile(device, 0); + if (!profile->is_active) { + log_debug(device->ratbag, + "%s: forcing profile 0 to active.\n", + device->name); + profile->is_active = true; + } + } + return 0; err: free(drv_data);