The hwdb was a quick and easy way to add entries for new devices but we need
more and more info about the various types of devices. It's better to move
this to a proper database.
Side-effect: this also gives us an easy way to point to the list of devices
supported and makes checking for e.g. missing svgs easier.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We have autodetection for Logitech, but let's always specify the driver for
devices we have in the hwdb.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
If we couldn't find the name on the bus or the ratbagd process already
terminated, return None and fail.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
I originally intended to have a dynamic use of argparse to generate
the commands, but it turned out to be a nightmare.
Just go down the tree of arguments and format the help properly.
Fixes#288
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We shouldn't try to access input_string[0] if len(input_string) is null.
Meaning a condition in the break in the while loop could be checked
earlier (or later).
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
ns is never reset, so once it has a subparser, it'll keep it, so the try
catch is just too much
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Calling "ratbagctl profile -t" resulted in an infinite loop because it
tried again and again to parse "-t" in the profile
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Too easy to trigger ("ratbagctl.devel profile" is just enough), so we
probably better have a proper usage call here.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
.parse did not consumed the input_string, it only appends the given
parsing to the parent. Rename the function and kill the debug output
in nested calls as this was misleading while re-reading the code.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The help option (or verbose FWIW) were not global which makes some random
behavior when using -h at different places for the input string.
Retrieve those options once and remove them from the list of things to
process.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
"sudo ./build/ratbagctl.devel profile 2 4" returns an exception with cmd
being unknown.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Keeps the ratbagd daemon running until a signal is received. This is helpful
for using an external client (like piper) to run against the ratbagd.devel
instance. And to make that even easier, print the RATBAGCTL_DEVEL environment
variable for use with ratbagd.py. In the future, this should probably be a
more generic name.
The integration is a bit odd because we need to add --keepalive to the actual
parser, but we recreate that on every parse() call. So we set a flag on the
parent object and check for that during parser creation.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Don't automatically handle the help output - call print_help() on the parser
manually.
It's unclear why this doesn't just get called correctly, but at least this
fixes the immediate issue. The subcommand help is still pretty terrible
though.
https://github.com/libratbag/libratbag/issues/288
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This allows clients to respond to changes in the default resolution. It's
not the cleanest approach, but it works. To clean it up, we could cache
the changed resolutions and make sure to only emit the signal on those,
just as the FIXME already notes.
References https://github.com/libratbag/piper/pull/36.
This allows clients to respond to changes in the active resolution. It's
not the cleanest approach, but it works. To clean it up, we could cache
the changed resolutions and make sure to only emit the signal on those,
just as the FIXME already notes.
References https://github.com/libratbag/piper/pull/132.
Our DBus interface is the only API now and libratbag is just the internal
library. Let's not build doxygen for it, there's no need.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We do not really care using the actual ratbagctl command, we just want
to run it. So we can simply call out the python functions directly
and live happily ever after.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We want to share as much as possible between ratbagctl.devel and
ratbagctl.test, so better have a separate file that knows how to
properly spawn the dbus daemon and terminate it.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
On CircleCI, the builds fail one over four times because we are launching
the testsuite while ratbagd.devel is still not ready.
Do a basic polling after we launch the daemon so that we are aware when
the ratbagd daemon is ready.
A proper solution would be to use "new" for querying the proxy, not
"new_sync". However, this would require us to have a GTK mainloop
running, so it's a PITA.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Configuring with 'meson builddir' would fail with:
Program build/ratbagctl.test found: NO
Meson encountered an error in file meson.build, line 512, column 0:
Program "build/ratbagctl.test" not found or not executable
is it a hack or the correct way?
triggered by: sudo ./build/ratbagctl.devel led 0 set color ffffff
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This code isn't actually hit because we don't handle signals correctly, but
once we do, ratbagd_free() will assert because the devices never get removed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
No need to have two copies here, simply have the dict and then flip it so it
works with the strings as keys too.
The slightly odd list comprehension is because we can't add to a dictionary
while iterating through it, so we need to get everything out first.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
few minor issues which were unseen because driver-test was missing to set
the special key mappings
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>