We are using a custom python script to generate the final ratbagctl
so we can strip out the headers.
Now merging and testing ratbagd.py in piper will be easier than ever.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This reduces the time to run the tests from (now with previous commit) 10s
to a mere 2 seconds.
The --subprocess argument is voluntarily masked from the help message,
because I couldn't figure out how to add it to the unittest parser.
And OTOH, we should not run in subprocess unless debugging...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Otherwise we get build errors when rawhide is broken, like today. Not worth
chasing that moving target.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Any specific capability like 'switchable resolution' requires the basic
'resolution' capabilty to be set.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Instead of copying them into our own struct, just query libratbag when we need
them. This brings the resolution code in line with the button and LED code
which don't do caching either.
Eventually we may want to cache them again to detect changes behind your
back (if libratbag value != our cached value) but for now this reduces the
work ratbagd does.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Now that we have a method which resets the device, use it so we can
rely on the state of the device.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Make sure we keep the defaults as such by duplicating them in
driver-test.c (and mark the input data as const).
Add a dbus method to reset the test device from the caller.
This is much useful when running tests given we have no guarantees on the
ordering.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
In case the udev property is not present, we might want to query
the driver for the SVG name.
This is useful for driver-test as there is no udev device attached to
it, and for hidpp20 as we have auto-detection. We should then be able
to implement this in hidpp20 also so that the name gets automatically
created.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
If the profile is not active, we do not know which resolution is currently
used. Instead of having ratbagd complaining, just set the default as
active.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This shuts up a scan-build warning about a memleak that looked like a false
positive but I couldn't get rid of.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
rc may be a negative errno or a positive hidpp error code. If the latter we
used to continue with a NULL macro pointer, eventually crashing.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Just logging and error and continuing is not enough, we'll eventually
dereference garbage values.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The G403 comes in a (optional) wireless version too; the dongle
that come with it has the product id c539, which is already
handled and also works (by the G900) entry.
Signed-off-by: Christian Kellner <christian@kellner.me>
Two new DBus interfaces:
org.freedesktop.ratbagd1.Manager.Themes -> string array
org.freedesktop.ratbagd1.Device.GetSvg('theme') -> string
The Themes property is a static list of available themes. These are currently
hardcoded in ratbagd, but the theme 'default' is guaranteed to exist.
The GetSvg() method takes a theme name and returns the full file path to the
themed SVG.
Longer-term this will deprecate the Svg and SvgPath properties in the Device
but for now we leave them there.
https://github.com/libratbag/libratbag/issues/204
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
When developing with ratbagd, we need to test against master, not
the system-wide installed daemon.
Allow to name space ratbagd with the creation of a new (not installed)
rabtagd.devel daemon, that is tagged with the git sha of the ratbagd
folder.
Handle this namespace in ratbagctl by looking at an environment variable
RATBAGCTL_DEVEL.
Then provide a python script that launches both rabtagd.devel and
ratbagctl with the correct environment variable set so that they can
talk to each other.
Note that we blindly overwrite the dbus .conf file as nobody else than
developers should have one.
Note: the tagging of ratbagd.devel (like the meson bit) won't run unless
a rebuild is triggered. So we don't necessarily always get the right git
tag. However, touching ratbagctl.in triggers a rebuild, so we should be
OK-ish.
Fixes#206
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
File "./build/ratbagctl", line 713, in main
cmd.func(r, cmd)
UnboundLocalError: local variable 'r' referenced before assignment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* ratbagd: drop the ActiveResolutionChanged signal generation
Leave the signal in the DBus API for now so we can hook it up later, but
stop the signal being generated. Changing the dpi does not change the active
resolution.
https://github.com/libratbag/libratbag/issues/205
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* ratbagd: fix signal dbus interface name
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
ratbagd unconditionally called set_resolution_xy while libratbag expects
the caller to check on the capabilities. Instead of letting this burden
to the dbus user, have ratbagd handle this for us.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The previous approach had no effect, it wasn't doing things correctly.
Add a proper valgrind setup, run with:
mesontest --setup=valgrind
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
[fixed rebase conflict]
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>