1
0
forked from drath/libratbag

183 Commits

Author SHA1 Message Date
Yaroslav Chvanov
fbd50bc241 ratbagd-profile: cap minimum report rate to 125
Fixes the sanity check part of #1563.
2024-01-14 02:52:06 +03:00
Yaroslav Chvanov
ec246cd18c build: move rbtree into a subdirectory 2023-09-25 22:37:08 +03:00
Yaroslav Chvanov
125090c524 ratbagd: show version when starting
Fixes #1530.
2023-09-25 20:28:11 +03:00
Yaroslav Chvanov
2b878fd06a libratbag: drop everything related to simple key action modifiers
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.
2023-09-25 18:55:12 +03:00
Yaroslav Chvanov
1ffbae54a7 ratbagd: change type of a variable to fix stack smashing
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.
2023-03-08 19:34:28 +03:00
Yaroslav Chvanov
f1118b5b64 ratbagd: add IsDirty property to profiles 2023-03-05 13:39:33 +03:00
Matthias Bach
6a07d0ec9c build: install ratbagd into sbindir
Ratbagd requires to be run by root. It should thus live in the system binary
directory.
2023-03-04 22:00:02 +03:00
Kyoken
51edc2967b add angle snapping and debounce 2023-03-02 02:59:42 +03:00
Yaroslav Chvanov
87f1409b7a test: remove usage of the deprecated LED type field 2023-02-25 14:02:37 +03:00
Yaroslav Chvanov
53d1eefa1c test: remove support for the deprecated button type field 2023-02-25 13:02:46 +03:00
Yaroslav Chvanov
7731a874d1 ratbagd: don't extract sd_bus when it's given as an argument 2023-02-24 23:44:00 +03:00
Julian Kandlhofer
d95328e8cc change misnamed function name
Signed-off-by: Julian Kandlhofer <julian.kandlhofer@gmail.com>
2023-02-14 16:29:20 +03:00
Julian Kandlhofer
4f36371af3 implement 'DeviceType' property
Signed-off-by: Julian Kandlhofer <julian.kandlhofer@gmail.com>
2023-02-14 16:29:20 +03:00
Yaroslav Chvanov
440292fda1 device: add firmware version API 2023-01-03 04:21:07 +03:00
Yaroslav Chvanov
77fcaf6d28 ratbagd: fix stack smashing
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...
2022-12-26 23:44:45 +03:00
Stephan Lachnit
45118b8fa5 Implement disabled resolutions
Implements feature to disable resolutions from a static resolution list.
Updates DBus API and tests accordingly.

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2022-12-25 22:54:16 +03:00
Stephan Lachnit
c99fd654e3 Make order of resolution properties consistent
Resolution properties should be in the order (active, default).

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2022-12-25 22:54:16 +03:00
Peter Hutterer
f6bfed4da0 ratbagd: switch Profile.Enabled to Profile.Disabled
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>
2022-12-25 22:54:16 +03:00
Yaroslav Chvanov
63f8e2c005 ratbagd: fix error handling in ratbagd_button_set_none() 2022-12-23 04:00:13 +03:00
Peter Hutterer
39b8f2bce2 ratbagd: map disabling a button to the existing action type None
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-12-23 03:38:18 +03:00
Yaroslav Chvanov
72c1a29f28 ratbagd: fix formatting 2022-12-22 00:52:05 +03:00
Yaroslav Chvanov
9485ab6c1f ratbagd: use NULL instead of 0 for pointers 2022-12-22 00:52:05 +03:00
Kyoken
2eeacc354f implement key bindings feature 2022-12-22 00:51:59 +03:00
Linus
bb6ab46a1a Fix presumed typo 2022-08-01 09:27:27 +10:00
staticssleever668
58086882a3 ratbagd: initialize a variable
Fixes a 'sometimes-uninitialized' warning by clang.
2021-10-16 22:43:37 +03:00
staticssleever668
c7c9c908e1 ratbagd-profile: allow report rates up to 8000 2021-07-24 22:17:19 +01:00
staticssleever668
b339370b6a ratbagd-profile: do not align report rates to 100 2021-07-24 22:17:19 +01:00
Thomas Weißschuh
ccaa8d1b6c ratbagd: register task to run as soon as possible
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
2021-06-21 22:47:42 +01:00
Thomas H.P. Andersen
e1f4fac9a2 ratbagd-json: fix compilation with clang
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.
2020-09-29 02:11:09 +01:00
Filipe Laíns
a8316c07f3 ratbagd: create path if not present before installing dbus policy dir
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-18 02:29:05 +01:00
Filipe Laíns
5fb1f4429d ratbagd: log error if failed to commit
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-01-06 19:22:57 +00:00
Filipe Laíns
0d3b4f1b64 libratbag: add 'switches' led type
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-19 12:06:15 +00:00
Stephan Lachnit
9dfd4fd03a remove .gitignore
Use a personal .gitignore for your build directory instead.

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2019-12-12 20:06:16 +00:00
Peter Hutterer
72d11de597 ratbagd: print two verbose messages at startup
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>
2019-12-10 22:48:53 +00:00
Filipe Laíns
5da791b268 ratbagd: support the old --verbose=raw syntax
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-05 09:44:35 +00:00
Filipe Laíns
e63802b01a ratbagd: make raw the default verbosity level (#857)
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-05 08:07:46 +10:00
Peter Hutterer
b4009669b9 ratbagd: Add an APIVersion property to make version checks easier
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>
2019-07-31 09:08:06 +10:00
Peter Hutterer
9c11960665 ratbagd: document the various commandline options in the man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-31 08:46:19 +10:00
Peter Hutterer
e8fc8b45d1 ratbagd: drop the hardcoded test device
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>
2019-07-31 08:36:16 +10:00
Peter Hutterer
818e665853 ratbagd: add ability to load json for test devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-31 08:36:16 +10:00
Peter Hutterer
49291c4b45 ratbagd: encode the test device path without underscores
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>
2019-07-30 19:28:07 +10:00
Peter Hutterer
05d7e9b324 ratbagd: poke DBus to reload its config after installing the devel policy
Fixes #753
2019-07-26 16:42:01 +10:00
Peter Hutterer
71a399f20f ratbagd: encode the test device iteration in the test device name
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>
2019-07-26 16:41:04 +10:00
Peter Hutterer
8259c2e706 ratbagd: introduce ref/unref for ratbagd_device pointers
We'll need to keep references around to devices even when caller is done with
them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-26 16:41:04 +10:00
Peter Hutterer
79e94b4a7e ratbagd: install the devel dbus policy file on startup
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>
2019-07-26 09:34:31 +10:00
Peter Hutterer
7fec19f8f2 test: switch the resolution capabilities to an array
Just like the profile ones

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-25 09:08:55 +02:00
Peter Hutterer
94d32930e2 ratbagd: use libunistring to convert profile names to utf-8
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>
2019-03-15 08:25:00 +01:00
Peter Hutterer
836922b133 ratbagd: fix property update notifications
Don't send property updates for props that don't exist anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-08 08:39:11 +01:00
Peter Hutterer
d17868303e Make the button mapping DBus API a single entry point
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>
2019-02-27 12:07:25 +10:00
Peter Hutterer
30c482aab2 Drop the Resolution.Capabilities field
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>
2019-02-27 11:44:05 +10:00