Commit Graph

1147 Commits

Author SHA1 Message Date
Peter Hutterer
760c3f3ff9 tools: ratbagctl: Fix typo in comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 10:32:41 +02:00
Peter Hutterer
8aaa6894df tools: ratbagctl: don't start a shell for ratbagd's subprocess
This is not required.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 10:32:41 +02:00
Peter Hutterer
636d254d41 tools: ratbagctl: remove duplicate subprocess.terminate() call
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 10:32:41 +02:00
Peter Hutterer
f6e5dd6c2c test: disable core dumps in the test suite
No need for this to end up in the journal

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 10:32:41 +02:00
Peter Hutterer
5637755345 Only reset the driver to NULL on unusual exits
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>
2017-07-24 10:32:41 +02:00
Peter Hutterer
a9c4f46412 ratbagd: change the led path to .../event4/p0/l0 (#240)
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>
2017-07-24 06:58:30 +02:00
Peter Hutterer
7aed3640c4 tools: ratbagctl: hook up report rate argparsing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-21 10:12:07 +02:00
Peter Hutterer
85f2ec3910 tools: ratbagctl: compress two print statements into one
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-21 10:12:07 +02:00
Peter Hutterer
6274dea4ac meson: add ratbagd.py as input source for merge_ratbagd.py
Otherwise we won't notice changes to it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-20 07:09:28 +02:00
Peter Hutterer
a938521c9e ratbagd: use zalloc instead of calloc
Because we really don't care about OOM beside blowing up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-19 10:09:01 +02:00
Peter Hutterer
9450d1402f Move the _cleanup_ functions over to shared-macro.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-19 10:09:01 +02:00
Peter Hutterer
8209ce56b6 Move a few #defines over to shared-macro.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-19 10:09:01 +02:00
Peter Hutterer
a6d03fde18 ratbagd: use strdup_safe for all string copies
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>
2017-07-19 10:09:01 +02:00
Peter Hutterer
5fff0ece5b tools: include config.h from lur-command
Removes duplicate GNU_SOURCE define

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-19 10:09:01 +02:00
Peter Hutterer
d915fdfe45 Include shared-macro.h from libratbag-util.h
These headers need merging at some point, for now just include it and remove
the duplicates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-19 10:09:01 +02:00
Peter Hutterer
7b861ada4c Move the shared sources from ratbagd into src
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-19 10:09:01 +02:00
Benjamin Tissoires
fa1799eef3 tools: copy ratbagd.py from piper and integrate it in ratbagctl
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>
2017-07-19 08:39:29 +02:00
Peter Hutterer
77cc2fa82d Add logitech G303 SVG for gnome theme (#228)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-18 13:15:48 +02:00
Benjamin Tissoires
de4bd4a2d2 tools: ratbagctl tests: do not spawn a new process for each call
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>
2017-07-18 19:33:32 +10:00
Benjamin Tissoires
c61782f1a4 tools: ratbagctl: Sync ratbagd.py with piper
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-18 19:33:32 +10:00
Benjamin Tissoires
6503407007 tools: ratbagctl: add missing capabilities strings
Prevents some failures while showing the information of the devices.

Fixes de16f1a4b1

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-18 19:33:32 +10:00
Jente Hidskes
09295d9d0e data/gnome/logitech-g700: fix overlapping paths
See https://github.com/libratbag/piper/issues/48
2017-07-18 17:52:43 +10:00
Jente Hidskes
2c379d09c9 data/gnome/README: include note on z-ordering
As discussed in https://github.com/libratbag/piper/issues/48
2017-07-18 17:49:25 +10:00
Jente Hidskes
994ade7fff data/gnome/logitech-502.svg: fix text alignment of button5-leader 2017-07-18 17:04:20 +10:00
Peter Hutterer
769289fe01 circleci: use fedora-latest, not rawhide
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>
2017-07-14 09:11:14 +10:00
Jente Hidskes
f05950f37c RatbagdLed: emit DefaultResolutionChanged on the resolution's object
path

See https://github.com/libratbag/piper/pull/36#issuecomment-315065722
2017-07-14 08:33:36 +10:00
Peter Hutterer
de16f1a4b1 Set the parent capabilities before setting any child ones (#223)
Any specific capability like 'switchable resolution' requires the basic
'resolution' capabilty to be set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-13 09:17:14 +02:00
Peter Hutterer
d1db382607 ratbagd: drop caching of libratbag variables (#222)
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>
2017-07-13 08:29:58 +02:00
Peter Hutterer
82a0cd4ec4 ratbagd: send property changed signals when we change the properties
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-13 07:02:08 +10:00
Clément Vuchener
ec85b6db3e hidpp20: Fix changing flags in hidpp20_special_key_mouse_set_control
The first bit of each pair set is new state for the flag, the second must be set for the change to be made.
2017-07-12 09:05:11 +02:00
Clément Vuchener
a9f4049841 driver-hidpp20: do not divert button when remapping
Temporary diversion has priority over remapping and should not be set at the same time.
2017-07-12 09:05:11 +02:00
Benjamin Tissoires
dab5d2c0b7 ratabgctl.test: reset the test device before each test
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>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
51d625244d ratbagd: add a method to reset the test device to its defaults
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>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
7b1e7dc4e7 tools: add a test suite for ratbagctl
Using unittest to be fancy

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
019d020535 tools: ratbagctl: output device information like ratbag-command
Better having a consistent device information across tools.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
89d071bb80 Fix flake-8 complains
Piper already uses this, we might as well.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
499ebc7d18 tools: ratbagctl: sync ratbagd bindings with piper
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
e522e0bb07 drivers: add a fallback for fetching the SVG name
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>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
f55a314666 ratbagd: add a test device while in developer mode
This allows to run tests against a device without having a proper device
plugged in.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
97ac0f81f2 hidpp20: shut one ratbagd warning
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>
2017-07-12 08:16:39 +02:00
Peter Hutterer
8cfcab3363 circle.yml: add ninja scan-build to the jobs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
6f72accbee circle.yml: split fedora install out and make ninja more flexible
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
e021937867 Change device name to use a stack buffer
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>
2017-07-11 10:50:22 +02:00
Peter Hutterer
82d197462f hidpp20: fix NULL-pointer dereference warning
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>
2017-07-11 10:50:22 +02:00
Peter Hutterer
78bdfe7a59 Don't allocate zero-sized memory
Triggered by the tests with 0 resolutions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
586fc7a97d hidpp20: squash memory leak on profile initialization error
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
2faa94920e hidpp20: drop unused argument from the profile destroy function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
01163d8f77 ratbagd: fix a false-positive unused variable warning
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
04990e4ea2 hidpp10: error out if we deal with unsupported profiles
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>
2017-07-11 10:50:22 +02:00
Peter Hutterer
37c8dec45c Fix the various scan-build warnings for dead assignments
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00