libratbag.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 Red Hat, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #pragma once
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #include <stdlib.h>
31 #include <stdarg.h>
32 #include <stdbool.h>
33 #include <libudev.h>
34 
35 #define LIBRATBAG_ATTRIBUTE_PRINTF(_format, _args) \
36  __attribute__ ((format (printf, _format, _args)))
37 #define LIBRATBAG_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
38 
85 struct ratbag;
86 
95 
106 
117 
128 struct ratbag_resolution;
129 
138 struct ratbag_color {
139  unsigned int red;
140  unsigned int green;
141  unsigned int blue;
142 };
143 
150 struct ratbag_led;
151 
161 struct ratbag_button_macro;
162 
170 
176 
182 
188 
196 
204 };
205 
220 };
221 
236 typedef void (*ratbag_log_handler)(struct ratbag *ratbag,
237  enum ratbag_log_priority priority,
238  const char *format, va_list args)
240 
256 void
257 ratbag_log_set_priority(struct ratbag *ratbag,
258  enum ratbag_log_priority priority);
259 
275 ratbag_log_get_priority(const struct ratbag *ratbag);
276 
292 void
293 ratbag_log_set_handler(struct ratbag *ratbag,
294  ratbag_log_handler log_handler);
295 
296 
319  int (*open_restricted)(const char *path, int flags, void *user_data);
327  void (*close_restricted)(int fd, void *user_data);
328 };
329 
340 struct ratbag *
341 ratbag_create_context(const struct ratbag_interface *interface,
342  void *userdata);
343 
357 void
358 ratbag_set_user_data(struct ratbag *ratbag, void *userdata);
359 
369 void*
370 ratbag_get_user_data(const struct ratbag *ratbag);
371 
381 struct ratbag *
382 ratbag_ref(struct ratbag *ratbag);
383 
394 struct ratbag *
395 ratbag_unref(struct ratbag *ratbag);
396 
414 ratbag_device_new_from_udev_device(struct ratbag *ratbag,
415  struct udev_device *udev_device,
416  struct ratbag_device **device);
417 
427 struct ratbag_device *
428 ratbag_device_ref(struct ratbag_device *device);
429 
440 struct ratbag_device *
441 ratbag_device_unref(struct ratbag_device *device);
442 
454 void
455 ratbag_device_set_user_data(struct ratbag_device *device, void *userdata);
456 
466 void*
467 ratbag_device_get_user_data(const struct ratbag_device *device);
468 
475 const char *
476 ratbag_device_get_name(const struct ratbag_device* device);
477 
485 const char *
486 ratbag_device_get_svg_name(const struct ratbag_device* device);
487 
510 
516 
521 
526 
534 
551 
560 };
561 
574 int
575 ratbag_device_has_capability(const struct ratbag_device *device,
576  enum ratbag_device_capability cap);
577 
588 ratbag_device_commit(struct ratbag_device *device);
589 
605 unsigned int
607 
616 unsigned int
618 
627 unsigned int
629 
639 struct ratbag_profile *
640 ratbag_profile_ref(struct ratbag_profile *profile);
641 
652 struct ratbag_profile *
653 ratbag_profile_unref(struct ratbag_profile *profile);
654 
667 ratbag_profile_set_enabled(struct ratbag_profile *profile, bool enabled);
668 
680 bool
681 ratbag_profile_is_enabled(const struct ratbag_profile *profile);
682 
694 void
695 ratbag_profile_set_user_data(struct ratbag_profile *profile, void *userdata);
696 
706 void*
707 ratbag_profile_get_user_data(const struct ratbag_profile *profile);
708 
727 struct ratbag_profile *
728 ratbag_device_get_profile(struct ratbag_device *device, unsigned int index);
729 
741 int
743 
755 
771 unsigned int
773 
796 struct ratbag_resolution *
797 ratbag_profile_get_resolution(struct ratbag_profile *profile, unsigned int idx);
798 
808 struct ratbag_resolution *
809 ratbag_resolution_ref(struct ratbag_resolution *resolution);
810 
821 struct ratbag_resolution *
822 ratbag_resolution_unref(struct ratbag_resolution *resolution);
823 
835 void
836 ratbag_resolution_set_user_data(struct ratbag_resolution *resolution, void *userdata);
837 
847 void*
848 ratbag_resolution_get_user_data(const struct ratbag_resolution *resolution);
849 
857 
862 };
863 
871 int
874 
895  unsigned int dpi);
896 
921  unsigned int x, unsigned int y);
922 
937 int
938 ratbag_resolution_get_dpi(struct ratbag_resolution *resolution);
939 
954 int
956 
971 int
973 
996  unsigned int hz);
997 
1009 int
1011 
1025 enum ratbag_error_code
1027 
1041 int
1042 ratbag_resolution_is_active(const struct ratbag_resolution *resolution);
1043 
1059 enum ratbag_error_code
1061 
1076 int
1077 ratbag_resolution_is_default(const struct ratbag_resolution *resolution);
1078 
1097 struct ratbag_button*
1098 ratbag_profile_get_button(struct ratbag_profile *profile, unsigned int index);
1099 
1111 void
1112 ratbag_button_set_user_data(struct ratbag_button *button, void *userdata);
1113 
1123 void*
1124 ratbag_button_get_user_data(const struct ratbag_button *button);
1125 
1133 
1134  /* mouse buttons */
1155 
1156  /* DPI switch */
1160 
1161  /* Profile */
1165 };
1166 
1183 enum ratbag_button_type
1184 ratbag_button_get_type(struct ratbag_button *button);
1185 
1217 };
1218 
1226 
1244 int
1246  enum ratbag_button_action_type action_type);
1247 
1257 
1259 
1260  /* Wheel mappings */
1266 
1267  /* DPI switch */
1274 
1275  /* Profile */
1280 
1281  /* second mode for buttons */
1283 
1284  /* battery level */
1286 
1287 };
1288 
1308 unsigned int
1309 ratbag_button_get_button(struct ratbag_button *button);
1310 
1323 enum ratbag_error_code
1325  unsigned int btn);
1326 
1342 
1359 };
1369 };
1370 
1387 struct ratbag_led *
1388 ratbag_profile_get_led(struct ratbag_profile *profile, unsigned int index);
1399 enum ratbag_led_type
1400 ratbag_led_get_type(struct ratbag_led *led);
1411 enum ratbag_led_mode
1412 ratbag_led_get_mode(struct ratbag_led *led);
1423 struct ratbag_color
1424 ratbag_led_get_color(struct ratbag_led *led);
1435 int
1447 unsigned int
1449 
1461 enum ratbag_error_code
1462 ratbag_led_set_mode(struct ratbag_led *led, enum ratbag_led_mode mode);
1463 
1476 enum ratbag_error_code
1477 ratbag_led_set_color(struct ratbag_led *led, struct ratbag_color color);
1478 
1491 enum ratbag_error_code
1492 ratbag_led_set_effect_rate(struct ratbag_led *led, unsigned int rate);
1493 
1506 enum ratbag_error_code
1507 ratbag_led_set_brightness(struct ratbag_led *led, unsigned int brightness);
1508 
1521 enum ratbag_error_code
1523  enum ratbag_button_action_special action);
1524 
1545 unsigned int
1546 ratbag_button_get_key(struct ratbag_button *button,
1547  unsigned int *modifiers,
1548  size_t *sz);
1549 
1565 enum ratbag_error_code
1566 ratbag_button_set_key(struct ratbag_button *button,
1567  unsigned int key,
1568  unsigned int *modifiers,
1569  size_t sz);
1570 
1579 enum ratbag_error_code
1580 ratbag_button_disable(struct ratbag_button *button);
1581 
1593 };
1594 
1602 const char *
1603 ratbag_button_macro_get_name(struct ratbag_button_macro *macro);
1604 
1612 unsigned int
1613 ratbag_button_macro_get_num_events(struct ratbag_button_macro *macro);
1614 
1630 ratbag_button_macro_get_event_type(struct ratbag_button_macro *macro,
1631  unsigned int index);
1632 
1649 int
1650 ratbag_button_macro_get_event_key(struct ratbag_button_macro*macro,
1651  unsigned int index);
1652 
1668 int
1669 ratbag_button_macro_get_event_timeout(struct ratbag_button_macro *macro,
1670  unsigned int index);
1671 
1688 enum ratbag_error_code
1689 ratbag_button_set_macro(struct ratbag_button *button,
1690  const struct ratbag_button_macro *macro);
1691 
1708 struct ratbag_button_macro *
1709 ratbag_button_macro_new(const char *name);
1710 
1724 struct ratbag_button_macro *
1725 ratbag_button_get_macro(struct ratbag_button *button);
1726 
1736 enum ratbag_error_code
1737 ratbag_button_macro_set_event(struct ratbag_button_macro *macro,
1738  unsigned int index,
1739  enum ratbag_macro_event_type type,
1740  unsigned int data);
1741 
1751 struct ratbag_button_macro *
1752 ratbag_button_macro_ref(struct ratbag_button_macro *macro);
1753 
1764 struct ratbag_button_macro *
1765 ratbag_button_macro_unref(struct ratbag_button_macro *macro);
1766 
1776 struct ratbag_button *
1777 ratbag_button_ref(struct ratbag_button *button);
1778 
1789 struct ratbag_button *
1790 ratbag_button_unref(struct ratbag_button *button);
1791 
1801 struct ratbag_led *
1802 ratbag_led_ref(struct ratbag_led *led);
1803 
1814 struct ratbag_led *
1815 ratbag_led_unref(struct ratbag_led *led);
1816 
1817 #ifdef __cplusplus
1818 }
1819 #endif
Definition: libratbag.h:1141
struct ratbag_device * ratbag_device_ref(struct ratbag_device *device)
Add a reference to the device.
ratbag_macro_event_type
Macro event types describing the event.
Definition: libratbag.h:1587
enum ratbag_error_code ratbag_resolution_set_report_rate(struct ratbag_resolution *resolution, unsigned int hz)
Set the report rate in Hz for the resolution mode.
A button to toggle the wheel from free-spinning to click-based.
Definition: libratbag.h:1150
enum ratbag_error_code ratbag_device_commit(struct ratbag_device *device)
Write any changes to the device.
enum ratbag_button_action_type ratbag_button_get_action_type(struct ratbag_button *button)
Definition: libratbag.h:169
struct ratbag_profile * ratbag_profile_ref(struct ratbag_profile *profile)
Add a reference to the profile.
int ratbag_resolution_get_dpi(struct ratbag_resolution *resolution)
Get the resolution in DPI for the resolution mode.
Definition: libratbag.h:1136
unsigned int ratbag_device_get_num_leds(struct ratbag_device *device)
Return the number of LEDs available on this device.
int ratbag_device_has_capability(const struct ratbag_device *device, enum ratbag_device_capability cap)
Note that a device may not support any of the capabilities but still initialize fine otherwise...
enum ratbag_error_code ratbag_button_set_special(struct ratbag_button *button, enum ratbag_button_action_special action)
This function sets the special function assigned to this button.
Definition: libratbag.h:1152
Definition: libratbag.h:1282
const char * ratbag_button_macro_get_name(struct ratbag_button_macro *macro)
The device supports assigning LED colors and effects.
Definition: libratbag.h:520
ratbag_resolution_capability
Definition: libratbag.h:850
This button is not set up for a special action.
Definition: libratbag.h:1255
int ratbag_resolution_is_active(const struct ratbag_resolution *resolution)
Check if the resolution mode is the currently active one.
Definition: libratbag.h:1592
int ratbag_button_macro_get_event_timeout(struct ratbag_button_macro *macro, unsigned int index)
If the event stored at the given index is RATBAG_MACRO_EVENT_WAIT, this function returns the timeout ...
int ratbag_resolution_get_dpi_x(struct ratbag_resolution *resolution)
Get the x resolution in DPI for the resolution mode.
unsigned int ratbag_button_macro_get_num_events(struct ratbag_button_macro *macro)
ratbag_led_mode
RATBAG_LED_OFF - led is now off, RATBAG_LED_ON - led is on with static color, RATBAG_LED_CYCLE - led ...
Definition: libratbag.h:1354
enum ratbag_button_type ratbag_button_get_type(struct ratbag_button *button)
Return the type of the physical button.
int ratbag_button_has_action_type(struct ratbag_button *button, enum ratbag_button_action_type action_type)
Check if a button supports a specific action type.
Represents a led on the device.
unsigned int ratbag_button_get_button(struct ratbag_button *button)
If a button&#39;s action is RATBAG_BUTTON_ACTION_TYPE_BUTTON, this function returns the logical button nu...
enum ratbag_error_code ratbag_button_disable(struct ratbag_button *button)
enum ratbag_log_priority ratbag_log_get_priority(const struct ratbag *ratbag)
Get the context&#39;s log priority.
Raw protocol messages.
Definition: libratbag.h:216
Definition: libratbag.h:1144
int ratbag_led_get_effect_rate(struct ratbag_led *led)
This function returns the LED effect rate.
The device supports user-defined key or button sequences.
Definition: libratbag.h:525
The device can switch between hardware profiles.
Definition: libratbag.h:509
The device has the capability to disable and enable profiles.
Definition: libratbag.h:559
Definition: libratbag.h:1262
Definition: libratbag.h:1143
unsigned int red
Definition: libratbag.h:139
An error occured on the device.
Definition: libratbag.h:175
enum ratbag_led_type ratbag_led_get_type(struct ratbag_led *led)
This function returns the type for ratbag_led.
enum ratbag_error_code ratbag_button_macro_set_event(struct ratbag_button_macro *macro, unsigned int index, enum ratbag_macro_event_type type, unsigned int data)
Sets the macro&#39;s event at the given index to the given type with the key code or timeout given...
The resolution can be set for x and y separately.
Definition: libratbag.h:861
enum ratbag_macro_event_type ratbag_button_macro_get_event_type(struct ratbag_button_macro *macro, unsigned int index)
Returns the macro event type configured for the event at the given index.
enum ratbag_error_code ratbag_led_set_color(struct ratbag_led *led, struct ratbag_color color)
If the LED&#39;s mode is RATBAG_LED_ON or RATBAG_LED_BREATHING then this function sets the LED color...
int ratbag_resolution_get_report_rate(struct ratbag_resolution *resolution)
Get the report rate in Hz for the resolution mode.
Definition: libratbag.h:1588
The device can change resolution, either software-controlled or by a hardware button.
Definition: libratbag.h:501
bool ratbag_profile_is_enabled(const struct ratbag_profile *profile)
Check whether the ratbag profile is enabled or not.
struct ratbag_resolution * ratbag_profile_get_resolution(struct ratbag_profile *profile, unsigned int idx)
Return the resolution in DPI and the report rate in Hz for the resolution mode identified by the give...
enum ratbag_error_code ratbag_profile_set_active(struct ratbag_profile *profile)
Make the given profile the currently active profile.
Button action is unknown.
Definition: libratbag.h:1195
Definition: libratbag.h:1263
Definition: libratbag.h:1366
enum ratbag_error_code ratbag_resolution_set_default(struct ratbag_resolution *resolution)
Set the default resolution mode for the associated profile.
int ratbag_profile_is_active(struct ratbag_profile *profile)
Check if the given profile is the currently active one.
void ratbag_profile_set_user_data(struct ratbag_profile *profile, void *userdata)
Set caller-specific data associated with this profile.
ratbag_device_capability
Definition: libratbag.h:491
Definition: libratbag.h:1140
const char * ratbag_device_get_svg_name(const struct ratbag_device *device)
Definition: libratbag.h:1358
void * ratbag_profile_get_user_data(const struct ratbag_profile *profile)
Get the caller-specific data associated with this profile, if any.
Represents a resolution setting on the device.
Definition: libratbag.h:116
enum ratbag_error_code ratbag_resolution_set_dpi_xy(struct ratbag_resolution *resolution, unsigned int x, unsigned int y)
Set the x and y resolution in DPI for the resolution mode.
enum ratbag_error_code ratbag_profile_set_enabled(struct ratbag_profile *profile, bool enabled)
Enable/disable the ratbag profile.
Definition: libratbag.h:218
enum ratbag_error_code ratbag_led_set_mode(struct ratbag_led *led, enum ratbag_led_mode mode)
this function sets the LED mode.
Definition: libratbag.h:1151
ratbag_button_action_special
Definition: libratbag.h:1251
struct ratbag_button * ratbag_button_unref(struct ratbag_button *button)
Dereference the ratbag button.
struct ratbag_profile * ratbag_device_get_profile(struct ratbag_device *device, unsigned int index)
This function creates if necessary and returns a profile for the given index.
struct ratbag_led * ratbag_led_ref(struct ratbag_led *led)
Add a reference to the led.
struct ratbag_resolution * ratbag_resolution_ref(struct ratbag_resolution *resolution)
Add a reference to the resolution.
Definition: libratbag.h:1158
Definition: libratbag.h:1163
A low-level system error has occured, e.g.
Definition: libratbag.h:195
unsigned int ratbag_profile_get_num_resolutions(struct ratbag_profile *profile)
Get the number of ratbag_resolution available in this profile.
void ratbag_resolution_set_user_data(struct ratbag_resolution *resolution, void *userdata)
Set caller-specific data associated with this resolution.
Definition: libratbag.h:219
void ratbag_device_set_user_data(struct ratbag_device *device, void *userdata)
Set caller-specific data associated with this device.
unsigned int ratbag_button_get_key(struct ratbag_button *button, unsigned int *modifiers, size_t *sz)
If a button&#39;s action is RATBAG_BUTTON_ACTION_TYPE_KEY, this function returns the key or button config...
void * ratbag_device_get_user_data(const struct ratbag_device *device)
Get the caller-specific data associated with this device, if any.
enum ratbag_button_action_special ratbag_button_get_special(struct ratbag_button *button)
If a button&#39;s action is RATBAG_BUTTON_ACTION_TYPE_SPECIAL, this function returns the special function...
struct ratbag_button_macro * ratbag_button_macro_ref(struct ratbag_button_macro *macro)
Add a reference to the macro.
void ratbag_log_set_handler(struct ratbag *ratbag, ratbag_log_handler log_handler)
Set the context&#39;s log handler.
ratbag_log_priority
Log priority for internal logging messages.
Definition: libratbag.h:211
struct ratbag_button * ratbag_button_ref(struct ratbag_button *button)
Add a reference to the button.
The report rate can be set per resolution mode.
Definition: libratbag.h:856
Definition: libratbag.h:1142
enum ratbag_error_code ratbag_button_set_key(struct ratbag_button *button, unsigned int key, unsigned int *modifiers, size_t sz)
Definition: libratbag.h:1589
unsigned int ratbag_device_get_num_profiles(struct ratbag_device *device)
Return the number of profiles supported by this device.
Definition: libratbag.h:1264
enum ratbag_led_mode ratbag_led_get_mode(struct ratbag_led *led)
This function returns the mode for ratbag_led.
struct ratbag * ratbag_create_context(const struct ratbag_interface *interface, void *userdata)
Create a new ratbag context.
Button sends a key or key + modifier combination.
Definition: libratbag.h:1212
void ratbag_set_user_data(struct ratbag *ratbag, void *userdata)
Set caller-specific data associated with this context.
struct ratbag_resolution * ratbag_resolution_unref(struct ratbag_resolution *resolution)
Dereference the ratbag resolution.
struct ratbag_button_macro * ratbag_button_macro_new(const char *name)
Initialize a new button macro.
Implementation bug, either in libratbag or in the caller.
Definition: libratbag.h:203
Button is disabled.
Definition: libratbag.h:1199
Definition: libratbag.h:1258
Definition: libratbag.h:1159
The device can have one profile assigned as a default profile.
Definition: libratbag.h:533
enum ratbag_error_code ratbag_resolution_set_dpi(struct ratbag_resolution *resolution, unsigned int dpi)
Set the resolution in DPI for the resolution mode.
void(*) voi ratbag_log_set_priority)(struct ratbag *ratbag, enum ratbag_log_priority priority)
Set the log priority for the ratbag context.
Definition: libratbag.h:257
Definition: libratbag.h:1357
A handle to a profile context on devices with the RATBAG_DEVICE_CAP_SWITCHABLE_PROFILE capability...
Definition: libratbag.h:94
int ratbag_resolution_has_capability(struct ratbag_resolution *resolution, enum ratbag_resolution_capability cap)
Check if a resolution has a specific capability.
struct ratbag_color ratbag_led_get_color(struct ratbag_led *led)
This function returns the led color.
Definition: libratbag.h:1138
Definition: libratbag.h:1137
libratbag does not open file descriptors to devices directly, instead open_restricted() and close_res...
Definition: libratbag.h:307
void ratbag_button_set_user_data(struct ratbag_button *button, void *userdata)
Set caller-specific data associated with this button.
The device has the capability to query the current hardware configuration.
Definition: libratbag.h:550
void * ratbag_resolution_get_user_data(const struct ratbag_resolution *resolution)
Get the caller-specific data associated with this resolution, if any.
Definition: libratbag.h:1139
Button triggers a mouse-specific special function.
Definition: libratbag.h:1208
enum ratbag_error_code ratbag_led_set_brightness(struct ratbag_led *led, unsigned int brightness)
If the LED&#39;s mode is RATBAG_LED_CYCLE or RATBAG_LED_BREATHING then this function sets the LED brightn...
Definition: libratbag.h:1157
struct ratbag_device * ratbag_device_unref(struct ratbag_device *device)
Dereference the ratbag device.
The device supports assigning button numbers, key events or key + modifier combinations.
Definition: libratbag.h:515
int ratbag_resolution_is_default(const struct ratbag_resolution *resolution)
Check if the resolution mode is the default one in this profile.
Definition: libratbag.h:492
unsigned int green
Definition: libratbag.h:140
Definition: libratbag.h:1368
Definition: libratbag.h:1261
enum ratbag_error_code ratbag_resolution_set_active(struct ratbag_resolution *resolution)
Activate the given resolution mode.
ratbag_button_action_type
The type assigned to a button.
Definition: libratbag.h:1191
Definition: libratbag.h:1145
struct ratbag_led * ratbag_profile_get_led(struct ratbag_profile *profile, unsigned int index)
Return a reference to the LED given by the index.
int ratbag_button_macro_get_event_key(struct ratbag_button_macro *macro, unsigned int index)
If the event stored at the given index is RATBAG_MACRO_EVENT_KEY_PRESSED or RATBAG_MACRO_EVENT_KEY_RE...
Definition: libratbag.h:1146
void * ratbag_button_get_user_data(const struct ratbag_button *button)
Get the caller-specific data associated with this button, if any.
Definition: libratbag.h:1154
Definition: libratbag.h:1279
struct ratbag * ratbag_unref(struct ratbag *ratbag)
Dereference the ratbag context.
Definition: libratbag.h:1590
ratbag_led_type
LED types, usually based on their physical location.
Definition: libratbag.h:1365
enum ratbag_error_code ratbag_button_set_button(struct ratbag_button *button, unsigned int btn)
See ratbag_button_get_button() for a description of the button number.
Definition: libratbag.h:1132
Definition: libratbag.h:1270
struct ratbag_led * ratbag_led_unref(struct ratbag_led *led)
Dereference the ratbag led.
const char * ratbag_device_get_name(const struct ratbag_device *device)
struct ratbag_button * ratbag_profile_get_button(struct ratbag_profile *profile, unsigned int index)
Return a reference to the button given by the index.
#define LIBRATBAG_ATTRIBUTE_PRINTF(_format, _args)
Definition: libratbag.h:35
A ratbag context represents one single device.
Definition: libratbag.h:85
Definition: libratbag.h:1164
enum ratbag_error_code ratbag_button_set_macro(struct ratbag_button *button, const struct ratbag_button_macro *macro)
Sets the button&#39;s action to RATBAG_BUTTON_ACTION_TYPE_MACRO and assigns the given macro to this butto...
Definition: libratbag.h:1591
unsigned int ratbag_device_get_num_buttons(struct ratbag_device *device)
Return the number of buttons available on this device.
enum ratbag_error_code ratbag_led_set_effect_rate(struct ratbag_led *led, unsigned int rate)
If the LED&#39;s mode is RATBAG_LED_CYCLE or RATBAG_LED_BREATHING then this function sets the LED rate in...
int ratbag_resolution_get_dpi_y(struct ratbag_resolution *resolution)
Get the y resolution in DPI for the resolution mode.
Definition: libratbag.h:1153
Definition: libratbag.h:1356
struct ratbag * ratbag_ref(struct ratbag *ratbag)
Add a reference to the context.
struct ratbag_button_macro * ratbag_button_macro_unref(struct ratbag_button_macro *macro)
Dereference the ratbag button macro.
struct ratbag_profile * ratbag_profile_unref(struct ratbag_profile *profile)
Dereference the ratbag profile.
Insufficient capabilities.
Definition: libratbag.h:181
Definition: libratbag.h:1135
unsigned int ratbag_led_get_brightness(struct ratbag_led *led)
This function returns the LED brightness.
A handle for accessing ratbag contexts.
ratbag_button_type
Button types describing the physical button.
Definition: libratbag.h:1131
Definition: libratbag.h:1162
Invalid value or value range.
Definition: libratbag.h:187
void * ratbag_get_user_data(const struct ratbag *ratbag)
Get the caller-specific data associated with this context, if any.
unsigned int blue
Definition: libratbag.h:141
Definition: libratbag.h:1285
Button sends numeric button events.
Definition: libratbag.h:1203
Definition: libratbag.h:1278
ratbag_error_code
Error codes used by libratbag.
Definition: libratbag.h:168
Represents a button on the device.
Definition: libratbag.h:105
void(* ratbag_log_handler)(struct ratbag *ratbag, enum ratbag_log_priority priority, const char *format, va_list args) LIBRATBAG_ATTRIBUTE_PRINTF(3
Log handler type for custom logging.
Definition: libratbag.h:236
Button sends a user-defined key or button sequence.
Definition: libratbag.h:1216
struct ratbag_button_macro * ratbag_button_get_macro(struct ratbag_button *button)
If a button&#39;s action is RATBAG_BUTTON_ACTION_TYPE_MACRO, this function returns the current button mac...
Definition: libratbag.h:1367
Definition: libratbag.h:1355
Represents LED color in RGB format.
Definition: libratbag.h:138
Definition: libratbag.h:1256
enum ratbag_error_code ratbag_device_new_from_udev_device(struct ratbag *ratbag, struct udev_device *udev_device, struct ratbag_device **device)
Create a new ratbag context from the given udev device.
Definition: libratbag.h:217