Otherwise, as soon as we set an action for a button, we get a nice
invalid free on cleanup.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The previous API was inconsistent and different to the rest of libratbag's
API. Replace with one where a macro is a separate struct, can be initialized
and then written to the device with a set_macro() call. The device copies the
contents, the macro is otherwise unmodified and can be re-used by the client
if need be.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We don't do anything with the return value anyway and we do assign the driver
in this function. Rename it and return a boolean only.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Whenever we do something that may fail, return an enum of possible errors.
This also changes the API for ratbag_device_new_from_udev_device() to return
an error code now too instead of just NULL on failure.
Error numbers start at -1000 to avoid overlap with errnos, error_code() should
be used internally to avoid returning an errno.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Let the caller check that what they're passing in is correct, we don't have to
respond with sensible error codes here.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Designates a device that can be queried for the current configuration. Some
devices lack this ability so we rely on the caller to upload a known
configuration to the device before we can really proceed.
Set by default, devices without that capability should be the exception, not
the norm.
This patch just adds the capability, actual handling for this needs to be
added when we add the first device without this capability.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We don't shut down once activated but that doesn't mean we need to run when
never requested.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Now that we clean up properly, the most common crash should be fixed. Restart
on abort by default so ideally all we need to do is restart piper or whatever
consumes the API.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This configure.ac is largely a copy from systemd so it included things that we
don't use locally.
- we don't use grep, awk or ln
- AC_SYS_LARGEFILE and AC_CANONICAL_HOST are unecessary
- pkg.m4 - if that's missing you don't have pkgconfig installed. stop trying
to build things then :)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>