Now that we've moved all properties to read-write where required, unleash the
exception again - any UnknownProperty error is now a bug.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This also drops the separate x/y properties and instead just returns a tuple
for "Resolution".
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This is superfluous, it's trivial enough to get the Resolutions property and then
work with that. We're not talking about a huge amount of data anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This is superfluous, it's trivial enough to get the Profiles property and then
work with that. We're not talking about a huge amount of data anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Instead of a GetActiveProfile in the device, make this a property of the
profile. The SetActive method stays around, it's less prone to mis-use than
the property since we cannot allow a caller to go "profile.is_active = False"
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Our device list is so small that having separate signals is a bit pointless,
updating the property should be sufficient.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We have DeviceAdded and DeviceRemoved signals but given the expected number
of devices (less than 2 in most cases) it's easier to just update the Devices
property. The DeviceAdded/Removed signals stick around for now, they will be
removed later.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
set_cached_property merely updates the proxy's own copy, it doesn't do
anything to the remote. Manually call the DBus.Properties.Set interface
to do that.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
When running in a container (CircleCI), dbus may not be available. Throw one
of our errors to be consistent with our behavior when the name owner isn't
available.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
If a driver succeeded but then fails sanity checks, leave the driver set and
let the cleanup code handle the rest. Otherwise, memory allocated by the
driver's probe() function is never released.
Fixes a valgrind memory leak complaint when running tests for invalid devices
(e.g. device_profiles_num_0).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Was using 'b0' as enumerator, copy-paste error from the button code. Switch to
'l0' to make it easier to differentiate in d-feet or other dbus viewers.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Because if we can't strdup a device name or dbus path, we have problems we
can't recover from anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>