1
0
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:
Peter Hutterer
2015-09-14 11:21:57 +10:00
parent f97a3142d1
commit aee827efa1

View File

@@ -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",