1
0
forked from drath/libratbag

Move the set-default-profile capability into the profiles

Theoretical case is where some profiles cannot be set to be the default, but
realistically: this is a profile-specific attribute so let's move the flag
there.

Arguably, the DBus API should not expose SetDefault() where not available, but
that's a separate issue.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2019-02-20 11:56:56 +10:00
parent 8ae35fa11b
commit af729ec16b
5 changed files with 11 additions and 10 deletions

View File

@@ -251,7 +251,6 @@ ratbagd_device_get_capabilities(sd_bus *bus,
RATBAG_DEVICE_CAP_PROFILE,
RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE,
RATBAG_DEVICE_CAP_PROFILE_DISABLE,
RATBAG_DEVICE_CAP_PROFILE_DEFAULT,
RATBAG_DEVICE_CAP_BUTTON,
RATBAG_DEVICE_CAP_BUTTON_KEY,
RATBAG_DEVICE_CAP_BUTTON_MACROS,

View File

@@ -409,6 +409,7 @@ ratbagd_profile_get_capabilities(sd_bus *bus,
enum ratbag_profile_capability cap;
enum ratbag_profile_capability caps[] = {
RATBAG_PROFILE_CAP_WRITABLE_NAME,
RATBAG_PROFILE_CAP_SET_DEFAULT,
};
size_t i;

View File

@@ -138,13 +138,6 @@ enum ratbag_device_capability {
*/
RATBAG_DEVICE_CAP_PROFILE_DISABLE,
/**
* The device can have one profile assigned as a default profile.
* A default profile is the profile that is selected when the device
* is plugged in. Devices without this capability may select the
* last-used profile or a specific profile (usually the first).
*/
RATBAG_DEVICE_CAP_PROFILE_DEFAULT,
/**
* The device provides read and/or write access to one or more
@@ -183,6 +176,15 @@ enum ratbag_profile_capability {
* and will be committed to it after a commit only.
*/
RATBAG_PROFILE_CAP_WRITABLE_NAME = 100,
/**
* This profile can be assigned as the default profile. A default
* profile is the profile that is selected when the device
* is plugged in. Where no profile is assigned as the default
* profile, the device either picks last-used profile or a specific
* profile (usually the first).
*/
RATBAG_PROFILE_CAP_SET_DEFAULT,
};
/**

View File

@@ -262,7 +262,6 @@ def print_device(d, level):
RatbagdDevice.CAP_PROFILE_SWITCHABLE: "switchable-profile",
RatbagdDevice.CAP_BUTTON_KEY: "button-keys",
RatbagdDevice.CAP_BUTTON_MACROS: "button-macros",
RatbagdDevice.CAP_PROFILE_DEFAULT: "default-profile",
RatbagdDevice.CAP_QUERY_CONFIGURATION: "query-configuration",
RatbagdDevice.CAP_PROFILE_DISABLE: "disable-profile",
RatbagdDevice.CAP_LED: "led"}

View File

@@ -324,7 +324,6 @@ class RatbagdDevice(_RatbagdDBus):
CAP_PROFILE = 200
CAP_PROFILE_SWITCHABLE = 201
CAP_PROFILE_DISABLE = 202
CAP_PROFILE_DEFAULT = 203
CAP_BUTTON = 300
CAP_BUTTON_KEY = 301
CAP_BUTTON_MACROS = 302
@@ -424,6 +423,7 @@ class RatbagdProfile(_RatbagdDBus):
"""Represents a ratbagd profile."""
CAP_WRITABLE_NAME = 100
CAP_SET_DEFAULT = 101
def __init__(self, object_path):
_RatbagdDBus.__init__(self, "Profile", object_path)