libratbag

Peter Hutterer & Benjamin Tissoires

2015-09-16

libratbag

Where it all started

  • Install Windows to configure it...
  • ???
  • Profit facepalm

Implementation

Kernel or User-space?

Implementation

http://github.com/libratbag/libratbag

What happens when you take a kernel guy and a user-space guy to make a lib?

  • you get something written in C
  • your code base looks like half kernel driver, half user-space library

Implementation

Two parts: external API and HW driver backend

Implementation

struct ratbag *ctx = ratbag_new(...);
struct ratbag_device *device = ratbag_device_new_from_udev(ctx, udev_device);
struct ratbag_profile *p0 = ratbag_device_get_profile(device, 0);
struct ratbag_resolution *r2 = ratbag_profile_get_resolution(p0, 2);
struct ratbag_button *b1 = ratbag_profile_get_button(p0, 1);

int dpi = ratbag_resolution_get_dpi(r2);
if (ratbag_button_get_action_type(b1) == RATBAG_ACTION_TYPE_KEY)
   ...



disclaimer: API unstable (v0.0.1)

Helper Tools (as of 2015-09-14)

$ ratbag-command list
$ ratbag-command info /dev/input/event5
$ ratbag-command dpi get /dev/input/event5
$ ratbag-command dpi set 200 /dev/input/event5
$ ratbag-command profile 3 resolution 2 dpi set 200 /dev/input/event5
$ ratbag-command button 2 action set macro \
                 +KEY_ENTER t50 -KEY_ENTER /dev/input/event5



disclaimer: API unstable (v0.0.1)

Demo

prepare to be amazed.

we mean it

totally

Demo

Demo

full disclosure: GUI sitting on a branch, not in master

Future

disclaimer: no animals were harmed during the making of this presentation