Namespace the device capabilities better

Fixes #224

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2019-02-18 14:56:45 +10:00
parent 561f0ac866
commit 8ae35fa11b
13 changed files with 35 additions and 35 deletions

View File

@@ -1410,7 +1410,7 @@ gskill_probe(struct ratbag_device *device)
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);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_DISABLE_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE_DISABLE);
ret = gskill_get_active_profile_idx(device);
if (ret < 0)

View File

@@ -424,7 +424,7 @@ hidpp10drv_read_profile(struct ratbag_profile *profile)
xres = 0xffff;
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_SWITCHABLE_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION_SWITCHABLE);
ratbag_profile_for_each_resolution(profile, res) {
unsigned int dpis[hidpp10->dpi_count];
@@ -503,8 +503,8 @@ 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_SWITCHABLE_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_DISABLE_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE_DISABLE);
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

@@ -1096,7 +1096,7 @@ hidpp20drv_init_feature(struct ratbag_device *device, uint16_t feature)
if (rc < 0)
return 0; /* this is not a hard failure */
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_SWITCHABLE_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION_SWITCHABLE);
drv_data->capabilities |= HIDPP_CAP_SWITCHABLE_RESOLUTION_2201;
break;
}
@@ -1178,7 +1178,7 @@ hidpp20drv_init_feature(struct ratbag_device *device, uint16_t feature)
log_debug(ratbag, "device has onboard profiles\n");
drv_data->capabilities |= HIDPP_CAP_ONBOARD_PROFILES_8100;
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_DISABLE_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE_DISABLE);
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

@@ -499,9 +499,9 @@ logitech_g300_probe(struct ratbag_device *device)
logitech_g300_read_profile(profile);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_SWITCHABLE_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION_SWITCHABLE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_SWITCHABLE_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

@@ -496,9 +496,9 @@ logitech_g600_probe(struct ratbag_device *device)
logitech_g600_read_profile(profile);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_SWITCHABLE_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION_SWITCHABLE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_SWITCHABLE_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

@@ -271,7 +271,7 @@ test_probe(struct ratbag_device *device, const void *data)
if (test_device->num_profiles > 1) {
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_BUTTON_MACROS);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_DISABLE_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE_DISABLE);
}
ratbag_device_for_each_profile(device, profile)

View File

@@ -112,7 +112,7 @@ enum ratbag_device_capability {
* query that, even if we can't switch it ourselves? Maybe better to
* have a separate cap for that then.
*/
RATBAG_DEVICE_CAP_SWITCHABLE_RESOLUTION,
RATBAG_DEVICE_CAP_RESOLUTION_SWITCHABLE,
/**
* The device provides read and/or write access to one or more
@@ -127,7 +127,7 @@ enum ratbag_device_capability {
* possibly with a button.
* Devices without this capability will only have a single profile.
*/
RATBAG_DEVICE_CAP_SWITCHABLE_PROFILE,
RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE,
/**
* The device has the capability to disable and enable profiles. While
@@ -136,7 +136,7 @@ enum ratbag_device_capability {
* next time ratbag runs. Furthermore, the order of profiles may get
* changed the next time ratbag runs if profiles are disabled.
*/
RATBAG_DEVICE_CAP_DISABLE_PROFILE,
RATBAG_DEVICE_CAP_PROFILE_DISABLE,
/**
* The device can have one profile assigned as a default profile.
@@ -144,7 +144,7 @@ enum ratbag_device_capability {
* is plugged in. Devices without this capability may select the
* last-used profile or a specific profile (usually the first).
*/
RATBAG_DEVICE_CAP_DEFAULT_PROFILE,
RATBAG_DEVICE_CAP_PROFILE_DEFAULT,
/**
* The device provides read and/or write access to one or more

View File

@@ -720,7 +720,7 @@ 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_SWITCHABLE_PROFILE);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE);
/* having more than one profile means we can remap the buttons
* at least */
@@ -730,7 +730,7 @@ ratbag_device_init_profiles(struct ratbag_device *device,
if (num_resolutions > 1) {
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_SWITCHABLE_RESOLUTION);
ratbag_device_set_capability(device, RATBAG_DEVICE_CAP_RESOLUTION_SWITCHABLE);
}
if (num_leds > 0)
@@ -812,7 +812,7 @@ LIBRATBAG_EXPORT enum ratbag_error_code
ratbag_profile_set_enabled(struct ratbag_profile *profile, bool enabled)
{
if (!ratbag_device_has_capability(profile->device,
RATBAG_DEVICE_CAP_DISABLE_PROFILE))
RATBAG_DEVICE_CAP_PROFILE_DISABLE))
return RATBAG_ERROR_CAPABILITY;
profile->is_enabled = enabled;
@@ -1004,7 +1004,7 @@ ratbag_profile_set_active(struct ratbag_profile *profile)
struct ratbag_profile *p;
int rc;
if (!ratbag_device_has_capability(device, RATBAG_DEVICE_CAP_SWITCHABLE_PROFILE))
if (!ratbag_device_has_capability(device, RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE))
return RATBAG_ERROR_CAPABILITY;
assert(device->driver->set_active_profile);

View File

@@ -96,7 +96,7 @@ struct ratbag_device;
* @struct ratbag_profile
*
* A handle to a profile context on devices with the @ref
* RATBAG_DEVICE_CAP_SWITCHABLE_PROFILE capability.
* RATBAG_DEVICE_CAP_PROFILE_SWITCHABLE capability.
* This struct is refcounted, use ratbag_profile_ref() and
* ratbag_profile_unref().
*/
@@ -573,7 +573,7 @@ ratbag_profile_set_name(struct ratbag_profile *profile,
* @ingroup profile
*
* Enable/disable the ratbag profile. For this to work, the device must support
* @ref RATBAG_DEVICE_CAP_DISABLE_PROFILE.
* @ref RATBAG_DEVICE_CAP_PROFILE_DISABLE.
*
* @param profile A previously initialized ratbag profile
* @param enabled Whether to enable or disable the profile
@@ -587,7 +587,7 @@ ratbag_profile_set_enabled(struct ratbag_profile *profile, bool enabled);
* @ingroup profile
*
* Check whether the ratbag profile is enabled or not. For devices that don't
* support @ref RATBAG_DEVICE_CAP_DISABLE_PROFILE the profile will always be
* support @ref RATBAG_DEVICE_CAP_PROFILE_DISABLE the profile will always be
* set to enabled.
*
* @param profile A previously initialized ratbag profile