commit b3237fd0 ("lur: change new_from_hidraw to return an errno") broke
the API, so we need to bump the version too.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
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>
On the G9 the response to a 0x63 is a short report. The G9 does
not have individual resolutions for X and Y and thus only needs
to report a single value.
The set version of 0x63 should probably also be updated. However,
while my testing of such a change worked better than with long
reports there are still strange side effects of setting resolution,
like turning off all the LED's. LGS also seems to do a full profile
read/write instead of using 0x63 when changing the resolution.
The G303 shares the same profile than the G402/G502. The only difference
is an extension at the end of the profile, but they are compatible.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Mostly inherited from our zalloc() implementation. But really,
if you have no memory left, should you be trying to talk to receivers?
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
There are 10 buttons defined in the profile but only 9 physical
buttons. LGS also only allows to configure 9 of them. Button 5
is the "dead" button in the list.