forked from drath/libratbag
tools: drop active profile check in "profile active set"
Once we have the profile, we can call set_active and be done with it. No need to check if another profile is currently active. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -945,7 +945,6 @@ ratbag_cmd_profile_active_set(const struct ratbag_cmd *cmd,
|
||||
struct ratbag_profile *profile = NULL, *active_profile = NULL;
|
||||
int num_profiles, index;
|
||||
int rc = 1;
|
||||
int i;
|
||||
|
||||
if (argc != 1) {
|
||||
usage();
|
||||
@@ -982,20 +981,6 @@ ratbag_cmd_profile_active_set(const struct ratbag_cmd *cmd,
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_profiles; i++) {
|
||||
active_profile = ratbag_device_get_profile_by_index(device, i);
|
||||
if (ratbag_profile_is_active(active_profile))
|
||||
break;
|
||||
ratbag_profile_unref(active_profile);
|
||||
active_profile = NULL;
|
||||
}
|
||||
|
||||
if (!active_profile) {
|
||||
error("Failed to retrieve the profile '%d' \n",
|
||||
index);
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = ratbag_profile_set_active(profile);
|
||||
if (!rc) {
|
||||
printf("Switched '%s' to profile '%d'\n",
|
||||
|
||||
Reference in New Issue
Block a user