1
0
forked from drath/libratbag

asus: fix single profile devices

This commit is contained in:
Kyoken
2023-06-04 18:58:18 +03:00
parent b1cdf6a4c2
commit f5e2259da5
2 changed files with 15 additions and 10 deletions

View File

@@ -5,7 +5,7 @@ DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=0
Profiles=1
Buttons=6
Leds=1
Dpis=2

View File

@@ -326,15 +326,18 @@ asus_driver_load_profiles(struct ratbag_device *device)
int rc;
struct asus_profile_data profile_data;
struct ratbag_profile *profile;
unsigned int current_profile_id;
unsigned int current_profile_id = 0;
/* get current profile id */
rc = asus_get_profile_data(device, &profile_data);
if (rc)
return rc;
current_profile_id = profile_data.profile_id;
log_debug(device->ratbag, "Initial profile is %d\n", current_profile_id);
if (device->num_profiles > 1) {
current_profile_id = profile_data.profile_id;
log_debug(device->ratbag, "Initial profile is %d\n", current_profile_id);
}
log_debug(
device->ratbag, "Primary version %02X.%02X.%02X\n",
profile_data.version_primary_major,
@@ -381,15 +384,17 @@ asus_driver_save_profiles(struct ratbag_device *device)
int rc;
struct asus_profile_data profile_data;
struct ratbag_profile *profile;
unsigned int current_profile_id;
unsigned int current_profile_id = 0;
/* get current profile id */
rc = asus_get_profile_data(device, &profile_data);
if (rc)
return rc;
if (device->num_profiles > 1) {
rc = asus_get_profile_data(device, &profile_data);
if (rc)
return rc;
current_profile_id = profile_data.profile_id;
log_debug(device->ratbag, "Initial profile is %d\n", current_profile_id);
current_profile_id = profile_data.profile_id;
log_debug(device->ratbag, "Initial profile is %d\n", current_profile_id);
}
ratbag_device_for_each_profile(device, profile) {
if (!profile->dirty)