Macros can be used for that instead, drivers can adapt them as needed.
Simple key actions will stay here for now, but I plan to completely
replace them with macros eventually.
sd-bus requires an int variable to be passed to SD_BUS_TYPE_BOOLEAN
calls, see man sd_bus_message_read (3).
We have had an issue of the same sort recently in
77fcaf6d28 which was in some freshly new
code, but this time it's something we have been shipping for a while.
A regression I introduced while modifying the disableable resolutions
patch.
It went unnoticed, because it only crashes with optimizations enabled.
In my defense, this exception in D-Bus API that boolean messages must
give address of an int and not a bool is a weird peculiarity...
Implements feature to disable resolutions from a static resolution list.
Updates DBus API and tests accordingly.
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
When a boolean property is optional, the default None value and the False
value both represent a boolean false. So let's rename the property so that the
boolean values cannot be confused, because None and (Disabled == false) have
the same meaning (profile is enabled).
This is an API break.
Fixes#756
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Previously the scheduled task would only have been executed after some
other event woke up the mainloop.
If no such event happens, the task will be delayed significantly.
Fixes#1121
Compilation on clang failed as we would try to jump to
the 'out' label and then jump over the initialization
of a variable with __attribute__((cleanup)).
We move the initaliztion up to make sure it happens before
the goto.
When no device is present, starting ratbagd even with --verbose prints exactly
nothing. Let's be more verbose here to give the user an indication that
something's happening. The user wants everything, is probably willing to
accept anything but in the end all we can say is that we have nothing.
Related to #862
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
While the DBus API is still in flux, things can break at any time.
Keeping piper and libratbag in version-step works terribly, doubly so where
piper is flatpaked but ratbagd comes from some repo somewhere. We can't check
at build-time, we can't run ratbagd --version at runtime.
so let's add a version field for now and drop it if we ever get to stable.
Meanwhile, ratbagd.py will throw an exception if the expected version doesn't
match exactly.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Force the tests to load a test device with JSON that matches their
expectations instead of having a magic device pre-setup where the tests have
to know what the values are.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
sd-bus encodes underscores as _5f which looks like memory corruption. Let's
skip them, they don't add value anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The sequence triggered by the ratbagctl.test suite is:
- DBus call Commit()
- ratbagd schedules the callback as idle func
- DBus call ResetTestDevice()
- ratbagd cleans up the test device
- callback is called on next idle
- boom! the device is already freed
To avoid this, we need to take a ref of the device while it's being scheduled
for the commit handling. But that blocks the object paths for new test devices
because the test device name is encoded in those paths (like "hidraw" for real
devices) and it doesn't change. So let's add a count to the test device name
to make sure the new device doesn't re-use the old device's paths.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Don't rely on some other tool to install the policy file, let's just do this
in ratbagd.devel directly so it's immediately executable.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Where a profile name is not UTF8 compatible, let's try to convert it from
latin-1. If that fails, we just escape anything that's not ascii and move on.
Fixes#617
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Instead of multiple entry points for different values, make the button mapping
a single entry point that takes the mapping type and a variant for the value.
The ratbagd.py bindings are basically left as-is.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
No longer needed now that the ReportRate is in the profile
(bf127d4c68) and the separate
x/y resolution capability is implied by the Resolution value
(8e9dd6f392)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>