1
0
forked from drath/libratbag

Drop the switchable-profile device capability

If we have more than one profile, we can switch between them. Because
otherwise having more than one profile is just showing off and we don't like
that type of behaviour, no no.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2019-02-20 12:24:14 +10:00
parent d24ea1e662
commit d6bbc33dda
9 changed files with 3 additions and 20 deletions

View File

@@ -248,7 +248,6 @@ ratbagd_device_get_capabilities(sd_bus *bus,
RATBAG_DEVICE_CAP_QUERY_CONFIGURATION,
RATBAG_DEVICE_CAP_RESOLUTION,
RATBAG_DEVICE_CAP_PROFILE,
RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE,
RATBAG_DEVICE_CAP_BUTTON,
RATBAG_DEVICE_CAP_BUTTON_KEY,
RATBAG_DEVICE_CAP_BUTTON_MACROS,

View File

@@ -504,7 +504,6 @@ hidpp10drv_fill_from_profile(struct ratbag_device *device, struct hidpp10_device
if (dev->profile_type != HIDPP10_PROFILE_UNKNOWN) {
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON_KEY);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON_MACROS);

View File

@@ -500,7 +500,6 @@ logitech_g300_probe(struct ratbag_device *device)
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON_KEY);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON_MACROS);

View File

@@ -497,7 +497,6 @@ logitech_g600_probe(struct ratbag_device *device)
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON_KEY);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON_MACROS);

View File

@@ -110,15 +110,6 @@ enum ratbag_device_capability {
*/
RATBAG_DEVICE_CAP_PROFILE = 200,
/**
* The device can switch between hardware profiles.
* A device with this capability can store multiple profiles in the
* hardware and provides the ability to switch between the profiles,
* possibly with a button.
* Devices without this capability will only have a single profile.
*/
RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE,
/**
* The device provides read and/or write access to one or more
* buttons.

View File

@@ -720,7 +720,6 @@ ratbag_device_init_profiles(struct ratbag_device *device,
if (num_profiles > 1) {
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE);
/* having more than one profile means we can remap the buttons
* at least */
@@ -1001,8 +1000,8 @@ ratbag_profile_set_active(struct ratbag_profile *profile)
struct ratbag_profile *p;
int rc;
if (!ratbag_device_has_capability(device, RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE))
return RATBAG_ERROR_CAPABILITY;
if (device->num_profiles == 1)
return RATBAG_SUCCESS;
assert(device->driver->set_active_profile);
rc = device->driver->set_active_profile(device, profile->index);

View File

@@ -95,8 +95,7 @@ struct ratbag_device;
* @ingroup profile
* @struct ratbag_profile
*
* A handle to a profile context on devices with the @ref
* RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE capability.
* A handle to a profile context on devices.
* This struct is refcounted, use ratbag_profile_ref() and
* ratbag_profile_unref().
*/

View File

@@ -258,7 +258,6 @@ def print_device(d, level):
caps = {RatbagdDevice.CAP_RESOLUTION: "resolution",
RatbagdDevice.CAP_PROFILE: "profile",
RatbagdDevice.CAP_BUTTON: "button",
RatbagdDevice.CAP_PROFILE_SWITCHABLE: "switchable-profile",
RatbagdDevice.CAP_BUTTON_KEY: "button-keys",
RatbagdDevice.CAP_BUTTON_MACROS: "button-macros",
RatbagdDevice.CAP_QUERY_CONFIGURATION: "query-configuration",

View File

@@ -321,7 +321,6 @@ class RatbagdDevice(_RatbagdDBus):
CAP_QUERY_CONFIGURATION = 1
CAP_RESOLUTION = 100
CAP_PROFILE = 200
CAP_PROFILE_SWITCHABLE = 201
CAP_BUTTON = 300
CAP_BUTTON_KEY = 301
CAP_BUTTON_MACROS = 302