Commit Graph

1245 Commits

Author SHA1 Message Date
Peter Hutterer
340e5b7d86 Switch to a .ini-file based device database
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>
2017-08-28 17:50:20 +02:00
Peter Hutterer
be624fe943 Move dpi range parsing to a helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-28 17:50:20 +02:00
Peter Hutterer
cb102e115c Add xasprintf
Like asprintf, but leaves strp as NULL on failure

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-28 17:50:20 +02:00
Clément Vuchener
952eb1cf0e Add Logitech G900 SVG for gnome theme 2017-08-28 12:16:49 +02:00
Peter Hutterer
709ffa37b2 hwdb: add two missing driver assignments
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>
2017-08-28 09:18:00 +02:00
Peter Hutterer
f4f206f3e5 Add missing config.h includes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-28 09:18:00 +02:00
Peter Hutterer
7036428066 meson.build: libratbag 0.9.900
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
v0.9.900
2017-08-25 13:48:39 +10:00
Peter Hutterer
18239f1aee DBusInterface: add missing 'Methods' header
And consistently use ':' after Properties/Methods headers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-24 09:25:29 +10:00
Benjamin Tissoires
fe8fde79f6 tools: ratbagctl: fix len(array) > 0 check
"for python, instead of checking len > 0 we're supposed to use
if input_string"

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-08-23 09:28:07 +02:00
Peter Hutterer
9f805a4ebe tools: don't return a ratbagd_process if things failed
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>
2017-08-23 08:05:17 +02:00
Peter Hutterer
572f00cf2a Add GNOME svg for Roccat Kone XTD 2017-08-23 08:04:12 +02:00
Benjamin Tissoires
330b4641ad tools: ratbagctl: have a full description of the commands in the usage
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>
2017-08-23 14:25:35 +10:00
Benjamin Tissoires
c1c8b1eda2 tools: ratbagctl: fixes for parsing arguments
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>
2017-08-23 14:25:35 +10:00
Benjamin Tissoires
aa251448d3 tools: rabtagctl.devel: only output the dbus name when using keepalive
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-08-23 14:25:35 +10:00
Benjamin Tissoires
e27b1eb99f tools: ratbagctl: remove useless try/catch
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>
2017-08-23 14:25:35 +10:00
Benjamin Tissoires
faaf93b194 tools: ratbagctl: kill an infinite loop in parsing
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>
2017-08-23 14:25:35 +10:00
Benjamin Tissoires
58957667e1 tools: ratbagctl: shout the usage if the parsing is incomplete
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>
2017-08-23 14:25:35 +10:00
Benjamin Tissoires
0db7ba0c85 tools: ratbagctl: rename .parse into add_to_subparsers
.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>
2017-08-23 14:25:35 +10:00
Benjamin Tissoires
c42c15ad0e tools: ratbagctl: have the global options global
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>
2017-08-23 14:25:35 +10:00
Benjamin Tissoires
fc50e38ae2 tools: ratbagctl.devel: honor --help too
Now that ratbagctl properly shows the help, the devel version should
too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-08-23 14:25:35 +10:00
Benjamin Tissoires
b2d29a0285 tools: ratbagctl.devel: fix exception if the given arguments are wrong
"sudo ./build/ratbagctl.devel profile 2 4" returns an exception with cmd
being unknown.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-08-23 14:25:35 +10:00
Peter Hutterer
87ecd6e252 tools: add --keepalive option to ratbagd devel
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>
2017-08-22 08:17:21 +02:00
Peter Hutterer
2b49550b9b tools: ratbagctl: skip on AttributeError exception handling for --help
We default to False anyway, so it's guaranteed to be an attribute on the
parser

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-22 08:17:21 +02:00
Jente Hidskes
6ddba76c93 RatbagdButton: make mapping properties writable
This brings RatbagdButton in line with the other Ratbagd* objects, and
more importantly solves https://github.com/libratbag/piper/issues/140.
2017-08-22 10:22:51 +10:00
Peter Hutterer
d9e7298aee ratbagctl: improve the top-level --help output
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>
2017-08-21 11:06:32 +02:00
Clément Vuchener
49b7029506 hidpp: Fix error string array size
Extend error strings array so reading 0xFF as an error code would not overflow.
2017-08-18 04:26:50 +10:00
Clément Vuchener
468787601e hidpp: Distinguish 1.0 and 2.0 error codes 2017-08-18 04:26:50 +10:00
Jente Hidskes
804d8f7969 RatbagdResolution: emit properties changed from resolution_set_default
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.
2017-08-17 10:35:09 +10:00
Jente Hidskes
9b53119121 RatbagdResolution: emit properties changed from resolution_set_active
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.
2017-08-17 10:35:09 +10:00
Jente Hidskes
b773ac085b ratbagd.c: unlink before emitting property changed 2017-08-11 11:12:24 +01:00
Peter Hutterer
13419dcbb8 doc: drop documentation
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>
2017-08-02 10:14:23 +01:00
Benjamin Tissoires
c9322fa983 tools: ratbagctl.devel: do not spawn a subprocess to run a python script
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>
2017-08-01 10:31:43 +01:00
Benjamin Tissoires
6cfca9e34b tools: share the devel boiler plate in a separate python file
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>
2017-08-01 10:31:43 +01:00
Jente Hidskes
282398493b ratbagd_button: emit property changed on ActionType when setting mappings 2017-07-31 14:38:24 +01:00
Jente Hidskes
022dc74354 ratbagd_button: emit property changed on Macro 2017-07-31 14:38:24 +01:00
Jente Hidskes
cd6ffca413 ratbagd_button: emit property changed on KeyMapping 2017-07-31 14:38:24 +01:00
Jente Hidskes
b19a6ebcfc DBusInterface: document Macro and SetMacro 2017-07-31 14:38:24 +01:00
Peter Hutterer
811281372b ratbagd: fix return code for SetSpecialMapping (#262)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-30 14:23:25 +02:00
Benjamin Tissoires
c361b8500f test: make sure the dbus daemon is available before starting the test suite
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>
2017-07-29 09:05:43 +01:00
Thomas Hindoe Paaboel Andersen
bcf302904d meson: allow builddir other than 'build'
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
2017-07-29 08:24:21 +01:00
Benjamin Tissoires
e0e4d5062a hidpp20: fix resolution active set/get
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-28 16:19:26 +01:00
Benjamin Tissoires
abd1a04fed tools: ratbagctl: remove useless function
it was used while we were missing implementations, no it's useless.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-28 15:51:26 +01:00
Benjamin Tissoires
ab1d7628f1 tools: ratbagctl: fix 'set' processing when the device is missing
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>
2017-07-28 15:51:26 +01:00
Peter Hutterer
670cf90e11 ratbagd: handle SIGINT for quitting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-28 14:48:10 +01:00
Peter Hutterer
f5210e1902 ratbagd: remove devices before removing the context
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>
2017-07-28 14:48:10 +01:00
Peter Hutterer
5bcafb5bee Reduce to one special->special string mapping dictionary
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>
2017-07-28 14:17:57 +01:00
Jente Hidskes
d8e132f550 tools/ratbagd.py: sync with Piper 2017-07-27 09:37:31 +02:00
Benjamin Tissoires
7e9566b00f Start dbus in the container for being able to run the test suite
We don't need a full systemd service, just dbus-daemon to be started.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-26 18:10:03 +02:00
Benjamin Tissoires
7c313a31fd tools: ratbagctl: fixes for specials
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>
2017-07-26 18:08:39 +02:00
Jente Hidskes
861562e58a ratbagctl: fix typo 2017-07-26 18:07:19 +02:00