Compare commits

...

1680 Commits
v0.6 ... v0.18

Author SHA1 Message Date
Yaroslav Chvanov
9f4789f874 libratbag 0.18 2024-09-24 19:00:05 +03:00
Yaroslav Chvanov
7e1c7b3c7d release.sh: use bash from PATH in shebang
Fixes NixOS.
2024-09-24 19:00:05 +03:00
Yaroslav Chvanov
3bf556fb69 ratbagd: format with ruff format 2024-09-24 18:59:58 +03:00
Odd Eirik Nes
52dff63a64 data: add an additional usb identifier for Logitech G733 2024-09-24 15:59:11 +00:00
Yaroslav Chvanov
1c9662043f ratbagctl: use correct type hint for def main
Fixes: 34217a752b ("Update ratbagctl.test")
2024-06-04 18:52:37 +03:00
Yaroslav Chvanov
6f5470249d ratbagctl: remove unused imports 2024-06-04 18:50:12 +03:00
Yaroslav Chvanov
4845cc901f ratbagctl: fix Ruff warnings 2024-06-04 18:43:32 +03:00
Yaroslav Chvanov
8444ceb638 libratbag: remove FIXME for simple key action modifiers
Macros can be used for that instead.
2024-03-05 20:07:36 +03:00
Yaroslav Chvanov
1c4ef242fc sinowealth: use existing libratbag helper for converting macro to raw 2024-03-05 20:02:53 +03:00
koliwbr
cf15a6e65d data: add support for Mad Dog GM905 2024-02-27 19:16:38 +03:00
Yaroslav Chvanov
20962d093d ratbagc: fix new Ruff lints
Broke with Ruff v0.2.

- SIM401 Use `self._devices.get(id, None)` instead of an `if` block
- SIM113 Use `enumerate()` for index variable `i` in `for` loop
- Add type hint for Ratbagd._devices
2024-02-27 19:09:23 +03:00
Yaroslav Chvanov
e31338f081 ci: update linter settings format for ruff
Fixes:
> warning: The top-level linter settings are deprecated in favour of
> their counterparts in the `lint` section`.
2024-02-27 19:08:36 +03:00
Daniel Levi-Minzi
a52ffcdb45 add rog harpe ace wireless 2024-01-18 17:03:17 -05:00
Yaroslav Chvanov
79bb107634 ratbagd: fix typo 2024-01-14 02:58:18 +03:00
Yaroslav Chvanov
21373d8c4a sinowealth: fix lift-off distance reading integer overflow
Add same safety checks for it and angle snapping setting living near it.
Also log if something else is found in those buffers.
2024-01-14 02:58:18 +03:00
Yaroslav Chvanov
6c668d1f48 sinowealth: fix typos and reformat 2024-01-14 02:52:07 +03:00
Yaroslav Chvanov
8591540d03 sinowealth: add report rate cycling key mapping 2024-01-14 02:52:06 +03:00
Yaroslav Chvanov
d62984220b driver-hidpp20: remove unused static function
Fixes warning about unused function hidpp20drv_current_profile.
Also, it looks like it was missing 'rc == 0' check at the end.
2024-01-14 02:52:06 +03:00
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
Michał Lubas
2d7b4c10d1 Add a delay before dbus sync in ratbagctl.test 2024-01-14 02:49:18 +03:00
Michał Lubas
0204289704 meson.build: Don't pass a file to str.format 2024-01-14 02:48:08 +03:00
Michał Lubas
27b0d4a2d9 Replace removed imp module with importlib 2024-01-14 02:48:08 +03:00
Michał Lubas
34217a752b Update ratbagctl.test 2024-01-14 02:48:02 +03:00
Vladislav Tyulbashev
00f06ba98e data: add Logitech MX Anywhere 3S 2024-01-01 02:18:31 +03:00
BigBoiMan123
8d7ca98c38 data: add ASUS ROG Keris Wireless AimPoint 2023-12-23 16:15:55 +03:00
Yaroslav Chvanov
22ddb717aa test: format receiver IDs as hex numbers
Fixes the receiver test not working basically ever.
Fixes #1558.
2023-11-24 19:14:40 +03:00
Kirk Roybal
bb9ea29c39 data: add Logitech MX Master 3S for Business 2023-11-24 19:06:48 +03:00
Kyoken
dcd15243b9 asus: add rog chakram core 2023-11-23 23:59:11 +03:00
fritteli
6db5cc3743 data: set device type of Logitech G513 to keyboard
The G513 is actually a keyboard, not a mouse (at least mine is ...).
2023-10-07 22:25:16 +03:00
Yaroslav Chvanov
4a00c06351 build: remove Coverity work-around
Coverity hasn't been used in a long while, by their web-site [1], last
analyzing was done in 2019-02 - over 4 years ago.
2023-09-25 22:39:58 +03:00
Yaroslav Chvanov
ec246cd18c build: move rbtree into a subdirectory 2023-09-25 22:37:08 +03:00
Yaroslav Chvanov
0d2ef30e41 steelseries: remove an unneeded import 2023-09-25 22:27:50 +03:00
Yaroslav Chvanov
a458e40e7f sinowealth: add a note about a bit mask 2023-09-25 22:27:50 +03:00
Yaroslav Chvanov
dd573b164f sinowealth: put a number into a const 2023-09-25 22:27:50 +03:00
Yaroslav Chvanov
f08faac63d libratbag-util: add const correctness 2023-09-25 22:27:50 +03:00
Yaroslav Chvanov
8e07821ffe libratbag-data: fix narrowing conversions 2023-09-25 22:27:49 +03:00
Yaroslav Chvanov
8c2570b30b libratbag-hidraw: add const correctness 2023-09-25 22:27:49 +03:00
Yaroslav Chvanov
1f3dea486d libratbag: add a bit of const correctness 2023-09-25 22:27:49 +03:00
Yaroslav Chvanov
6a7eff8aa1 hidpp20: remove an unused variable 2023-09-25 22:25:12 +03:00
Yaroslav Chvanov
125090c524 ratbagd: show version when starting
Fixes #1530.
2023-09-25 20:28:11 +03:00
Stephan Lachnit
abfa43345b data: add support for Logitech G413 keyboard
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2023-09-25 19:21:28 +03:00
Yaroslav Chvanov
d0c34bdbe9 sinowealth: write simple enough macros as key actions 2023-09-25 18:59:35 +03:00
Yaroslav Chvanov
13a7be878b sinowealth: change some default switch cases, comments and code style 2023-09-25 18:58:47 +03:00
Yaroslav Chvanov
4c68f71616 sinowealth: handle errors in sinowealth_button_set_key_action 2023-09-25 18:58:09 +03:00
Yaroslav Chvanov
e5ebce50ff sinowealth: handle errors in sinowealth_update_macro_events_from_action 2023-09-25 18:57:19 +03:00
Yaroslav Chvanov
874f32f212 sinowealth: make report rates list const 2023-09-25 18:56:38 +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
d155bd27ec libratbag: refactor ratbag_action_macro_num_keys()
Also use a helper for checking modifiers, this will be handy for
drivers.
2023-09-25 18:55:12 +03:00
Yaroslav Chvanov
068a34c1dc doc: don't say that report rate is related to resolutions 2023-09-25 18:55:11 +03:00
Yaroslav Chvanov
e2f3ac8925 doc: remove an outdated section from IsDisabled field of Resolution 2023-09-25 18:55:11 +03:00
Yaroslav Chvanov
df7be31938 doc: remove leftover docs generators for libratbag-enums
Unused since c8c1c63531.
2023-09-25 18:55:11 +03:00
Yaroslav Chvanov
cf87e57aef doc: fix ActionTypes 2023-09-25 18:55:11 +03:00
Kyoken
bad8dd7ba7 asus: warn on unknown key codes 2023-09-19 18:17:46 +03:00
Yaroslav Chvanov
e3cf227019 ratbagctl: ignore a Ruff f-string formatting warning (UP032)
I think we're better off ignoring the warning here (instead of repeating
the same argument like 10 times).

Fixes tests failing because UP032 was extended in Ruff (and this has
happened before). Pinning Ruff is probably a good idea. (Fixes #1515.)
2023-09-19 18:16:49 +03:00
Yaroslav Chvanov
a4eb09ea6d ratbagd.py: sync with Piper
- Convert strings to f-strings
- Listen and notify about RatabgdProfile.Disabled changes
2023-07-17 18:05:06 +03:00
Yaroslav Chvanov
2311a84339 Use f-strings for formatting
Fixes Ruff warnings. Ruff didn't detect these before. Should we pin Ruff
version? 🤔
2023-07-17 00:31:53 +03:00
Ryan Jensen
0b5a95f09e updating documentation: linux/input.h -> linux/input-event-codes.h 2023-07-08 10:26:07 +03:00
Kyoken
f5e2259da5 asus: fix single profile devices 2023-06-04 18:58:18 +03:00
Yaroslav Chvanov
b1cdf6a4c2 steelseries: ignore the check for HID vendor device
Although it does work for some mice and fixes there being several
configurable devices for a single mouse in libratbag, for some mice it
does *not* apply, making them unusable with libratbag.
2023-05-20 11:19:43 +03:00
Yaroslav Chvanov
a121c0227b steelseries: check for settings reading errors 2023-05-20 11:18:20 +03:00
Yaroslav Chvanov
4240e067a9 openinput: return early instead of making an error-prone zero-sized VLA
Fixes a clang-analyze warning.
2023-05-20 11:01:17 +03:00
Yaroslav Chvanov
cf202eeeca driver-hidpp20: zero initialize a struct
This fixes a clang-analyze warning about uninitialized value getting
stored later.
2023-05-20 10:56:55 +03:00
Yaroslav Chvanov
4d6f80de01 liblur: check return value instead of comparing the out_ptr
Fixes a clang-analyze warning for a dead assignment.
2023-05-20 00:15:55 +03:00
Yaroslav Chvanov
b717f946ef sinowealth-nubwo: idiomatically zero initialize a struct 2023-05-20 00:12:46 +03:00
Yaroslav Chvanov
cfab554ea8 sinowealth-nubwo: remove trailing whitespace 2023-05-20 00:12:34 +03:00
Yaroslav Chvanov
b7b9749901 sinowealth-nubwo: correctly use an attribute
This erroneously declared it with name `__packed__` instead of using it
as an attribute.
It doesn't seem like it changes struct's size, but it has no
static_assert on it so we can't be 100% sure.
2023-05-20 00:10:33 +03:00
Yaroslav Chvanov
bb67e9b54e sinowealth-nubwo: fix incorrect firmware version getting error check
If by any chance returned `size` was `0`, it would erroneously return 0,
which would do an uninitialized pointer dereference in
sinowealthnubwo_probe().
This fixes a convoluted warning by clang-analyze.
2023-05-19 23:55:21 +03:00
Yaroslav Chvanov
9383f63c04 steelseries: add missing newlines to logging 2023-05-19 23:18:32 +03:00
Yaroslav Chvanov
8c220cb1a8 steeseries: make an array static const 2023-05-19 22:57:12 +03:00
Yaroslav Chvanov
9b36ff7dd1 steelseries: make most of implicit conversions explicit
Did not fix brightness and LED color, they deserve being changed on
libratbag side.
2023-05-19 22:57:12 +03:00
Yaroslav Chvanov
ab4504d3ed steelseries: fix narrowing conversions 2023-05-19 22:57:12 +03:00
Yaroslav Chvanov
d4a35f341b steelseries: don't define variables on a single line 2023-05-19 22:57:12 +03:00
Yaroslav Chvanov
ea5ca29aa2 steelseries: don't use reserved underscore identifiers 2023-05-19 22:57:12 +03:00
Yaroslav Chvanov
6fcac8a360 steelseries: simplify loop breaking 2023-05-19 22:57:11 +03:00
Yaroslav Chvanov
6e2550ac51 steelseries: add commit error logging 2023-05-19 22:57:11 +03:00
Yaroslav Chvanov
bd65f7f461 steelseries: don't use else after return 2023-05-19 21:50:14 +03:00
Jon
9cc4d71dd0 data: update logitech-g915-tkl.device to DeviceType=keyboard
Diverged accidentally from G915 in
4f36371af3.
2023-04-24 03:54:23 +03:00
Qjammer
7fb3c63e8d marsgaming: implement Mars Gaming MM4 protocol 2023-04-14 14:23:28 +03:00
Kyoken
70f2e96a66 asus: check mouse in probe, fix asus status code 2023-03-31 09:55:19 +03:00
Kyoken
fdf9c3ce7e data: fix asus chakram x 2023-03-31 00:00:15 +03:00
Yaroslav Chvanov
d82821fd62 sinowealth: show a more detailed message for unknown mice
The string may be a bit too long, but I still think it's a good idea to
guide people in the right direction.
2023-03-19 03:07:43 +03:00
Yaroslav Chvanov
dc9d49a240 data: improve description of possible fields for sinowealth driver 2023-03-19 02:51:19 +03:00
Yaroslav Chvanov
87f6e521e6 sinowealth: store firmware version in device files in the group name
It only makes sense, since it's what the section are identified by.
2023-03-19 02:42:47 +03:00
Yaroslav Chvanov
44279ddda3 shared-macro: make startswith() return a const char*
The supplied arguments are const, and as such the return type which is
derived from the arguments must also be const.
2023-03-19 02:39:30 +03:00
Yaroslav Chvanov
876c06237e sinowealth: change device files to match other drivers
..specifically the "ButtonCount" and "ProfileCount" keys.
2023-03-19 02:39:21 +03:00
Yaroslav Chvanov
4b936bf478 test: add test for sinowealth driver sections in device files 2023-03-19 01:51:21 +03:00
Yaroslav Chvanov
2522e4ed20 build: remove redundant build targets for tests
Initially I made them so that you can run them separately to see their
output, however, this can be done with meson out of the box. E.g.,
replace:
`ninja -C builddir python-black-check`
with
`meson test -v -C builddir python-black-check`.
2023-03-19 01:30:10 +03:00
halting
b137c61b9f Revert "g300: use the correct step size"
This reverts commit 20b573668e.
200-2500 DPI range and 50 DPI step don't works as expected on Linux.
2023-03-18 18:03:14 -03:00
Yaroslav Chvanov
cb196e16bb libratbag: don't allow disabling active profile 2023-03-09 18:33:02 +03:00
Yaroslav Chvanov
d259da5d42 test: check that active profile can't be disabled
This is failing right now.
2023-03-09 18:33:02 +03:00
Yaroslav Chvanov
115ee47787 libratbag: don't allow setting disabled profile as active 2023-03-09 18:33:02 +03:00
Yaroslav Chvanov
890d8313fd test: check that disabled profile can't made active
This is failing right now.
2023-03-09 18:31:38 +03:00
Yaroslav Chvanov
6e06fe7245 tools: fix printing of macros with buttons in them
As the fields are not always keys, also don't strip the first four
symbols of the string.
(as it's not always obvious what the stripped string can be, for example
BTN_0 and KEY_0).
2023-03-09 17:07:28 +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
072c1845b2 fixup! sinowealth: read profile count from the device file 2023-03-07 05:38:31 +03:00
Yaroslav Chvanov
2f5a7a5628 data: add SinoWealth driver to the example device file 2023-03-07 05:35:17 +03:00
Yaroslav Chvanov
d658dba612 sinowealth: check if ButtonCount field in device file is correct
Fixes such scenario:
Set ButtonCount to -1.
Start libratbag.
Watch sun burn.
2023-03-07 05:35:17 +03:00
Yaroslav Chvanov
17d869d5bf libratbag-data: set fallback value in the same place as the proper value 2023-03-07 05:35:17 +03:00
Yaroslav Chvanov
fd6e693e88 sinowealth: don't try to live through errors while committing 2023-03-07 05:35:17 +03:00
Yaroslav Chvanov
e712b4f1eb sinowealth: fix logging using wrong member 2023-03-07 05:35:17 +03:00
Yaroslav Chvanov
ca7d4f78fc data: enable second profile for T-Dagger Imperial T-TGM310 2023-03-07 05:35:17 +03:00
Yaroslav Chvanov
a1e2159a4f sinowealth: allow up to three profiles 2023-03-07 05:35:17 +03:00
Yaroslav Chvanov
b39f2794cb sinowealth: conditionally enable writing profile-switching bindings 2023-03-07 05:35:16 +03:00
Yaroslav Chvanov
a8320f7eb7 sinowealth: use early return 2023-03-07 05:35:16 +03:00
Yaroslav Chvanov
59d85e0bf8 sinowealth: change "profile-up" button binding to cycle
I can't explain this, I'm SURE it wasn't cycling before and was just
getting stuck on the highest profile. What?
2023-03-07 05:35:16 +03:00
Yaroslav Chvanov
26cc246a4c sinowealth: read profile count from the device file 2023-03-07 05:35:16 +03:00
Yaroslav Chvanov
dfd9be05ab sinowealth: add "cycle LED modes" binding to unknown 2023-03-07 03:38:22 +03:00
Yaroslav Chvanov
fd3ce088b0 sinowealth: make an error message less generic 2023-03-07 03:30:45 +03:00
Yaroslav Chvanov
8fdf0de849 sinowealth: rename MAX to the variable with maximum profile count
It can go UP TO this count, it's not necessarily this number.
2023-03-07 03:19:41 +03:00
Yaroslav Chvanov
d2ee857d05 sinowealth: add and use profile count in drv_data 2023-03-07 03:18:53 +03:00
Yaroslav Chvanov
40e1785bcc sinowealth: check for device compatibility as soon as possible 2023-03-07 03:13:23 +03:00
Yaroslav Chvanov
9a0972891a sinowealth: update the comment about profile count 2023-03-07 03:04:53 +03:00
Yaroslav Chvanov
224985e28c sinowealth: add command IDs for the third profile 2023-03-07 02:55:09 +03:00
Yaroslav Chvanov
3b7fc7a662 ratbagctl: show if a profile is dirty 2023-03-07 00:31:10 +03:00
Yaroslav Chvanov
c4ee9d707d ratbagd.py: sync with Piper
- Fix a regression of profile not getting dirty after property changes.
- Add `notify` signals for more things.
- Do some minor refactoring.
2023-03-07 00:23:14 +03:00
Yaroslav Chvanov
52e21d767d libratbag: take constant pointers where possible 2023-03-07 00:12:09 +03:00
Yaroslav Chvanov
364948c32a libratbag: remove fall back for Logitech devices
This should be unreachable because we `Driver` field must be set in
device files, otherwise they are ignored. Our tests also catch this.

Anyway, it's always better to be explicit about this.
2023-03-06 23:44:06 +03:00
Yaroslav Chvanov
e9604305d1 libratbag-data: use the dpi_list_free helper 2023-03-06 23:42:31 +03:00
Yaroslav Chvanov
2734bc17de libratbag-util: make dpi_list_free() be able to take NULL
free() can take NULL without errors, and so should such helper.
2023-03-06 23:41:40 +03:00
Yaroslav Chvanov
2a356736f7 Fix drivers making profiles dirty while probing
Fixes drivers calling public API functions which should only be called
by the consumers of the library. The real problem here is that we don't
have a clear separation between driver API and public API.
This is just a simple search and replace, so there be more such things.
2023-03-05 16:32:03 +03:00
Yaroslav Chvanov
822f37a68c libratbag: check if profile is dirty in sanity check 2023-03-05 16:32:03 +03:00
Yaroslav Chvanov
1df7316195 libratbag: check if driver supports committing
There could be segmentation faults with the openinput driver.
2023-03-05 16:32:03 +03:00
Yaroslav Chvanov
44af3f145d ratbagd.py: use the IsDirty property of the DBus API 2023-03-05 13:39:33 +03:00
Yaroslav Chvanov
f1118b5b64 ratbagd: add IsDirty property to profiles 2023-03-05 13:39:33 +03:00
Yaroslav Chvanov
3e42349daa libratbag: add API for checking if profile is dirty 2023-03-05 13:26:27 +03:00
Yaroslav Chvanov
9f031e58a1 libratbag: fix profile not becoming dirty on active profile switch 2023-03-05 13:25:53 +03:00
Yaroslav Chvanov
2b47f5b942 data: add Sinowealth Generic Mouse (258a:0051) 2023-03-05 05:42:36 +03:00
Yaroslav Chvanov
78f68d2470 data: add links to device issues with raw configuration data 2023-03-05 05:39:40 +03:00
Yaroslav Chvanov
4a0d906092 sinowealth: add support for PMW3212 sensor
Not tested if it needs off-by-one adjustment like some other sensors do.
Although it could've been an ideal opportunity to add support for all of
the possible sensors, I didn't do it for the same reason.
2023-03-05 05:39:40 +03:00
Yaroslav Chvanov
53f09ed8c7 sinowealth: add more debug logging for easier device file creation 2023-03-05 05:39:40 +03:00
Yaroslav Chvanov
f96c5e2499 sinowealth: fix incorrect placement of sensor_type in config data
Oh wow.
2023-03-05 05:39:40 +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
Yaroslav Chvanov
84e8e63752 libratbag: don't apply active profile change until committing 2023-03-04 04:07:32 +03:00
Yaroslav Chvanov
a3f0ea9a52 tools: skip linter checks if linters are not installed 2023-03-04 03:37:31 +03:00
Yaroslav Chvanov
4b8ac177d1 tools: print errors to stderr 2023-03-04 03:34:12 +03:00
Yaroslav Chvanov
0e3f909264 ratbagd.py: add back .keys() calls on all GLib.Variant
This causes crashes on Piper side.
2023-03-03 23:37:26 +03:00
Kyoken
3f1e0f09cc ratbagd.py: don't mark a profile as dirty on active profile switch 2023-03-03 15:40:06 +03:00
Yaroslav Chvanov
b0d3f86287 build: add a missing dependency to a test
This fixes tests failing if you run `meson test` without running a
`meson compile` first.
2023-03-02 14:24:57 +03:00
Yaroslav Chvanov
a9545b2b63 test: use a simply assert instead of using a helper 2023-03-02 14:05:37 +03:00
Yaroslav Chvanov
1d24aa71d3 build: use project-local build and source directories
I think it should be possible to embed libratbag as a meson subproject
now (not tested).
2023-03-02 13:58:21 +03:00
Yaroslav Chvanov
a00531fe8b lint: exit early if git ls-files doesn't find anything 2023-03-02 13:48:03 +03:00
Yaroslav Chvanov
265e1cee1a test: fix traceback.print_exception() usage on older Python versions 2023-03-02 05:48:40 +03:00
Yaroslav Chvanov
e7a738086c lint: enable flake8-return 2023-03-02 05:30:31 +03:00
Yaroslav Chvanov
40fb7430db lint: enable flake8-simplify 2023-03-02 05:30:30 +03:00
Yaroslav Chvanov
27d74ae0f0 Use 'a != b' instead of 'not a == b' 2023-03-02 05:30:30 +03:00
Yaroslav Chvanov
80fa7f5b8f Use 'key in dict' instead of 'key in dict.keys()' 2023-03-02 05:30:30 +03:00
Yaroslav Chvanov
78b56d6ea0 tools: make all exceptions types have Error as the sufix 2023-03-02 05:30:30 +03:00
Yaroslav Chvanov
e84a56c424 test: don't return anything from main() 2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
04b77a3b9b test: raise ValueError instead of AssertionError manually 2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
57323ac978 ratbagctl: remove unnecessary else 2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
8455c3ea71 ratbagctl: use standard exception types 2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
3252d57b50 ratbagctl: fix an incorrect type hint 2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
4b506a4ece lint: enable flake8-pie lints 2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
7551bdaeff tools: remove unnecessary pass statements 2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
ef2049643c ratbagctl: use textwrap.indent instead of inventing the wheel ourselves 2023-03-02 04:32:39 +03:00
Yaroslav Chvanov
681153ad4d doc: add angle snapping and debounce time 2023-03-02 03:01:06 +03:00
Yaroslav Chvanov
382df65a5d sinowealth: implement debounce time reading/writing 2023-03-02 03:01:06 +03:00
Kyoken
51edc2967b add angle snapping and debounce 2023-03-02 02:59:42 +03:00
Yaroslav Chvanov
37628da52f Remove flake8 configuration file
We now use black and ruff instead.
2023-03-01 23:52:11 +03:00
Yaroslav Chvanov
1b2259a8cb ratbagctl: rename a member function to prevent incorrect overriding 2023-03-01 23:01:10 +03:00
Yaroslav Chvanov
211551ff5b ratbagctl: don't reuse a variable for different types 2023-03-01 23:01:10 +03:00
Yaroslav Chvanov
6c5a15172b ratbagctl: make an argument non-optional 2023-03-01 23:01:10 +03:00
Yaroslav Chvanov
e43a7a279b ratbagctl: simplify an expression to make mypy understand it 2023-03-01 23:01:10 +03:00
Yaroslav Chvanov
3be064aef0 ratbagctl: add type hints where possible
We use the dynamic nature of Python for parsing command line arguments,
which makes it nearly impossible to type hint everything.
2023-03-01 23:01:10 +03:00
Yaroslav Chvanov
9b45b2ac03 tools: fix "line too long" warnings where possible 2023-03-01 22:18:41 +03:00
Yaroslav Chvanov
2bf349459b tools: ignore a false positive warning 2023-03-01 22:17:32 +03:00
Yaroslav Chvanov
57ac72077f tools: don't use complex types as default function arguments 2023-03-01 22:17:32 +03:00
Yaroslav Chvanov
a192088f13 tools: chain exceptions within exceptions 2023-03-01 22:17:32 +03:00
Yaroslav Chvanov
fa67024110 tools: fix ambiguous variable names
These one-letter variable names really are bad.
A good illustration of this is resolutions being assigned to the
variable where Ratbagd was, both of such variables were always names
just "r".
2023-03-01 22:17:32 +03:00
Yaroslav Chvanov
2ba49ba185 test: fix ambiguous variable names 2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
a66e6d2066 Automatically fix Ruff warnings 2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
3aa82d2b35 build: add Ruff for Python code linting 2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
49146638a6 Format Python code 2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
c723490fc3 build: add Python code formatting with black
NOTE: this will fail tests as of this commit, as the code is not
formatted yet.

We didn't explicitly specify a minimum Python version before that, so I
used v3.7 here, because it's the minimal version Ruff - a Python linter
I will add in the next commit - supports.
2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
bc9fa92667 tools: prevent a syntax error for code editors and linters 2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
41b55a1aff Rename Python files throughout the project to have .py* in the suffix
This just makes it more clear what these files are without opening them.
2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
f6a3cd74bf gskill: add back button type button actions
Regression since 5548da21d3.

However I'm almost 100% sure this displays incorrect mouse buttons.
2023-03-01 20:48:48 +03:00
Yaroslav Chvanov
f9266496b0 ratbagctl: check if there is an active resolution 2023-03-01 03:59:58 +03:00
Yaroslav Chvanov
26cc2c7138 ratbagctl: check if there is an active profile 2023-03-01 03:59:19 +03:00
Yaroslav Chvanov
11f1ba9f37 tools: don't try to return the first resolution on error 2023-03-01 03:58:58 +03:00
Yaroslav Chvanov
fc80221187 tools: don't try to return the first profile on error
This may make an exception.
2023-03-01 03:57:54 +03:00
Yaroslav Chvanov
bc05935322 sinowealth: use the first profile if active profile index is too high
It seems like some devices now do have several profiles support enabled
officially. We failed to probe such mice if they have had non-first
profile as active. This fixes it.
2023-03-01 03:27:02 +03:00
Yaroslav Chvanov
fb5995a731 sinowealth: get rid of profile cache
This just duplicates data between libratbag and the driver.
2023-03-01 03:27:02 +03:00
Yaroslav Chvanov
b92645c373 sinowealth: edit a note about active profile index to be more clear 2023-03-01 03:27:02 +03:00
Yaroslav Chvanov
08d7c6997d sinowealth: move active profile index and debounce time getting to init
They were out of place being directly in the `probe` function.
Also, this will make more sense once we add an API for changing debounce
times.
2023-03-01 03:26:15 +03:00
Yaroslav Chvanov
9ec8c728cd sinowealth: add missing new-line in a log message 2023-03-01 03:25:04 +03:00
Yaroslav Chvanov
085274678f sinowealth: don't change active profile while probing
Official configuration utilities did this while probing if I remember
correctly, but it's not actually necessary.
2023-03-01 03:22:32 +03:00
Yaroslav Chvanov
5ab018df79 libratbag: remove everything related to the deprecated ratbag_led_type 2023-02-25 14:05:03 +03:00
Yaroslav Chvanov
87f1409b7a test: remove usage of the deprecated LED type field 2023-02-25 14:02:37 +03:00
Yaroslav Chvanov
f0f0cc8843 sinowealth-nubwo: remove usage of the deprecated LED type field 2023-02-25 13:59:23 +03:00
Yaroslav Chvanov
cbf09dac75 libratbag-data: don't parse LedTypes from device files 2023-02-25 13:59:23 +03:00
Yaroslav Chvanov
311df4e78e G300: remove usage of the deprecated LED type field 2023-02-25 13:56:50 +03:00
Yaroslav Chvanov
274f19e84b test: don't allow the deprecated LedTypes field 2023-02-25 13:39:47 +03:00
Yaroslav Chvanov
ac999da26c data: remove usage of the deprecated LED type field 2023-02-25 13:39:41 +03:00
Yaroslav Chvanov
a56ed6f1d8 roccat-kone-emp: remove usage of deprecated LED types 2023-02-25 13:36:21 +03:00
Yaroslav Chvanov
741b5f80e0 hidpp20: remove usage of deprecated LED types 2023-02-25 13:33:56 +03:00
Yaroslav Chvanov
ecdcfc1c34 steelseries: remove usage of deprecated LED type 2023-02-25 13:33:23 +03:00
Yaroslav Chvanov
82f0ed2aa1 G600: remove usage of deprecated LED types 2023-02-25 13:32:30 +03:00
Yaroslav Chvanov
22020330fb sinowealth: remove usage of deprecated LED types 2023-02-25 13:32:12 +03:00
Yaroslav Chvanov
2edeefaaa0 asus: remove usage of deprecated LED types 2023-02-25 13:31:38 +03:00
Yaroslav Chvanov
84626322c7 tools: remove helpers for deprecated LED types 2023-02-25 13:30:06 +03:00
Yaroslav Chvanov
11fa70ad5c hidpp20: remove unused LED type mappings 2023-02-25 13:28:52 +03:00
Yaroslav Chvanov
73b9b2da3a hidpp20: remove usage of the deprecated LED type in the driver 2023-02-25 13:27:17 +03:00
Yaroslav Chvanov
0c8beb6b9c libratbag: remove support for the deprecated button type field 2023-02-25 13:27:17 +03:00
Yaroslav Chvanov
6e3011d64f hidpp20: remove unused physical mapping button type
The `name` field does seem useful for debugging, so I left it in place.
2023-02-25 13:27:17 +03:00
Yaroslav Chvanov
1b00f7031a hidpp20: don't set the deprecated button type field in the driver 2023-02-25 13:23:29 +03:00
Yaroslav Chvanov
5548da21d3 gskill: remove support for the deprecated button type field
In this driver it seems like it was used for something. Let's hope it
was something optional.
2023-02-25 13:11:37 +03:00
Yaroslav Chvanov
85cab665b5 tools: remove helpers for the deprecated ratbag_button_type 2023-02-25 13:03: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
6cadc70caf steelseries: remove support for the deprecated button type field 2023-02-25 13:01:24 +03:00
Yaroslav Chvanov
ae2b0aa80b roccat: remove support for the deprecated button type field 2023-02-25 13:01:16 +03:00
Yaroslav Chvanov
05652e554c roccat-kone-pure: remove support for the deprecated button type field 2023-02-25 13:01:08 +03:00
Yaroslav Chvanov
a364076919 roccat-kone-emp: remove support for the deprecated button type field 2023-02-25 13:00:53 +03:00
Yaroslav Chvanov
d460e48795 G600: remove support for the deprecated button type field 2023-02-25 13:00:15 +03:00
Yaroslav Chvanov
018bd6e43e G300: remove support for the deprecated button type field 2023-02-25 13:00:09 +03:00
Yaroslav Chvanov
64dbfaa14a hidpp10: remove support for the deprecated button type field 2023-02-25 13:00:00 +03:00
Yaroslav Chvanov
515e634e87 gskill: remove support for the deprecated button type field 2023-02-25 12:59:26 +03:00
Yaroslav Chvanov
846a11ad58 etekcity: remove support for the deprecated button type field 2023-02-25 12:58:41 +03:00
Yaroslav Chvanov
54b55df43b roccat: don't enable key-type button actions
Not actually implemented.
2023-02-25 12:51:43 +03:00
Yaroslav Chvanov
40b477c2e3 roccat-kone-pure: don't enable key-type button actions
Not actually implemented.
2023-02-25 12:51:28 +03:00
Yaroslav Chvanov
f3052c5ff1 roccat-kone-emp: don't enable key-type button actions
Not actually implemented.
2023-02-25 12:51:00 +03:00
Yaroslav Chvanov
fbc4296c3b etekcity: don't enable key-type button actions
Trivially implementable, but not supported as-is.
2023-02-25 12:47:54 +03:00
Yaroslav Chvanov
1ea3eafc20 G300: don't enable key-type button actions
Trivially implementable, but not supported as-is.
2023-02-25 12:43:07 +03:00
Yaroslav Chvanov
cbc822bd52 steelseries: don't enable key-type button actions
Trivially implementable, but not supported as-is.
2023-02-25 12:43:04 +03:00
Yaroslav Chvanov
de5436e9a6 G600: don't enable key-type button actions
Trivially implementable, but not supported as-is.
2023-02-25 12:42:50 +03:00
Yaroslav Chvanov
9ec13c2862 tools: write to file directly without using print 2023-02-25 01:03:13 +03:00
Yaroslav Chvanov
3be9f38d2c tools: remove unused variables 2023-02-25 00:57:18 +03:00
Yaroslav Chvanov
e49c18b909 tools: use with-statements to open files
I'll be honest, writing to files with `print` looks weird...
2023-02-25 00:55:53 +03:00
Yaroslav Chvanov
74c2cb686e test: add explanations to empty excepts
And all of them are the same string... This is a bit annoying.
2023-02-25 00:41:23 +03:00
Yaroslav Chvanov
0db55eda25 tools: remove unused arguments 2023-02-25 00:22:07 +03:00
Yaroslav Chvanov
313c34fa98 tools: fix incorrect special method signature
Continuation of 62678baca1.
2023-02-25 00:22:07 +03:00
Yaroslav Chvanov
b275204c87 tools: check snprintf size argument to prevent potential overflow 2023-02-25 00:22:07 +03:00
Yaroslav Chvanov
e9e9d8e3fe libratbag-util: check the return value of scanf 2023-02-25 00:22:07 +03:00
Yaroslav Chvanov
3730e4d48a driver-hidpp10: fix variable shadowing 2023-02-24 23:44:01 +03:00
Yaroslav Chvanov
f872b16ef8 driver-hidpp20: fix variable shadowing 2023-02-24 23:44:01 +03:00
Yaroslav Chvanov
2a866aacde test: fix variable shadowing 2023-02-24 23:44:01 +03:00
Yaroslav Chvanov
33e0c2cacc hidpp10: fix variable shadowing 2023-02-24 23:44:01 +03:00
Yaroslav Chvanov
80ce0dbf21 sinowealth: remove an incorrect enum member 2023-02-24 23:44:01 +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
Yaroslav Chvanov
b0a9f24afb test: remove a duplicate import 2023-02-24 23:44:00 +03:00
Yaroslav Chvanov
200fbe5875 hidpp10: fix a faulty error check which prevent macro parsing 2023-02-24 23:44:00 +03:00
Yaroslav Chvanov
5158d80cfa G600: prevent unused variable usage warning 2023-02-24 23:44:00 +03:00
Yaroslav Chvanov
683b5d752c G300: prevent unused variable usage warning 2023-02-24 23:44:00 +03:00
Yaroslav Chvanov
1eed280b82 tools: remove an unused function that always raises
..unless it's used by some third-party library? Either way, it just
raises an error.
2023-02-24 23:43:33 +03:00
Yaroslav Chvanov
dcdd7be8d8 tools: remove an unnecessary variable definition 2023-02-24 22:46:34 +03:00
Yaroslav Chvanov
62678baca1 tools: fix incorrect special method signature
They worked fine nonetheless as we only called these manually.
2023-02-24 22:43:37 +03:00
Matt Coffin
f20686b296 steelseries: add support for Rival 650 Wireless 2023-02-24 22:01:15 +03:00
José Almeida
ada99fb72e data: add device Logitech G Pro (X) keyboard
Known issues:
- not possible to change LED color of Caps lock indicator, Scroll
lock indicator and Game Mode button.
2023-02-14 16:49:27 +03:00
Yaroslav Chvanov
4b2b5a2038 ratbagctl: capitalize device type instead of having it in upper case 2023-02-14 16:29:21 +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
931ec44ff2 driver-hidpp10: fix integer overflow when profile count is unset
Blame C for implicit conversions.
2023-01-27 13:45:13 +03:00
Yaroslav Chvanov
fbdb41b073 hidpp10: return EINVAL instead of aborting
While these indicate an obvious error in the caller's code, there is no
need to crash the whole program because of this.
2023-01-27 13:42:32 +03:00
mistepien
6dcd17d340 data: add additional USB id for Logitech G102 (046d:c09d) 2023-01-06 17:45:30 +03:00
Yaroslav Chvanov
f8080865f4 steelseries: save the firmware version in ratbag device 2023-01-03 04:21:41 +03:00
Yaroslav Chvanov
7e91b3a343 sinowealth: save the firmware version in ratbag device 2023-01-03 04:21:07 +03:00
Yaroslav Chvanov
440292fda1 device: add firmware version API 2023-01-03 04:21:07 +03:00
Yaroslav Chvanov
17f8f0516b libratbag-util: make asprintf_safe() return a char* 2023-01-03 04:21:07 +03:00
Yaroslav Chvanov
7a5b9b4367 Fix typos throughout the codebase 2023-01-03 04:17:44 +03:00
Zebreus
e39d91cb2d doc: fix typo in readme 2023-01-02 15:27:46 +01:00
Yaroslav Chvanov
75b9bc9843 doc: fix documentation for disabling resolutions 2022-12-26 23:50:51 +03:00
Yaroslav Chvanov
f595c96495 ratbagctl: fix typo 2022-12-26 23:44:48 +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
Yaroslav Chvanov
fdb4d65aa4 sinowealth: implement disabled resolutions 2022-12-25 22:54:16 +03:00
Stephan Lachnit
a624c681a3 driver-hidpp20: implement disabled resolutions
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2022-12-25 22:54:16 +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
e32145ecc7 ratbagd.py: fix changes to IsActive potentially not being notified about 2022-12-23 23:41:30 +03:00
Yaroslav Chvanov
2031e169ab ratbagd.py: make the profile dirty after changing report rate
This fixes the "Apply" button being disabled after changing report rate
in Piper (once this file gets synchronized there).
2022-12-23 23:40:55 +03:00
Yaroslav Chvanov
6e406d5127 ratbagc: add NONE as allowed action type
Fixes button disabling not working with ratbag-command.
2022-12-23 04:27:43 +03:00
Yaroslav Chvanov
d6c5f18362 Revert "tools: convert our enum equivalents to python enums"
This reverts commit 95243307ce.

I don't see any reason it has been there at all, and it also breaks
ratbag-command because of probably mistakenly removed Macro.NONE.
2022-12-23 04:26:40 +03:00
Yaroslav Chvanov
876e0cc642 sinowealth: enable button disabling support 2022-12-23 04:01:54 +03:00
Yaroslav Chvanov
56e0ee9279 ratbagctl: check if disabling buttons is supported 2022-12-23 04:01:29 +03:00
Yaroslav Chvanov
9e12c5874c libratbag: check if disabling buttons is supported 2022-12-23 04:01:09 +03:00
Yaroslav Chvanov
63f8e2c005 ratbagd: fix error handling in ratbagd_button_set_none() 2022-12-23 04:00:13 +03:00
Filipe Laíns
c4cf24308a hidpp20: enable disabling buttons on onboard profiles (0x8100)
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2022-12-23 03:38:19 +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
Peter Hutterer
cdf19a904e libratbag: Fix the action type NONE handling
Add the required hooks which were largely missing, remove a check that was a
copy/paste error and add a test button.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-12-23 03:34:33 +03:00
Peter Hutterer
95243307ce tools: convert our enum equivalents to python enums
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-12-23 03:34:31 +03:00
Yaroslav Chvanov
9c50116646 sinowealth: enable profile cycling mapping with a preprocessor macro
They suck, but we already do have the SINOWEALTH_NUM_PROFILES thing,
let's at least give it all possible capabilities if it is used.
2022-12-23 03:18:13 +03:00
Yaroslav Chvanov
ac86673006 sinowealth: further deduplicate the code of reading config data 2022-12-23 03:18:13 +03:00
Yaroslav Chvanov
5d1b529f4c sinowealth: explain additional profiles and their pit-falls 2022-12-23 03:18:13 +03:00
Yaroslav Chvanov
9bd9446ce2 sinowealth: add support for writing additional profiles 2022-12-23 03:18:11 +03:00
Yaroslav Chvanov
fe73bb34ef sinowealth: add support for button actions in macros 2022-12-23 02:52:00 +03:00
Yaroslav Chvanov
0bdd0e71ba sinowealth: improve error handling
- No more arbitrary error codes, use POSIX error codes.
- Bubble errors up.
- Add strerror() wherever errno is printed.
2022-12-23 02:52:00 +03:00
Yaroslav Chvanov
46711b3624 sinowealth: refactor sinowealth_update_macro_from_action()
Reading it was giving me head-ache. This still doesn't feel perfect but
it's already better.
2022-12-23 02:52:00 +03:00
Yaroslav Chvanov
c48320134e sinowealth: fix a missing new line in logging 2022-12-23 02:52:00 +03:00
Yaroslav Chvanov
0da7cc10b0 sinowealth: add support for reading 2 profiles (if a macro is set)
For what it's worth, all of this may not even belong in libratbag - this
is never going to be shipped to end users, only if someone modifies the
source code. In other words all of this is basically dead code, it's
just me trying to figure out the internal of SinoWealth devices.
2022-12-23 02:52:00 +03:00
Yaroslav Chvanov
4621e1016a sinowealth: deduplicate the code of reading configuration data 2022-12-23 02:52:00 +03:00
Yaroslav Chvanov
da92117973 sinowealth: fix a typo 2022-12-23 02:52:00 +03:00
Yaroslav Chvanov
36af0009bd sinowealth: assert instead of silently ignoring an error 2022-12-23 02:51:59 +03:00
Yaroslav Chvanov
f23f2bfbfb sinowealth: simply return a bool instead of 0 or 1 2022-12-23 02:51:59 +03:00
Yaroslav Chvanov
007fa34c87 sinowealth: make all casts explicit 2022-12-23 02:51:59 +03:00
Yaroslav Chvanov
a018207728 sinowealth: fix some variable types 2022-12-23 02:51:59 +03:00
Yaroslav Chvanov
e18baf6f36 sinowealth: use non-GNU-specific empty array initializer 2022-12-23 02:51:59 +03:00
Yaroslav Chvanov
991cf92594 sinowealth: print a warning if there are too much events in a macro 2022-12-23 02:51:47 +03:00
Yaroslav Chvanov
a493575daa test: add device data tests for the steelseries driver 2022-12-22 03:38:31 +03:00
Yaroslav Chvanov
c7e2e13ee0 test: add device data tests for the asus driver 2022-12-22 03:38:25 +03:00
Yaroslav Chvanov
d6b6b0d12c test: make check_section_driver() a bit more diff-friendly 2022-12-22 03:38:09 +03:00
Yaroslav Chvanov
9450ce18e1 test: increase max DPI in check_dpi_range_str() to 36000
o_O
2022-12-22 03:38:06 +03:00
Yaroslav Chvanov
10f03eaf0e test: fix incorrect character escaping in data-parse-test 2022-12-22 03:04:01 +03:00
Yaroslav Chvanov
8e798c74c9 test: data-parse-test: check all files even if there is an error 2022-12-22 03:03:59 +03:00
Yaroslav Chvanov
c6005b2cb8 test: fix formatting 2022-12-22 02:49:10 +03:00
Yaroslav Chvanov
e2ee8185c2 build: fix data tests not running
This will also help with out-of-tree builds.
2022-12-22 02:22:59 +03:00
Yaroslav Chvanov
be79267f9d test: work-around unsupported Driver section of the sinowealth driver 2022-12-22 02:22:59 +03:00
Yaroslav Chvanov
38d10977b6 test: add wheel to the list of permitted LED types 2022-12-22 02:22:59 +03:00
Yaroslav Chvanov
8a7474b1bd data: fix missing Driver field 2022-12-22 02:22:29 +03:00
Yaroslav Chvanov
1e4c1d73b8 test: add type hints to data-parse-test
This will help us prevent errors like in
41c655090ce9f709db4f7069777741a6b5384d24 in the future.
2022-12-22 02:18:42 +03:00
Yaroslav Chvanov
99bbbfb0b5 test: fix incorrect type of file paths in data-parse-test
Seems like the API of pathlib changed at some point.
2022-12-22 02:18:41 +03:00
Yaroslav Chvanov
0b8f4a25b1 tools: put the list of possible button action types into a const 2022-12-22 00:52:05 +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
Yaroslav Chvanov
3b0ac12cc7 ratbagctl: add an error message if the key supplied to macro is wrong 2022-12-22 00:52:05 +03:00
Kyoken
39b6178d92 fix typo in macro bindings 2022-12-22 00:52:05 +03:00
Kyoken
49b9ad5647 use key name instead of code for binding 2022-12-22 00:52:05 +03:00
Kyoken
434b0537b5 fix ratbag-command key bindings 2022-12-22 00:52:05 +03:00
Kyoken
2eeacc354f implement key bindings feature 2022-12-22 00:51:59 +03:00
Yaroslav Chvanov
8bacfe9ee6 build: bump ratbagd DBus API version 2022-12-22 00:46:03 +03:00
Yaroslav Chvanov
0f39b0f1e9 asus: use ARRAY_FOR_EACH 2022-12-20 04:44:04 +03:00
Yaroslav Chvanov
8c528b2ec0 asus: make pointer variables const wherever possible
Also fixes `ASUS_BUTTON_MAPPING` being duplicated between different
source files if I understand C right.
2022-12-20 04:44:04 +03:00
Yaroslav Chvanov
0656d7896c libratbag-data: fix formatting 2022-12-20 04:44:03 +03:00
Peter Oliver
4319466aed Adjust offered resolutions for SteelSeries Kinzu V3
Fixes #1386.
2022-12-19 20:02:29 +00:00
TCH
d3c62a0d67 data: add Logitech MX Master 3S 2022-12-12 08:40:27 +10:00
Kyoken
67ab803657 asus: pugio button mapping 2022-12-09 10:01:21 +03:00
Kyoken
4187aa4123 asus: allow empty cells in bindings table and fix pugio button bindings 2022-12-07 23:32:03 +03:00
lennie420
919cde2b15 Logitech G303 Shroud Edition device file
Adds basic support for Logitech G303 Shroud Edition
2022-11-26 00:55:05 +03:00
Kyoken
f9286536f8 asus: fix button mapping type 2022-11-26 00:46:37 +03:00
Kyoken
0cf97d40af asus: handle undefined buttons 2022-11-26 00:46:37 +03:00
Kyoken
b93900bd91 asus: rename params 2022-11-26 00:46:37 +03:00
Red_M
6476cd000a Fix spatha x device file. 2022-11-26 00:46:37 +03:00
Kyoken
e628b50abf asus: add spatha x 2022-11-26 00:46:37 +03:00
Kyoken
3e5ac899ae asus: fix building errors 2022-11-26 00:46:37 +03:00
Kyoken
041a8023b8 asus: button mapping reworked 2022-11-26 00:46:32 +03:00
Kyoken
e9470ff6f4 asus: add strix impact 2 2022-11-18 11:52:22 +00:00
Yaroslav Chvanov
e26eac95db sinowealth: remove now unused button_set_key_action_from_macro
I first thought that we could use try to use this instead of
full-fledged macros when possible, but the implementation then is going
to look quite messy, so let's just delete this.
2022-11-18 11:52:07 +00:00
Yaroslav Chvanov
d2586a2344 sinowealth: do an assert instead of graceful internal bug handling 2022-11-18 11:52:07 +00:00
Yaroslav Chvanov
dd609c06a9 sinowealth: fix writing of key button action type
It did not work *ever* as the helper function was only called when
action type was `key` but the function checked if it was a `macro`.
2022-11-18 11:52:07 +00:00
Yaroslav Chvanov
925b2a2a0a libratbag 0.17 2022-11-09 10:43:27 +00:00
Yaroslav Chvanov
df42eeb1ca CI: update runners to use Node 16
Fixes warnings.
2022-11-09 10:43:05 +00:00
Yaroslav Chvanov
aab91b4b11 data: add another SinoWealth Generic Mouse (258a:0029) 2022-11-09 10:42:34 +00:00
Yaroslav Chvanov
c39640d943 asus: fix include order
It caused an `implicit function declaration` warning.
2022-10-12 22:16:19 +03:00
Kyoken
0c3cfe71a0 asus: remove extern 2022-10-12 21:20:30 +03:00
Kyoken
dcba13152f asus driver 2022-10-12 18:11:28 +03:00
Andreas Grosse
61da98ffd4 Add Support for G502 X over USB 2022-10-10 21:39:53 +02:00
PeakKS
98eec0941a Add support for G502 X Wireless 2022-09-11 19:21:27 -04:00
Yaroslav Chvanov
d8301414c7 libratbag-data: add a missing include
To fix `Declaration of X will not be visible outside of this function`
Clang warnings.
2022-08-02 12:12:42 +03:00
Yaroslav Chvanov
a4da425298 sinowealth: move device-specific data out of the driver
This moves device data out of the driver into device files. However, a
_single_ device file contains data for _several mice_ at the same time.
The reason for this is that different mice by SinoWealth may use the
same VID:PID pair. This is unfortunate, as we only allow a single
device file a given VID:PID pair.

Also move `sinowealth_led_format` enum into a header file and rename
its constants to fit in outside of the driver.
2022-08-02 12:12:42 +03:00
Yaroslav Chvanov
ea7b4b6821 sinowealth: null-terminate the buffer with firmware version 2022-08-02 12:12:42 +03:00
Yaroslav Chvanov
833468b292 sinowealth: use a constant instead of a magic number 2022-08-02 12:12:39 +03:00
Yaroslav Chvanov
cc954af7a7 steelseries: ensure that device has a version number set
Otherwise there would be hard to diagnose errors later on.
2022-08-01 07:55:40 +00:00
Yaroslav Chvanov
213ccce0a8 steelseries: add fallback button and LED count
Otherwise if there is a device file without them set, will try to create
UINT_MAX-1 instances of them and obviously fail with an out-of-memory
error.
2022-08-01 07:55:40 +00:00
Linus
bb6ab46a1a Fix presumed typo 2022-08-01 09:27:27 +10:00
listout
05c5815fb9 Use fprintf instead of error
hidpp files were using the error function from error.h header file.
Unfortunately not every libc comes with this particular header file, so
with this patch we won't be requiring to be rely on error function and
use fprintf function.

Thanks to developer Yaroslav Chvanov <staticssleever668> for the
original suggestion

Closes: https://github.com/libratbag/libratbag/issues/1253

Signed-off-by: listout <listout@protonmail.com>
2022-07-29 14:22:05 +00:00
Thomas Weißschuh
0fc6764b47 libratbag-data: fix possible NULL dereferences
This can happen when a device has not properly initialized and this
fields have not been set.
2022-07-21 09:09:04 +00:00
Peter Hutterer
07b40316fb test: add the Bolt receiver C548 to the receiver list
Listed here: https://pwr-solaar.github.io/Solaar/devices.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-06-08 12:23:44 +10:00
Sami Olmari
260e4adffc Add device-file for Logitech MX Anywhere 3B (#1313)
This variant stands for Logitech MX Anywhere 3 for Business.

Bluetooth match only, the receiver is not yet supported by the 
kernel and the device thus has the receiver's USB id

Signed-off-by: Sami Olmari <sami@olmari.fi>
2022-06-07 10:08:16 +10:00
Ilya Guterman
8c3c6598c3 hidpp20: verbose log the get current profile 2022-06-06 17:20:42 +03:00
Yaroslav Chvanov
1140875cd8 sinowealth: fix all devices being detected as generic device 2022-06-06 20:13:19 +10:00
Yaroslav Chvanov
f87bccb370 sinowealth: add data for Marvo Scorpion G961
I did not add the data entry for ratbagd though, as there has been
reported breakage with Ant Esports GM500, which uses the same VID:PID.
2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
c1955598fe sinowealth: note that debounce time command doesn't work on shorter mice 2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
d261458cae sinowealth: limit the resolution to sensor's upper bound 2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
ef3822af82 sinowealth: fix crashing on mice with unknown sensors 2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
2d8115d2bf sinowealth: detect sensor type automatically 2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
4c102358a2 sinowealth: make device detection less imperative
..and rename sensor types along the way:
- Prefix them;
- Fix PMW sensors being named PWM.
2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
d133d30f62 sinowealth: add numeric IDs to sensor types
These IDs match the ones in SinoWealth's configuration software.
2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
16a1028e1d sinowealth: add sensor type field to configuration data 2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
704d5d2e65 sinowealth: decrease minimal configuration size
Configuration size on 1007 mice is smaller for sure. With these changes
the driver has been reported to successfully work with Marvo Scorpion
G961.
2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
bef26c1890 sinowealth: make dpi_to_raw return 8 bit number
It would otherwise get converted implicitly anyway.
2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
85241fdd1b sinowealth: handle RGB_NOT_SUPPORTED explicitly
This should technically be unreachable but this is good for code
quality.
2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
2dea887d2f sinowealth: prefix a function name 2022-06-06 07:54:17 +00:00
Yaroslav Chvanov
2004a3c13e sinowealth: fix a typo 2022-06-06 07:54:17 +00:00
Ilya Guterman
48bccf4c98 hidpp20: fetch active profile index only once
currently the active profile index is fetched for each profile,
this adds unnecessary overhead.

change the behavior to fetch the active profile only once during the driver data initialization.
2022-06-06 15:11:02 +10:00
Andreas Schwab
3ea0d44176 meson.build: use valgrind only if available 2022-05-06 15:33:46 +01:00
Ilya Guterman
3e1bc79aac hidpp20: fix set onboard mode 2022-04-29 01:03:45 +03:00
Yaroslav Chvanov
9715c5c150 libratbag-data: fix a memory leak
In driver data of hidpp10 and steelseries drivers `dpi_list` and
`dpi_range` were allocated with calloc, but never got freed.
2022-04-27 22:16:32 +03:00
Yaroslav Chvanov
07f0eafa57 sinowealth: add support for writing macros 2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
72f8708e0e sinowealth: add support for writing key button actions 2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
6ac5ba6dbb sinowealth: add support for changing button mappings 2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
45a8fd9ec3 sinowealth: add support for reading button bindings 2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
e9dff40258 sinowealth: add types for buttons
This button mapping reading and writing support is partially based on a
previous work of @phomes and @enkore. Thank you both very much!
2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
94f28df134 sinowealth: set button count from detected device 2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
4d646db24f sinowealth: fix rave lighting mode settings being shifted by one byte
Turns out I missed a field a bit lower and made an `unknown` section
bigger to compensate for that.
2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
e21366e5e5 sinowealth: mark color order on Genesis Xenon 770 as tested 2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
21ac98e5f9 sinowealth: fix DPI being off by 100 on PWM3327 sensor
Thanks @hrw for testing.
2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
567d666b96 sinowealth: use a union instead of doing pointer arithmetic on DPI slots
This makes the code a bit more self-explaining and less error-prone as
we don't have to think about memory addresses when modifying DPI.
Also fixes several `bugprone-implicit-widening-of-multiplication-result`
clang-tidy warnings.
2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
b62565da56 sinowealth: fix breathing LED mode on 0027 mice 2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
3ff3705dbf sinowealth: add partial support for reading BREATHING7 lighting mode
Only partial as libratbag can only have 1 color in breathing lighting
mode.
2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
2aa9f012fe sinowealth: fix active resolution slot reading and writing
It turns out the field with active resolution only counts active
resolution slots. This was probably missed before because probably no
one sets for instance slots 1 and 3 but disables slot 2. I already added
a comment explaining this behavior before because I noticed this while
trying to implement this in ratbag-python and be surprised it didn't
work, but I didn't notice that the implementation here was lacking.
2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
e7cc62a9c8 sinowealth: return an error code instead of doing an assert
While I doubt it will actually ever get hit, there is no reason to crash
the whole daemon because of this.
2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
0608a0156d sinowealth: don't redundantly unreference a profile
Not needed anymore as a `for_each` macro is now used to get profiles.
2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
3723c5177f sinowealth: add command ID for putting the device into DFU mode
This is not right now and will never be actually used, I put it here
just for the sake of completeness.
2022-04-21 00:37:44 +03:00
Yaroslav Chvanov
9d59c1992a libratbag: remove now unused deprecated driver methods 2022-04-16 02:24:40 +03:00
Yaroslav Chvanov
ee54001032 roccat-kone-pure: migrate to profile-oriented API 2022-04-16 02:24:40 +03:00
Yaroslav Chvanov
7f0d058b66 roccat: migrate to profile-oriented API 2022-04-16 02:24:40 +03:00
Yaroslav Chvanov
cd2ad37db7 etekcity: only write profile once 2022-04-16 02:24:40 +03:00
Yaroslav Chvanov
d08f1f21b7 etekcity: migrate to profile-oriented API 2022-04-16 02:24:40 +03:00
Yaroslav Chvanov
2d21c0dac1 test: migrate to profile-oriented API 2022-04-16 02:24:40 +03:00
Peter Hutterer
7016b50f1b roccat: remove an unnecessary #include
No obvious reason why we need to include that header and it appears to
be glibc-specific. Let's use stdint.h instead (which is already
included).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-15 11:32:17 +10:00
Yaroslav Chvanov
217847adde steelseries: only write report rate if it's dirty 2022-02-11 14:32:14 +10:00
Yaroslav Chvanov
c12edcd4c7 steelseries: fix length of LED cycle output report being incorrect
It probably meant to use the macro directly, not `sizeof` of it (which
made it be 4 instead of 64).
2022-02-11 14:31:37 +10:00
Rafael Silva
ae53f6123b ibratbag-hidraw: add optional filter to hidraw read
Currently, these functions will read and timeout after 1s if
no packets were received. The issue with this is that a lot of times we
may catch unrelated packets, such as mouse or keyboard changes.
To solve this, this patch adds a new optional filter argument, when a filter
is passed the functions now will keep reading packets until a valid packet is found.
The filter argument is user written function that returns true or false.

Co-authored-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Rafael Silva <perigoso@riseup.net>
2022-02-04 14:27:08 +10:00
Yaroslav Chvanov
6dbaeaf506 steelseries: fix a memory leak
Found by valgrind. I also feel that there is another memory leak of the
same nature a bit higher in `init_data_hidpp10`.

Introduced by me. :^)
2022-02-01 07:30:01 +10:00
Yaroslav Chvanov
75c8cf83c3 sinowealth: fix several misspellings 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
706fe34382 sinowealth: explain how active_dpi works 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
5e57aa07ea sinowealth: add helpers for doing raw HID queries
Removes a lot of duplicated code.
There is one place, however, where these helpers were not used -
`sinowealth_read_raw_config`. It has some custom handling of data
because of unexpected behavior from mice.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
1f4bf8fe5f sinowealth: rename a struct member to show that it's bit field 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
dadfb06b98 sinowealth: put command buffer size into a macro 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
d3c37a6836 sinowealth: fix two struct fields having swapped places 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
1b04bcffba sinowealth: visually separate config report data specific to long mice 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
e5093e1009 sinowealth: prefix some of our data type names 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
132fc21212 sinowealth: sanity check output of all raw data getters
Well, of almost all, config getter's output is not checked as it may
have seemingly incorrect data in some cases.

Potentially some mice may not support some commands but look like they
do. You can see this guard in action if you run
`sinowealth_print_long_lod_and_anglesnapping` after any other command
that sets 6 byte long buffer on non-long mice.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
3793e32ebd sinowealth: put a macro into an enum 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
4e931cb712 sinowealth: remove a now unused macro 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
e1682171ce sinowealth: improve comments
- Add comments to almost all functions.
- Add comments to some data types and macros.
- Add missing periods where it's needed.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
e1334214b8 sinowealth: make the sensor maximum DPI getter return 0 on error 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
fd0954dbdc sinowealth: remove new-lines between data types and their size checks 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
aa1ab47f59 sinowealth: make update_profile_from_config a void function
It only ever returned `0`.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
7585d73ff5 sinowealth: rename macros with config size to make more sense 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
81ca281f2c sinowealth: don't mark inactive profile as active 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
48d654827e sinowealth: cache current profile index in driver data 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
6c9306b199 sinowealth: store config report in an array 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
a9c0060029 sinowealth: add a macro for profile count 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
a289612d85 sinowealth: initialize all variables
While none of them were actually used before being initialized, I got
tired of constantly seeing `uninitialized variable` warnings in my
editor.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
f7b7007897 sinowealth: declare a variable right before it's initialization
It's not in the beginning of the function anyway, so why not make it a
bit more concise.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
16333068b7 sinowealth: use for_each instead of manually getting profiles 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
eace92870a sinowealth: set the command before writing config
This will help if the config report has a different command in it for
some reason. This has happened to me when I tried using the second
profile.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
c176825051 sinowealth: use uint8_t instead of char for report IDs
Also move one of them up, this may make the function a bit more readable
if we ever decide to support the second mouse profile.

Fixes a clang-tidy warning.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
ba3547457c sinowealth: split commit into raw data update and raw write helpers
This will get handy if we decide to add multiple profile support.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
3f936eff68 data: add another name to Glorious Model O - O- 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
c25864c18a data: add SinoWealth Generic Mouse (258a:0027) 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
cf64aac5f1 sinowealth: set the RGB effect to unsupported if LED type is not defined 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
0a39552a65 sinowealth: add default sensor type and LED type 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
03d2d71f82 sinowealth: don't enable LED support if LED type is not defined 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
1edb6df25b sinowealth: define set_active_profile method in the driver 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
9c7494c5c0 sinowealth: select first profile before getting any data from the mouse 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
7f29c0423f sinowealth: add active profile setter 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
07307b85d3 sinowealth: add commands IDs for the second profile 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
219218118d sinowealth: print LOD and angle snapping value 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
1e2489c9e7 sinowealth: add LOD and angle snapping value getter
LOD - lift-off distance.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
479c4352af sinowealth: print debounce time 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
763655516c sinowealth: add debounce time getter 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
944c4f0af5 sinowealth: print profile index 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
268ccab111 sinowealth: add profile index getter
Thank you so much, @araghon007!
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
603b0ca1fc sinowealth: use RGB or RBG colors depending on device 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
4e50c506de sinowealth: format code 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
4351eb3d72 sinowealth: support different sensors 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
9f4a1ba405 sinowealth: print device model based on firmware version
sinowealth: detect Glorious Model O with old firmware
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
451894b1b4 sinowealth: make the firmware version printing helper return it instead 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
c6051cb9ea sinowealth: handle new RGB effects 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
34fafbc0f8 sinowealth: use enum types in config report directly
Although I'm not sure this if this would work on every compiler, having
a bit of extra type safety is always nice.
It does work with GCC and Clang at the very least.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
75d075cc67 sinowealth: make some utility functions take unsigned integers
To avoid implicit conversions.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
2f330b6466 sinowealth: use a struct to store lighting mode 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
c7adc9b9f6 sinowealth: print config data size 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
16a7b6ed18 sinowealth: use NULL instead of 0 for pointers 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
7ff73c8515 sinowealth: rename a config entry to make more sense 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
f11e31d671 sinowealth: add some hidden lighting types
These are not available in Glorious software.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
f69457c280 sinowealth: add breathing_mode to config report 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
756fee1202 sinowealth: sort values in an enum 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
d4126463e4 sinowealth: don't say that amount of breathing colors is constant
Based on information in gloryctl's documentation, it's not. I guess it
was marked as such because Glorious software doesn't allow to change it.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
00832cb9f0 sinowealth: add a lift off distance value to config report 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
866d4e6433 sinowealth: put some macros into enums 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
cbba00f997 sinowealth: use a map to convert report rates 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
d2e4fcc23e sinowealth: put report rate conversion comparison in order
And also not use some random number in the comparison.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
f0c66d0e1f sinowealth: separate config to real config and report_rate nibbles 2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
b2fb91e261 sinowealth: use correct bits for report rate
Turns out it takes the whole nibble, not just three bits.
2022-02-01 07:20:28 +10:00
Yaroslav Chvanov
1a64d2b85d Add a TODO to make ratbag_button_action_match support macro actions 2022-02-01 07:11:43 +10:00
Yaroslav Chvanov
8f5fdf8590 Fix ratbag_button_action_match not matching on type NONE 2022-02-01 07:11:43 +10:00
Yaroslav Chvanov
baad36060d util: fix a string of text being printed out of nowhere 2022-02-01 07:06:38 +10:00
Yaroslav Chvanov
7ecabea70d sinowealth: remove a redundant comment 2022-01-28 10:31:09 +10:00
Yaroslav Chvanov
c0c8d6c544 sinowealth: increase log level of printed firmware version 2022-01-28 10:31:09 +10:00
Yaroslav Chvanov
37587bb99c sinowealth: fix a memory leak
We were getting profiles, but never unreferenced them afterwards.
2022-01-28 10:31:09 +10:00
Yaroslav Chvanov
cc2fff9c06 sinowealth: rename some functions to be more clear
So that they would match button data reading later on.
2022-01-28 10:31:09 +10:00
Yaroslav Chvanov
b80d3ac0a3 sinowealth: use the detected LED count
I put this in a separate commit as 99% of this is just a change of
indentation levels, which doesn't look nice in git.
2022-01-28 10:31:09 +10:00
Yaroslav Chvanov
a757180d60 sinowealth: detect LED count at run-time 2022-01-28 10:31:09 +10:00
Yaroslav Chvanov
8c0124d654 sinowealth: move raw data reading from init function to probe function 2022-01-28 10:31:09 +10:00
Yaroslav Chvanov
b5d41e3657 sinowealth: put reading of raw configuration data into a helper 2022-01-28 10:31:09 +10:00
Yaroslav Chvanov
bfd2fc9969 sinowealth: print firmware version on profile init, not on reading 2022-01-28 10:31:09 +10:00
Yaroslav Chvanov
566d160de3 sinowealth: make init_profile return error codes 2022-01-28 10:31:09 +10:00
Kyoken
e0dc0a3a5b fix ratbag-command led setting 2022-01-24 12:55:12 +10:00
Peter Hutterer
5b7af0ec14 CI: actually test with the various meson args
Different variable names and no-one noticed.

This means we need to add a few dependencies that weren't needed before.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-01-22 12:09:34 +10:00
Peter Hutterer
44a9959344 roccat: name two fields correctly
In hindsight, these should've been obvious.
2022-01-20 19:32:14 +00:00
Peter Hutterer
755dbddfb3 meson.build: fix spelling of receiver 2022-01-20 15:47:11 +10:00
Peter Hutterer
1e3a85433a CI: add a github pages job to the CI
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-12-15 14:40:56 +10:00
Peter Hutterer
b3b3e3f838 Drop CircleCI
Right now, CircleCI fails with ssh errors because for some reason it
wants to clone the repo over ssh, not https. This is probably fixable
but CircleCI now limits how many runs we can do per month anyway so it's
borderline useless if we do actual developement.

Having to re-learn the Circle CI syntax to fix the current issue is not
an efficient use of our time, so let's just drop this completely, git
will keep the history of what we used to do in the CI for us.

02f3487f52 added a github workflow which
is comparatively incomplete but could be extended to do the previous
test runs. That's a more future-proof path anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-12-15 14:40:56 +10:00
Peter Hutterer
f05b671dc1 Install all data files as subdir
This removes the need of listing every device in meson.build which is a
common enough mistake for new contributors.

And move the validation tests over to test/ so we don't have to list
them in the exclude_files of the install_subdir() command.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-12-13 10:39:42 +10:00
Peter Hutterer
bfadfc3c91 Change the data validation tests to take the directory instead of files
Instead of passing a million files, let's pass the directory and do a
pathlib glob instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-12-13 10:39:42 +10:00
Peter Hutterer
96d93ae387 meson.build: require meson 0.50.0
Released March 2019 we've already relied on some of its features anyway,
let's get rid of the warnings.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-12-13 10:38:59 +10:00
Peter Hutterer
03891189da hidpp20: add missing #define to the feature report strings (#1237)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-12-06 08:46:40 +10:00
Peter Hutterer
02f3487f52 Add a GitHub Workflow as CI run (#1238)
CircleCI is limiting how many runs we can do, which results in pipelines
randomly failing when we've used up the credits for this month.

Let's add a github workflow instead. Unfortunately github workflows are
a bit of a toy api, no support for YAML anchors or extending other jobs,
so there's a lot of duplication needed to get a job to do something.

The actions added in this patch help a bit to make the jobs easier to
understand (copied from libwacom).

This only runs on Ubuntu right now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-12-06 08:43:14 +10:00
Ilya guterman
d2f1ff0ca2 tests: test for additonal lightspeed receviers pids
PR #1225
2021-11-06 16:53:01 +00:00
Rafael Silva
d5a7ad3730 device: g635: Set buttons as 0 2021-11-06 03:27:32 +02:00
Carlos Mogas da Silva
e98f86fa2a Add Logitech G635 Headset 2021-11-06 03:27:32 +02:00
Rafael Silva
fb14cb576b README: add uninstall instruction 2021-11-04 09:35:30 +00:00
Ilya Guterman
2c83f9c3ef add static assert 2021-11-04 03:36:41 +02:00
Ilya Guterman
b71f439ed6 fix ci failures 2021-11-04 03:36:41 +02:00
Ilya Guterman
dff102be43 steelseries: prefix hidraw writes with 0 2021-11-04 03:36:41 +02:00
mtayllan
6bb92dc313 Set buttons as 0 for logitech g733 2021-11-01 08:25:03 +02:00
mtayllan
92c5923255 Add support to Logitech G733 2021-11-01 08:25:03 +02:00
staticssleever668
6c8a2d36fe sinowealth: use proper config size when writing 2021-10-26 11:57:53 +03:00
staticssleever668
875aae6985 sinowealth: add support for mice with longer configuration data 2021-10-26 11:57:53 +03:00
Ilya Guterman
a55297e0fa fix button count and default report rate always zero 2021-10-20 11:29:55 +03:00
staticssleever668
fa95abbc33 hidpp20: give some structures names
Fixes SWIG's 503 warnings.
2021-10-16 22:43:37 +03:00
staticssleever668
48d1b21036 driver-hidpp20: cast an internal log priority enumeration to the general one
Fixes an 'enum-conversion' warning by clang.
2021-10-16 22:43:37 +03:00
staticssleever668
904aedc555 driver-hidpp10: cast an internal log priority enumeration to the general one
Fixes an 'enum-conversion' warning by clang.
2021-10-16 22:43:37 +03:00
staticssleever668
4fa8663cfb driver-hidpp10: remove a redundant character array null check
It is never null. Fixes a 'pointer-bool-conversion' warning by clang.
2021-10-16 22:43:37 +03:00
staticssleever668
58086882a3 ratbagd: initialize a variable
Fixes a 'sometimes-uninitialized' warning by clang.
2021-10-16 22:43:37 +03:00
Tayllan
aef92645b7 hidpp20: allow setting a default buttons count
PR #1212
2021-10-16 20:08:44 +01:00
staticssleever668
514ce5419f data: add SteelSeries Rival 100/105 2021-10-16 19:31:11 +01:00
staticssleever668
2a0a3cf203 steelseries: add support for changing LEDs on Rival 100 2021-10-16 19:31:11 +01:00
staticssleever668
f96ba13f07 libratbag-data: add 'Rival100' quirk to SteelSeries driver 2021-10-16 19:31:11 +01:00
staticssleever668
724d31c8fe steelseries: make settings unique to SteelSeries Sensei RAW a quirk 2021-10-16 19:31:11 +01:00
staticssleever668
66e44d76b9 steelseries: add 'Quirk' setting 2021-10-16 19:31:11 +01:00
Filipe Laíns
e908871e82 hidpp20: allow setting a default report rate (#969)
In case we can't get the report rate value from the device, allow
setting in the device file.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2021-10-11 02:14:02 +03:00
Kristian Klausen
9732aa009e steelseries: only use the HID vendor device
Rival mice are composite devices with multiple HID devices and only the
HID vendor device can be used to configure the device.

Tested with a SteelSeries Rival 300 (1038:1710).

Fix #888
2021-10-10 21:10:20 +01:00
Ilya guterman
92299d4673 data: support steelseries rival variations
PR #1209
2021-10-10 18:51:35 +01:00
LittleWhite-tb
5c3df3b218 Support for Roccat Kone EMP (#1131) 2021-10-07 16:00:36 +10:00
Filipe Laíns
62f26e797e Revert "data: Add (old) Logitech Performance Mouse MX"
This reverts commit d47f2ed946.

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-07-24 22:25:38 +01:00
Filipe Laíns
d460743bd7 Revert "data: add additional identifier for MX Anywhere 2"
This reverts commit 2ce254e51b.

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-07-24 22:25:25 +01:00
strangemax
d47f2ed946 data: Add (old) Logitech Performance Mouse MX
PR #1146
2021-07-24 22:19:17 +01:00
João Ferreira
2ce254e51b data: add additional identifier for MX Anywhere 2
PR #1155
2021-07-24 22:18:19 +01: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
staticssleever668
37ae638a7c steelseries: improve v1 LED breathing duration configuration
SteelSeries mice using V1 driver don't support changing LED breathing
duration precisely, so it was always locked on 5 seconds. Now we try to
match desired duration with factory preset values: 3, 5 and 7 seconds.
2021-07-24 22:05:49 +01:00
staticssleever668
6a071dc1ee sinowealth: expose all eight resolution slots
It was limited to six because Glorious' software exposes only so many of
them, but SinoWealth mice firmware allows up to eight.
2021-07-24 22:05:16 +01:00
staticssleever668
7c9a75da9e sinowealth: add support for changing report rate 2021-07-24 22:04:55 +01:00
staticssleever668
dd1c72a1d0 sinowealth: add support for reading current report rate 2021-07-24 22:04:55 +01:00
staticssleever668
8d7cbcba4f steelseries: fix report rate changing for version 1 devices
Judging by rivalcfg's data for Sensei Raw, Rival 100, Rival (300) and Kinzu v2 (all are version 1 devices in our data), it should have been like that from the beginning.
Confirmed on Rival 100.
2021-07-24 22:04:14 +01:00
staticssleever668
4075227eb7 sinowealth: add support for changing active resolution number 2021-07-24 22:03:44 +01:00
Stephan Lachnit
abcec1d349 Register Roccat Kone Pure driver
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2021-07-24 21:25:56 +01:00
Stephen Kitt
206bc5996d man: add both variants in ratbagctl.1 synopsis
PR #1188
2021-06-30 19:23:30 +01:00
Stephen Kitt
366f19abdd openinput: fix "Unknown" typo
PR #1187
2021-06-30 19:21:47 +01:00
Filipe Laíns
952bd9dc07 libratbag 0.16
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-06-24 15:11:34 +01:00
staticssleever668
6b97d94a2f sinowealth: print out firmware version when probing 2021-06-23 15:40:38 +00: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
Elián Hanisch
abe451df33 sinowealth-nubwo: fix implicit declaration of function ‘vasprintf’
driver-sinowealth-nubwo.c was missing to include "config.h" so
_GNU_SOURCE wasn't defined soon enough.

Co-authored-by: Elián Hanisch <elian.hanisch@ing.unlp.edu.ar>
2021-04-29 01:38:03 +01:00
Sethox
a3fa876c3d data: add SEL variant to Roccat Kone Pure
The last part added is for a variant called "Roccat Kone Pure SEL".

PR #1152
2021-04-21 03:45:25 +01:00
Filipe Laíns
230647c7f3 openinput: fail probe if we can't enumerate
These functions are mandatory[1], fail to probe if they fail.

[1] https://github.com/openinput-fw/openinput-protocol/tree/master/specification/device-protocol#mandatory-functions

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-04-04 15:08:21 +01:00
Filipe Laíns
3f99446a1b ci: temporarily disable arch
See my description of the problem in [1].
Essentially, docker is mishandling the failuire when a syscall is not
available, returning EPERM instead of ENOSYS, and making code misbehave.
The current issue with arch is glibc, which explodes on EPERM, causing
pacman to misbehave.

Once the fix hits CircleCI, we will re-enable.

[1] https://github.com/fwupd/fwupd/issues/2894

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-03-01 10:34:10 +10:00
Filip Laurentiu
a766f8e909 data: add new identifier for DeviceMatch to match MX Anywhere2 mouse
PR #1137
2021-02-28 19:02:52 +00:00
Pavel Kovar
9ae975f9a9 data: add support for Logitech M500s mouse 2021-02-17 17:53:27 +00:00
Filipe Laíns
780934b1a1 data: add openinput device
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-02-16 00:15:59 +00:00
Filipe Laíns
337fb935c4 openinput: refactor function discovery
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-02-16 00:15:59 +00:00
Filipe Laíns
c9cf5fe90c openinput: add function discovery
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-02-16 00:15:59 +00:00
Filipe Laíns
18af0f97d2 openinput: print device protocol name
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-02-16 00:15:59 +00:00
Filipe Laíns
286f13c654 openinput: read firmware information
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-02-16 00:15:59 +00:00
Filipe Laíns
c6b9cc0c2a openinput: add error support
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-02-16 00:15:59 +00:00
Filipe Laíns
7d82bb51a6 openinput: save protocol version
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-02-16 00:15:59 +00:00
Filipe Laíns
8976033da7 openinput: add openinput_send_report
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-02-16 00:15:59 +00:00
Filipe Laíns
c9c6a1675f openinput: add barebones driver
This is the minimal code required to have a working driver, now we just
need a .device file.

Note the hardcoding of `profile->is_active = true` in
openinput_read_profile, this works because we just have one profile.

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-02-16 00:15:59 +00:00
the Weld
f1e2a4ccff data: add extra USB device ID for MX Vertical
Fixes #1132, for my own model of MX Vertical at the least.
2021-02-15 20:00:34 +00:00
Filipe Laíns
104543fdf1 data: add G Pro X Wireless Superlight
Support for this receiver, and for the device using the powerplay
receiver, still needs to be added to the kernel driver. For now, you can
used the wired connection to configure the device.

You should also not try to use with the powerplay receiver as the kernel
driver does not support the connection and won't forward any input
events to userspace.

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-01-30 10:59:37 +00:00
Matt
b3275e10d7 data: add Logitech M545 2020-12-30 17:43:52 +00:00
Filipe Laíns
120908bda8 data: add G915 TKL
Closes #1008

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-10-22 20:20:04 +01:00
Filipe Laíns
32d6443553 data: add an ID to the MX Anywhere 2
Fixes #1078

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-10-17 18:22:54 +01:00
Calvin Walton
ae943eaee7 data: Add configuration for SteelSeries Kinzu V2 Pro Edition
Appears to be basically the same as the V2 - the differences were
mostly in hardware (upgraded switches & image sensor). I've verified
that the list of DPI settings is correct and matches the Windows
software. Adjusting DPI config in both profiles works correctly.
2020-10-15 01:50:44 +01:00
Calvin Walton
4a9503f2da data: add device IDs for Logitech MX Anywhere 3 2020-10-14 21:57:19 +01:00
Filipe Laíns
e268100d31 libratbag-data: log message if the device is a Logitech receiver
We have been receiving countless issues and PRs reporting or "fixing"
the device IDs because they think it's wrong. Hopefully this will give
them an hint that is intended behavior. If they look closely at the log,
on a recent enough kernel, they should see their device show up with the
internal ID.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-10-09 17:37:44 +01:00
Filipe Laíns
8ec0e8bbc5 Revert "meson: bump required meson version"
This reverts commit e753db72f9.

The new version is too recent for lgtm.com.
See https://lgtm.com/projects/g/libratbag/libratbag/logs/rev/pr-c8dd47f8b4d0c40fc0a27b13e031bbb8e6c76987/lang:cpp/stage:Build%20merge_7b2f50275451a899db1bf70b6eaae9d88ecc56d0

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-10-08 01:46:03 +01:00
bluemner
e6a9fba498 Update add support for G-Shift keys on g600 2020-10-05 00:44:27 +01:00
Thomas H.P. Andersen
e753db72f9 meson: bump required meson version
Bump the required meson version to match the features that we make
use of.

We now also make use of the 'copy:' keyword in configure_file that
is available in version 0.47.
2020-10-05 00:39:43 +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
Thomas H.P. Andersen
8f981c8b87 circleci: bump to fedora 32
Bump to fedora 32 to updated meson version
2020-09-29 02:08:17 +01:00
Thomas H.P. Andersen
01d2cf8477 sinowealth: silence warning 2020-09-29 01:07:12 +02:00
Filipe Laíns
f7c22ed88c libratbag 0.15
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-09-25 21:38:01 +01:00
Thomas H.P. Andersen
aeda65cbfa sinowealth: remove per-resolution led
The glorious mice uses a single profile. To differentiate between
resolutions each one has customizable color. A led on the bottom
of the mouse shows the active resolution color.

Libratbag does not support a per-resolution color.

To allow adjusting these colors the sinowealth driver defines a led
for each resolution. This is a misuse of the model and will cause
problems when the mouse is added to Piper.

This patch removes the per-resolution leds and hardcodes the led
count to one.
2020-09-25 20:51:45 +01:00
Pipat Saengow
ed2439e5e2 sinowealthnubwo: more reasonable default and refactor 2020-09-21 17:39:28 +02:00
Pipat Saengow
f407521e8f Add driver for Nubwo X7 Spectrum
Nubwo X7 Spectrum is a sinowealth-based gaming mouse.
The sinowealth-nubwo driver included in this commit provides

- LED support (except color mode that are not available in libratbag)
- DPI and reporting support
- NO button mapping/macros support
2020-09-21 17:39:28 +02:00
heimer16
3c4fe23f70 data: update Logitech g9x (#913)
* add LED for Logitech g9x
* update min dpi range and step for Logitech g9x

Co-authored-by: Erin Heimer <heimer16@gmail.com>
2020-09-11 22:28:57 +02:00
Mike Crowe
9e2ac55dbc libratbag-private.h: Ensure that _GNU_SOURCE is defined early enough
When compiling on Ubuntu 20.04 with GCC 9.3.0 and glibc 2.31, I get:

In file included from ../src/libratbag-private.h:32,
                 from ../src/driver-sinowealth.c:24:
../src/libratbag-util.h: In function ‘asprintf_safe’:
../src/libratbag-util.h:154:7: warning: implicit declaration of function ‘vasprintf’; did you mean ‘vsprintf’? [-Wimplicit-function-declaration]
  154 |  rc = vasprintf(&result, fmt, args);
      |       ^~~~~~~~~
      |       vsprintf

This appears to be because <features.h> is being included by another
header before config.h has been included. If _GNU_SOURCE has not been
defined at that point, then the other macros that control whether
vasprintf is declared are not set correctly.

Include config.h right at the top of libratbag-private.h to ensure
that _GNU_SOURCE is defined before any system headers are included to
avoid this problem.
2020-08-30 19:16:51 +02:00
Nguyễn Chính Hữu
1e72ebaa7b data: add the G203 name to the .device file 2020-08-29 22:23:35 +01:00
peelz
920bc2b993 driver-hidpp10: fix segfault when committing unnamed profiles 2020-08-23 16:21:05 +01:00
TurkeyTheGobbler
20b573668e g300: use the correct step size 2020-07-25 17:26:37 +01:00
Daniel Lehmann
49acc11db3 Fix enumeration of Logitech G5 (2007)
Before this patch, ratbagd would abort initialization of the device because
no profiles are returned.

Once that was handled more gracefully, ratbagd would fail because it doesn't
read the DpiList from its own config file, as no ProfileType is specified.
Specifying G500 as the closest match.
2020-07-23 01:04:14 +01:00
Stephan Lachnit
364e3fd965 data: add additional USB-ID for the M720 Thriatlon
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-07-23 01:00:33 +01:00
Marian Beermann
bb230d390d sinowealth: fix reading RGB brightness from device 2020-07-23 00:45:29 +01:00
Marian Beermann
93a076bed9 sinowealth: code style changes 2020-07-23 00:45:29 +01:00
Marian Beermann
e7b50c9061 sinowealth: rewrite RGB LED mode conversions 2020-07-23 00:45:29 +01:00
Marian Beermann
9d533bdc3e sinowealth: fix dpi_count not being updated
The firmware of these mice only considers the first dpi_count zero bits
in dpi_enabled.
2020-07-23 00:45:29 +01:00
Marian Beermann
d7906b54b4 sinowealth: code cleanup and style changes 2020-07-23 00:45:29 +01:00
Marian Beermann
f1eba370ed sinowealth: do not typedef structs 2020-07-23 00:45:29 +01:00
Marian Beermann
7b5ab2ed99 sinowealth: separate capability setting logic from read_profile 2020-07-23 00:45:29 +01:00
Marian Beermann
d2d5471836 sinowealth: implement brightness and speed controls 2020-07-23 00:45:29 +01:00
Marian Beermann
9cfc1e98e3 sinowealth: fixed rgb
Turns out it was caused by two mistakes:
1.) While writing the struct I overlooked a changed offset in my notes,
    so a bunch of padding was missing in the middle of the struct (unk4[33]);
    that padding is probably the set of colors (11) used by tail mode
2.) The LED bodies actually use RBG ordering instead of RGB
2020-07-23 00:45:29 +01:00
Marian Beermann
691661276f pad struct sinowealth_config_report to full size of report 2020-07-23 00:45:29 +01:00
Marian Beermann
25ed99db84 Add sinowealth driver 2020-07-23 00:45:29 +01:00
Dejan
02226d0428 data: add another device ID for G203 mouse 2020-07-09 21:54:56 +01:00
Stephan Lachnit
f822fb0fa7 remove unused string format to fix flake8 (#1024)
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-07-06 11:48:47 +02:00
Stephan Lachnit
b88be0add0 ci: bump Ubuntu to 20.04
This also removes the manual addition of the universe repository, since it's already enabled in the circleci image.
Because of this, software-properties-common doesn't need to be installed anymore, and libnss-systemd isn't going to be installed (see c425780220).
However, DEBIAN_FRONTEND=noninteractive needs to be set, else the image will loop while trying to configure tzdata (aka the timezome).

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-06-09 10:55:31 +10:00
Stephan Lachnit
9fc6d12486 data: add additional USB-ID for Roccat Kone Pure
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-06-07 20:58:41 +02:00
Stephan Lachnit
0c64dad9e1 fix wrong driver id for Roccat Kone Pure
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-06-07 20:58:41 +02:00
Farid Gh
f61485c603 data: add bluetooth ID to the MX Vertical 2020-05-29 13:57:21 +01:00
Filipe Laíns
8c295479d8 hidpp20: keep unsupported button mappings
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-05-25 18:08:40 +01:00
Dylan Baker
e55b04ec7d meson: Fix python3 version detection with python3 module
I misread the documentation about the python3 module. The newer python
module puts the language_version in the object returned by
`pymod.find_installation()`, while the python3 module has the same
method in the *module*.

Fixes #985
2020-05-19 19:47:24 +01:00
Filipe Laíns
1231415470 libratbag 0.14
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-05-17 21:23:57 +01:00
Filipe Laíns
660da27021 data: add Logitech G935
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-05-17 21:19:32 +01:00
Dylan Baker
481b6f029a meson: make finding python more robust
This code assumes that there is a python3 or python3-embed pkg-config
file on the system, which may or may not be true. On Gentoo for example,
only python-X.Y pkg-config files are available and this will fail to
build.

This makes use of the new py_installation.dependency(embed : true) if
possible, and falls back to trying to find a python that matches the
version of python found by the python3 or python module.
2020-05-17 19:19:42 +01:00
Filipe Laíns
768d93a45a github: add device info to bug report template
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-29 14:23:47 +01:00
ksv1986
1c6e039d01 hidpp10: fix handling of hidpp10_device_new() failures
Signed-off-by: ksv1986 <ksv0x07c2@gmail.com>
2020-04-26 15:07:23 +01:00
ksv1986
d16df8d100 hidpp10: fix crash if device failed to initialize properly
Signed-off-by: ksv1986 <ksv0x07c2@gmail.com>
2020-04-26 15:07:23 +01:00
Filipe Laíns
4b1e49d522 hidpp20: fix report type in ColorLedEffects (0x8070) set_zone_effect
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-26 15:07:06 +01:00
Filipe Laíns
786cebcb0b hidpp20: cleanup, use short reports when possible
libratbag has a quite communication-intensive setup routine. This patch
uses short reports when possible. Using short reports will speed up the
setup process and have a lower power consumption, which is relevant for
wireless devices.

We now check the report descriptor for the supported report IDs and
adjust the report type used based on the device capabilities. Because of
that, this patch should work without any issues as the report type will
get overwritten if it not supported.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-26 15:07:06 +01:00
Filipe Laíns
d53454bcb3 hidpp10: fix circular loop on hidpp10_onboard_profiles_read_macro
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-26 15:06:25 +01:00
Filipe Laíns
a0def65b64 hidpp10: add debug log on hidpp10_onboard_profiles_parse_macro fail
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-26 15:06:25 +01:00
Stephan Lachnit
2a40279903 doc: replace some tabs with spaces
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-04-26 15:06:08 +01:00
Filipe Laíns
02c95422f0 hidpp20: fix mapping button to consumer usages
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-18 02:31:17 +01:00
Filipe Laíns
4ce1cf2807 hidpp10: convert key actions to macro
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-18 02:31:17 +01:00
Filipe Laíns
89168f2187 hidpp10: add support from writting simple macro actions
Fixes #900

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-18 02:31:17 +01:00
Filipe Laíns
bb92337268 ci: remove dbus policy dir hack in arch
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-18 02:29:05 +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
39769c57dd ci: save cache between jobs for fedora and arch
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-17 05:57:38 +01:00
Filipe Laíns
200a8af7a7 ci: cache packages in arch
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-17 05:57:38 +01:00
FFY00
fcf9f7745d ci: add arch
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-17 05:57:38 +01:00
Filipe Laíns
633c9fc55d libratbag-data: add missing header entry (#958)
Dicovered in #957

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-16 15:59:50 +02:00
Peter Hutterer
ee73434ead circleci: bump to use ubuntu 19.10
The 19.04 repos give us 404s, so let's update to the next version.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-16 08:01:53 +10:00
Filipe Laíns
d60b1c9d71 data: overwrite led count in G305
Fixes #949

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-14 19:00:12 +01:00
Filipe Laíns
88a60f55b4 hidpp20: allow overwritting the led count
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-14 19:00:12 +01:00
D33M0N
dba202ae8b data: added bluetooth ID to the MX Anywhere 2 2020-04-03 19:27:02 +01:00
Filipe Laíns
6cdcce9de4 hidpp20: log error number when commiting
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-03 17:02:44 +02:00
Filipe Laíns
e2c3373145 hidpp10: log errors when comitting
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-04-03 17:02:44 +02:00
Filipe Laíns
02575a9008 hidpp20: add button/macro opcodes
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-03-22 19:17:47 +00:00
Filipe Laíns
1097b1ba68 meson: silence swig warnings
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-03-22 19:13:58 +00:00
Filipe Laíns
77b67775da ratbagctl: don't print empty properties
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-03-22 19:08:58 +00:00
Filipe Laíns
5b23c9ebae data: add Logitech M720
Fixes #939

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-03-22 18:58:07 +00:00
Stephan Lachnit
6d0974be25 circleci: add diffutils dependency for fedora
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-02-21 15:21:42 +01:00
simrat39
ea9111a2a6 devices: Set g402 LedTypes
Signed-off-by: simrat39 <simrats169169@gmail.com>
2020-02-10 15:49:45 +00:00
Filipe Laíns
42787ee422 meson: libratbag 0.13
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-02-09 23:32:55 +00:00
Filipe Laíns
611dd9be0d hidpp20: keep unsupported effects
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-02-09 23:31:42 +00:00
Filipe Laíns
fd20f9e642 hidpp20: simplify hidpp20_onboard_profiles_write_led
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-02-09 23:31:42 +00:00
Filipe Laíns
9be5576967 hidpp20: add some missing led effects
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-02-09 23:31:42 +00:00
Filipe Laíns
9fe511fcc5 hidpp20: add profile field to special bindings in onboard profiles
New devices define a profile field in the button configuration. This
allows us to map a button to set the target profile as active. Even
though we don't support configuring this right now, some devices, such
as the G915/G815, come pre-configured with this action on th M-Keys.
This patch makes us able to read and write those settings, this way they
don't get lost when we write a profile to the device.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-02-09 23:31:42 +00:00
Filipe Laíns
f0b69aab19 hidpp20: only set active resolution if there are resolutions on 0x8100
This prevents us from trying to set a resolution on keyboards.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-02-09 23:31:42 +00:00
Filipe Laíns
7610b80ced hidpp20: log errors when failed to write sector
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-02-09 23:31:42 +00:00
Filipe Laíns
f0a05bb522 data: add the Logitech G Powerplay
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-02-10 08:24:10 +10:00
Torbjørn Fylling
2669cc28b2 data: add support for Logitech G815 keyboard 2020-01-31 10:13:37 +00:00
Peter Hutterer
302702d94a Declare a bunch of structs as extern
gcc 10 complains about multiple definitions of these when linking.

/usr/bin/ld: libhidpp.a(src_hidpp-generic.c.o):/builddir/build/BUILD/libratbag-0.12/x86_64-redhat-linux-gnu/../src/libratbag-private.h:588:
multiple definition of `etekcity_driver';
libutil.a(src_libratbag-util.c.o):/builddir/build/BUILD/libratbag-0.12/x86_64-redhat-linux-gnu/../src/libratbag-private.h:588:
first defined here

Special case here is the test_driver struct, without the extern gcc seems to
think it's a new struct with all zeros, causing a segfault when we then try to
strcmp the test driver name.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-29 02:12:28 +00:00
Filipe Laíns
e1136c4d30 hidpp20: add debug log when failed to read led (8070, getZoneEffects)
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-01-28 21:41:45 +01:00
Filipe Laíns
0012853a1d hidpp20: make sure getZoneEffect (8070) is supported
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-01-28 21:41:45 +01:00
Filipe Laíns
afb85f868c hidpp20: change unsupported effect log msg to debug verbosity
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-01-28 21:41:45 +01:00
Filipe Laíns
b76fcdadde hidpp20: enable 0x8070 (ColorLedEffects) standalone use
0x8071 is still missing but as of now we don't have any device that
needs it.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-01-28 21:41:45 +01:00
Stephan Lachnit
ba7c092ee2 driver-hidpp20: replace goto with return
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-01-08 07:36:52 +10:00
Stephan Lachnit
3483bd8c14 driver-hidpp20: minor cleanup
Removes useless setting of the dpi index when updating resolutions.
Removes weird empty line.

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2020-01-08 07:36:52 +10:00
Filipe Laíns
0fb0eb3d42 hidpp20: log errors in hidpp20drv_commit
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-01-06 19:22:57 +00: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
5f5e294598 hidpp20: add support for reading/writing the report rate via 0x8060
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-01-06 19:18:06 +00:00
Filipe Laíns
b4218737cd hidpp20: fix bug that was unsetting some capabilities
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-01-06 19:18:06 +00:00
Filipe Laíns
3875bb70fd hidpp20: implement dirty flag for report rate
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-01-06 19:13:01 +00:00
Filipe Laíns
e9d67b7235 ratbag: add dirty flag for report rate
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-01-06 19:13:01 +00:00
Filipe Laíns
8a476a8724 hidpp: fix supported_report_types data type
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-01-03 22:40:03 +00:00
Sadika Sumanapala
d67cbec5f8 Add M590 bluetooth ID 2020-01-03 08:17:43 +10:00
Stephan Lachnit
f82c6f72b6 Use EditorConfig instead of vim comments
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2019-12-24 08:04:11 +10:00
Stephan Lachnit
af30fc28cd CircleCI: use variables for dependencies
Use separate variable lists for dependencies.
Uninstall check merged in upstream meson, so it can be simplified.
`libsolv` doesn't need to be updated any more with Fedora 31.

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2019-12-24 07:34:18 +10:00
Filipe Laíns
3fb8a51456 docs: adjust description to say we support other devices than mice
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-23 06:26:55 +10:00
Matthias Bach
ceaa3c3ad5 Reorder the initialisation of the ratbagd client
When the API version mismatches we want to fail early before performing
any more complex initialisation. We do however have to check for
devices first so that we can distinguish cases where we cannot access
the daemon from those where it is too old to provide an API version.
2019-12-22 16:58:20 +00:00
Matthias Bach
551b918ba8 Give a more specific error message if user cannot reach ratbagd via D-BUS
If access failed, e.g. due to insufficient permissions, don't confuse
the user by reporting an API mismatch.

This is a minimal improvement to target issue #802. As, if access is
restricted to a group, that group is known in Meson, it would even be
possible to report that group in the error message. But, that would
require converting ratbagd.py to a template or finding some other way to
inject that information at build time.
2019-12-22 16:58:20 +00:00
Filipe Laíns
3105428ba1 tests: fix data parse for hidpp index
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-20 10:30:10 +01:00
Benjamin Tissoires
b3f2406180 data: add G910
Same situation than the G513, 0x8100 is not present.
But heh.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-12-20 09:15:24 +00:00
Benjamin Tissoires
902160f430 ratbag-command fixes
- File "./build/ratbag-command", line 2289, in open_ratbagd
    r = Ratbagd(1)
  TypeError: __init__() takes 1 positional argument but 2 were given
- AttributeError: module 'libratbag' has no attribute
  'ratbag_device_get_bus'
- File "./build/ratbag-command", line 267, in model
    return "{}:{04x}:{04x}:{d}".format(bus, vid, pid, version)
  KeyError: '04x'
- swig/python detected a memory leak of type 'uint32_t *', no destructor
  found.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-12-19 15:56:52 +01:00
Filipe Laíns
fd6d0b6198 data: add G513
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-19 13:58:02 +01:00
Filipe Laíns
5ed98fdb22 hidpp20: only enable 0x8070 or 0x8071 if 0x8100 is present
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-19 13:58:02 +01:00
Filipe Laíns
e0e73c2971 data: add G915
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-19 12:06:15 +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
Filipe Laíns
20b6e3deeb hidpp20: only populate resolutions if the device supports
This patch moves the 0x8100 initialization routine out of
hidpp20drv_init_feature because it needs the capabilities to be
processed first.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-19 12:05:54 +00:00
Filipe Laíns
ffcdee912d libratbag: allow no resolutions
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-19 12:05:54 +00:00
Filipe Laíns
5357d4cbc2 meson: libratbag 0.12
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-18 19:25:30 +00:00
Filipe Laíns
26c534cc74 hidpp20: check supported report types
Fixes #854

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-18 19:23:31 +00:00
Stephan Lachnit
904c7988bb hidpp20: set dictionary output to raw
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2019-12-17 15:54:42 +00:00
Stephan Lachnit
7d255a2f93 Fix missing capability in ratbagctl.test
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2019-12-17 15:54:42 +00:00
Stephan Lachnit
d0a5cb1f0e Minor ratbagd/ratbagc adjustments
Bumped copyright to 2019.
Fixed typo in profile.capabilities description.
only ratbagd.py: Removed vim helper line since the file has a proper file extension.

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2019-12-17 15:54:42 +00:00
Qiu Wenbo
71b1d66287 hidpp20: fix a double free error of hidpp20
These are two fields of a union and should have the same value. What the
code doing here is trying to free a pointer twice.

Signed-off-by: Qiu Wenbo <qiuwenbo@phytium.com.cn>
2019-12-14 14:25:44 +00:00
Qiu Wenbo
32ebbca42f hidpp20: fix G305 quirk detection
Signed-off-by: Qiu Wenbo <qiuwenbo@phytium.com.cn>
2019-12-14 14:25:44 +00:00
Stephan Lachnit
a0afbfeb3f Update CircleCI config
Rename fedora_latest to fedora_31 which is more representative.
Drop the Fedora Rawhide workflow which was always disabled anyway.

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2019-12-13 09:34:26 +10: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
b0ea75979a data: add a test for unifying receiver IDs
We don't want any device files that use the receiver itself as a match so
let's test for that. In virtually all cases this means the user must update
the kernel and hope support for that receiver is already present in that
version.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-11 00:27:35 +00:00
Stephan Lachnit
a5c1ca202e drivers: add Roccat Kone Pure driver
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
2019-12-11 00:20:02 +00:00
Peter Hutterer
8d40ad6c0c libratbag: only log to stderr for error messages
This was copied from libinput and made sense while libratbag was a library -
we want "unhandled" messages to end up somewhere and stderr is the most likely
candidate here.

Now that we always run within ratbagd and it's all effectively inseperable,
just log to stdout for anything below error.

The switch statement was reformatted for consistency, only the ERROR case has
changed code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-11 09:07:10 +10: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
47cc5fce92 github: add issue templates
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-05 10:01:59 +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
Jeff Huang
cd89b123ce Add Logitech M585/M590 support. (#845) 2019-11-27 15:52:18 +10:00
Peter Hutterer
f6546b3222 circle CI: add diff as fedora package
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-18 08:50:36 +10:00
Peter Hutterer
cd8ddc8444 circle CI: switch to Fedora 31
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-18 07:16:22 +10:00
Luke
cdb3226ef1 meson: don't use brackets, parenthesis and braces in filenames
Renamed filenames to avoid brackets, and added a check to data-parse-test.py to
check for brackets, parentheses, and braces so they aren't shipped in filenames
in the future.
2019-11-17 00:11:42 +00:00
Peter Hutterer
ce377fc36c meson.build: libratbag 0.11
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-05 11:06:27 +10:00
Mateusz Mojsiejuk
fe1308fe38 data: add Steelseries Kinzu V3 2019-11-02 21:21:41 +00:00
FFY00
983d3e2a88 data: fix G502 Hero Wireless .device file
Signed-off-by: FFY00 <lains@archlinux.org>
2019-10-23 18:47:17 +01:00
Filipe Laíns
3a3d9e1148 devices: add Logitech G604
Fixes #827

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-10-23 18:46:44 +01:00
Pieter
afbba26feb data: add wireded ID to G502 Hero Wireless 2019-10-23 18:45:14 +01:00
Peter Hutterer
8cc37047fb tools: fix typo in ratbagd.py
Reported in https://github.com/libratbag/piper/issues/406

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-16 10:50:58 +10:00
Benjamin Tissoires
c8f56cc535 swig: generate python helpers to use hidpp C library
```
$> sudo python3
Python 3.7.1 (default, Nov 23 2018, 10:01:49)
[GCC 8.2.1 20181105 (Red Hat 8.2.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hidpp
>>> f = open('/dev/hidraw1', 'r+b')
>>> base = hidpp.hidpp_device()
>>> hidpp.hidpp_device_init(base, f.fileno())
>>> dev = hidpp.hidpp20_device_new(base, 0xff)
>>> hidpp.hidpp20_feature_get_name(0x8100)
'HIDPP_PAGE_ONBOARD_PROFILES'
>>> hidpp.new_uint8_tp()
<Swig Object of type 'uint8_t *' at 0x7f865198fb70>
>>> feature_index = hidpp.new_uint8_tp()
>>> feature_type = hidpp.new_uint8_tp()
>>> feature_version = hidpp.new_uint8_tp()
>>> hidpp.hidpp_root_get_feature(dev, 0x8100, feature_index, feature_type, feature_version)
0
>>> hidpp.uint8_tp_value(feature_index)
14
```

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-09-26 09:12:42 +01:00
Dustin Falgout
b6936ddd3b Add Support For Logitech MX Master 3 (#819) 2019-09-20 15:32:43 +10:00
Filipe Laíns
d4d9712316 hidpp20: add suport for the G602
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-09-11 09:43:41 +01:00
Filipe Laíns
2353af214b hidpp20: fallback to 1st profile when no 8100 profile is active
When the windows driver puts a device in host mode it will mark all 8100
profiles as disabled. If no 8100 profile is enabled no libratbag profile
will get enabled. This patch prevents this by marking the first profile
as enabled if no profile is already enabled.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-09-11 09:33:45 +01:00
Filipe Laíns
a4d19efb93 hidpp20: fix reading cluster info in the 8071 feature
TBH I don't know why I wrote the original code in the first place, it
clearly doesn't follow the spec.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-09-11 15:09:43 +10:00
Filipe Laíns
cb0b458824 hidpp20: make cluster_info a single variable in hidpp20drv_read_led_8071
This was probably leftover code.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-09-11 15:09:43 +10:00
Adrian Pascu
48c476b28c Add missing MX master PID
As seen here: https://github.com/torvalds/linux/blob/master/drivers/hid/hid-logitech-hidpp.c#L3717
This mouse is a warranty replacement, shows up as MX Master in Logitech Options but has MX Master 2S Hardware.
2019-09-02 13:24:18 +10:00
Filipe Laíns
d6c3bf881d hidp20: rename profile mapping 0x04
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-08-30 11:11:23 +01:00
rHermes
1b000e627a Add G502 Hero Wireless to meson.build 2019-08-20 11:03:54 +02:00
rHermes
75bcf39114 Add Logitech G502 Hero Wireless device 2019-08-20 11:03:54 +02:00
Peter Hutterer
33ced3dfb7 hidpp10: if we can't fetch the current profile, error out
Right now we initialize any hidpp10 device with one profile and then go and
fetch the data. But we never check for return codes, so it always succeeds
even when we can't get anything out of the device at all. Eventually we fail
the sanity checks with "invalid dpi list" which is confusing at best.

Let's avoid this by requiring at least the current profile to work. This will
break devices that have a single emulated profile, i.e. those that don't have
profiles but rely on libratbag to emulate one based on the
current-resolution/current-... calls. Not sure we actually support any of
those, so let's see.

Closes #738 though it doesn't fix it, it just bails out better.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 15:49:24 +02:00
Peter Hutterer
906f17add2 Rename ratbag_test_driver to ratbag_try_driver
This is confusing because we do have a test driver and we have an optional
test_device argument here too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 15:49:24 +02:00
Filipe Laíns
016de548fc hidpp20: fix setting default resolution
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-08-17 10:02:28 +02:00
banditopazzo
665c022382 added bluetooth device ID in profiles for Logitech MX Master AMZ (amazon) 2019-08-15 08:37:58 +10:00
Filipe Laíns
81c7b42bec hidpp20/data: add the G305
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-08-13 08:52:06 +01:00
Filipe Laíns
edb054c6f8 hidpp20: add quirk system
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-08-13 08:52:06 +01:00
Peter Hutterer
8ae995b72d hidpp10: try switching to profile 0 where the device is in factory profiles
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-04 17:17:56 +02:00
Peter Hutterer
a941b75ef2 hidpp10: if the current profile is the factory profile, pretend it's 0
Rather than bail out completely, let's pretend the factory profile is profile
0 and keep going. This gives us a pretend-function mouse, though whether this
actually works is questionable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-04 17:17:56 +02:00
Peter Hutterer
8cb85da6be release.sh: make this script usable for piper
Remove some hardcoded names and fix the version number extraction.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-04 17:17:45 +02:00
Peter Hutterer
7ff59a636f release.sh: drop the module file and section handling
leftover from when this was the xorg release script, we need neither here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-04 17:17:45 +02:00
Peter Hutterer
6cd050f541 release.sh: fix version number replacement
sed treats . as "any character", so this breaks if we have a 0.10 version
number.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-04 17:17:45 +02:00
Peter Hutterer
ab3f1df06e meson.build: libratbag 0.10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 11:19:16 +10:00
Peter Hutterer
caa31e17cf circle CI: add meson plain and release build types
Second time lucky.

Fixes #770

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-01 20:02:28 +10:00
Peter Hutterer
b7e6103496 circleci: move existing config to the new location
CircleCI 2.0 requires a new config file location, otherwise it won't run. And
since 1.0 is sunset now, this means our CI wasn't getting executed.

The actual format of the config is the same, we were already using 2.0
features.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-01 10:24:09 +10:00
Peter Hutterer
b1b6a2761e Revert "circle CI: add meson plain and release build types"
This broke CircleCI but since it didn't run for that build, no-one noticed.

This reverts commit 3bc31edd72.
2019-08-01 10:24:09 +10:00
Peter Hutterer
11f4f32947 Revert "hidpp20: add quirk system"
This reverts commit 196d53e65f.
2019-08-01 09:47:00 +10:00
Peter Hutterer
4f5d0dffec Revert "hidpp20/data: add the G305"
This reverts commit cad05ffced.
2019-08-01 09:47:00 +10:00
Peter Hutterer
d213bdb86e data: add a test for duplicate DeviceMatch lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-01 09:22:03 +10:00
Peter Hutterer
e69e1de17b devices: drop the G700s wireless entry
The G700 and G700s both use the receiver's product id, so they both end up
having the same DeviceMatch. One of those two never gets loaded but which one
is implementation-defined and may change accidentally.

Let's drop the G700s entry because the G700 is closer to a lowest comon
denominator. Once we have kernel support for the actual product id, we can
re-instante them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-01 09:22:03 +10:00
Filipe Laíns
cad05ffced hidpp20/data: add the G305
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-08-01 09:20:47 +10:00
Filipe Laíns
196d53e65f hidpp20: add quirk system
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-08-01 09:20:47 +10:00
Peter Hutterer
c606b1abe3 tools: flake8 fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-31 09:08:06 +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
d458305f93 tools: ratbagdctl.test: if an exception occurs during startup, terminate
Don't leave a ratbagd.devel process hanging if something goes wrong.

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
e64a121572 tools: switch the button tests over to json 2019-07-31 08:36:16 +10:00
Peter Hutterer
607e47953c tools: switch led tests to use the json parsing 2019-07-31 08:36:16 +10:00
Peter Hutterer
a5816055dc tools: switch the report rate to json 2019-07-31 08:36:16 +10:00
Peter Hutterer
62ac0772f5 tools: switch the dpi test to json 2019-07-31 08:36:16 +10:00
Peter Hutterer
fc9e63a5aa tools: switch the resolution tests to use the json loading 2019-07-31 08:36:16 +10:00
Peter Hutterer
936a8f7a92 tools: switch the ratbagctl.test to use the new json loading 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
3a3b11ade4 ratbagctl: autogenerate the choices list for the specials and led modes
Let's not maintain that list manually if we can fetch it from the enums.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-30 12:39:11 +02:00
Peter Hutterer
3bc31edd72 circle CI: add meson plain and release build types
Fixes #770

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-30 12:31:01 +02:00
Peter Hutterer
485df20a83 tools: fix typo in ratbagd.py
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-30 19:30:11 +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
Filipe Laíns
02ec2442d3 hidpp20: add support for RGB Effects feature (0x8071)
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-30 15:12:10 +10:00
Filipe Laíns
a8b4d9c6f3 hidpp20: add new profile layout (0x04)
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-30 15:11:54 +10:00
Peter Hutterer
22a6ac1c7e hidpp10: make raw debugging messages a bit easier to read
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-30 12:01:42 +10:00
Peter Hutterer
42c302c860 tools: fix a few comments referring to old names
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-29 09:53:36 +10:00
Peter Hutterer
e2b1581aef tools: ratbagctl.test: set the data dir correctly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-29 09:35:56 +10:00
Peter Hutterer
10a3e87980 meson.build: remove unused fallback SVG name
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-29 06:55:30 +10:00
Peter Hutterer
2d465a63e1 meson: drop the unused libratbag version define
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-29 06:52:14 +10:00
Eric Culp
c2315323f4 meson.build: fix builds with --buildtype=plain
When building with --buildtype=plain, the build fails with the following
error:

    cc1: error: ‘-Wformat-security’ ignored without ‘-Wformat’ [-Werror=format-security]

-Werror=format-security was recently added in 43def1b3a5 by #745
2019-07-27 09:43:49 +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
89980a4a72 meson: add the prefix to the dbus dir
Otherwise where the directory is used within meson.build, the prefix would be
missing. No real effect since we don't use it anywhere but let's be safe.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-26 09:34:31 +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
122f05c272 tools: drop the RATBAGCTL_DEVEL environ, just use RATBAG_TEST instead
Which is the same env that ratbagd uses as well. And we don't have variable
values in RATBAGCTL_DEVEL anymore, so no point in having two different
variables here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-26 09:34:31 +10:00
Peter Hutterer
b06ac1035e tools: add --use-existing-ratbagd to the ratbagctl.test script as well
This makes it possible to run the script against a manually started
ratbagd.devel - with a lot less effort.

And since we're don't need to be root to do this, let's move that check too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-26 09:34:31 +10:00
Peter Hutterer
647fe432b2 tools: add argument to ratbagctl.devel to connect to running ratbagd
This makes it a lot easier to start ratbagd.devel in gdb, then run
ratbagctl.devel against it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-26 09:34:31 +10:00
Peter Hutterer
4e2e9f037b Drop the ratbagctl.devel sha bus name
We already have a separate name for the devel bus anyway, the git sha doesn't
give us a huge amount of benefits but makes manual debugging a major PITA.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-26 09:34:31 +10:00
Peter Hutterer
f92fee0b15 meson: document the various built bits a bit better
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-26 09:34:31 +10:00
Peter Hutterer
d7c394f379 tools: ratbactl.test: if RATBAGCTL_DEVEL is set, use the existing server
When there's a bug that's triggered by the test suite it's hard to figure out
what exactly crashes. So allow starting ratbagd.devel manually and run the
test suite against that process so we can gdb it.

The steps required for this are a bit insane, so the instructions are listed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-25 21:38:12 +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
11c1e2d71a Fix setting the capability flags on the resolutions
2 hours of debugging... ffs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-25 09:08:55 +02:00
Peter Hutterer
e2cbaf9dea tools: print the Model in ratbagctl info
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-25 07:26:27 +02:00
Peter Hutterer
bf9d86e228 hidpp10: if the profile name is the empty string, make it NULL
Because our profile struct can never have an NULL name, let's assume the
empty string equals NULL.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-25 13:02:18 +10:00
Filipe Laíns
f24a3bd441 hidpp20: fix 0x1001 comments, add missing ASE and use get_unaligned_be_u16
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-24 19:17:31 +10:00
Filipe Laíns
df5742ebfe libratbag-util: move data manipulation functions out of hidpp-generic
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-24 19:17:21 +10:00
Peter Hutterer
0c569e0bf7 tools: use super() in the ratbagctl test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-24 09:16:24 +02:00
Peter Hutterer
5ea1731f38 tools: use super() without arguments in ratbagctl
I *think* this is a Python2 leftover or something. Either way, let's remove
it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-24 09:16:24 +02:00
Peter Hutterer
572064aba8 tools: use super() instead of the named parent class in ratbagd.py
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-24 09:16:24 +02:00
Peter Hutterer
da2764e78d Append the created profiles/leds/buttons/resolutions, don't insert
We're initializing them with incrementing indices, let's make sure the list is
initialized that way too. Makes things more obvious in the log when the first
profile to be queried from the device isn't profile 4.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-23 13:47:11 +02:00
Peter Hutterer
4e56afae22 roccat: use the new get/set feature helpers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-23 13:46:23 +02:00
Peter Hutterer
d46251900c hidraw: add a feature report get/set helper functions
No real functional changes since they just forward to the existing function.
But it reduces the cognitive load a bit when reading the code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-23 13:46:23 +02:00
Peter Hutterer
43def1b3a5 meson.build: enable -Werror=format-security
We don't want to accidentally ignore those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-19 07:17:45 +02:00
Filipe Laíns
247ff7695d data: add MX Vertical
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-19 07:57:53 +10:00
Filipe Laíns
7a14026f2d hidpp20: fix warnings
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 15:13:51 +01:00
Filipe Laíns
55925db29e meson: bump project version to 0.9.906
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 13:29:12 +02:00
Peter Hutterer
87d4aed3ad Drop the cpp requirement and linker tests
This is a leftover from libratbag-as-a-library and obsolete now that ratbagd
is our only product. Our buildtest now is simply: "does ratbagd build?" and we
certainly shouldn't require a C++ compiler.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-17 07:20:36 +02:00
Peter Hutterer
7de944aaa0 Use python3-embed as dependency on Python 3.8
Python 3.8 no longer links to libpython, resulting in undefined references to
Python API.

But it provides a python3-embed.pc now, so let's try using that first and only
fall back on the normal case if that fails.

See https://github.com/mesonbuild/meson/issues/5629
2019-07-17 06:05:36 +02:00
Filipe Laíns
488774d3ba data: add logitech-g403-hero.device
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
Filipe Laíns
0673af2991 data: add logitech-g403-wireless.device
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
Filipe Laíns
0e84b63921 data: remove -over-USB from .device name and follow the layout of other .device files
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
Filipe Laíns
6e34f314f8 data: add logitech-g903-hero.device
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
Filipe Laíns
e3268f2ce6 data: add device PID to logitech-g903.device
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
Filipe Laíns
47623654d0 data: add logitech-g703-hero.device
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
Filipe Laíns
94423769b9 data: add device PID to logitech-g703.device
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
Filipe Laíns
4efe8f4830 data: add device PID to logitech-g603.device
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
Filipe Laíns
ac06e7d0c8 data: start using the device PID in logitech-g602.device
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
Filipe Laíns
f534cb55b0 data: remove logitech-gpowerplay-wireless.device
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
aTosser
bb3f386cca data: remove logitech-lightspeed.device
No longer required as G900 WPID already included in logitech-g900.device

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
aTosser
6393338d0f data: start using the device PID in logitech-g-pro-wireless.device
Changed PID for wireless PID. Necessary post Linux 5.2

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:49:01 +10:00
Filipe Laíns
b225e4bd80 hidpp20: simplify hidpp20_onboard_profiles_initialize
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-17 09:47:00 +10:00
Filipe Laíns
635257d6b8 hidpp20: improve debug messages
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-10 16:39:44 +02:00
Filipe Laíns
b31a8c5355 hidpp20: fall back to firmware profiles on a profile by profile basis
currently if any use profile is not valid we fallback to the firmware
profiles. this is quite annoying because the user might have only one
valid profile. this patch will keep valid profiles and only fallback to
firmware profiles on a profile by profile basis.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-10 16:39:44 +02:00
Ian Santopietro
412f3fef87 data: fix incorrect PID in MX Anywhere 2 2019-07-08 17:56:06 +02:00
Filipe Laíns
8f88573a08 hidpp20: fix reading onboard profiles (8100)
when we read the memory from the device we already align the offset so
that it matches the end of the sector. for ex, for a 255 sector size the
offset will be set to 255-16.
when we copy the memory (using memcpy) we just copy the bytes that will
finish filling the buffer, ignoring that the offset was aligned. we need
to copy the full 16 bytes, otherwise it will fail when sector_size does
not align with 16.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-08 10:33:53 +02:00
Filipe Laíns
c1265bc98a hidpp10: fix segfault for the c531 (and possibly other 27MHz receivers)
hidpp10_read_memory will return the HID++ error if the request fails.
right now, the error code from hidpp10_read_memory is transparently
passed through hidpp10_onboard_profiles_read_macro. This is problematic
because hidpp10_onboard_profiles_parse_macro only aborts on rc < 0 and
HID++ error are > 0.

Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-05 07:54:09 +10:00
Filipe Laíns
723d394c02 data: add Logitech Marathon M705
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-03 08:51:29 +10:00
Filipe Laíns
808f423600 data: add ID to MX Ergo
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-02 14:14:50 +02:00
Filipe Laíns
ae9c639a74 data: add Logitech MX518
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-02 14:14:28 +02:00
Filipe Laíns
932cbf0a5c logitech: don't show hidden features
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-07-02 09:55:11 +02:00
Yigit Guneli
486842b6cb data: add Logitech MX Ergo
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-06-28 18:47:08 +01:00
Ian Santopietro
2ae8233eeb data: add other Bluetooth PID to MX Anywhere 2
My MX Anywhere 2 has a different PID from the one supplied in the default .device file. This adds the PID to the device file to ensure mice with this PID get detected too.
2019-06-28 18:46:00 +01:00
Peter Hutterer
cdd70105b5 data: add a README for devices, remove the svg one
We don't ship SVGs here anymore, so let's remove that README. And instead add
one to the devices directory.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-17 09:44:41 +10:00
FFY00
6babb7b307 data: add other ID to MX Master 2019-05-31 18:24:25 +10:00
Pedro Vanzella
26843861c0 Add battery voltage reporting for newer mice 2019-05-29 13:50:41 +02:00
FFY00
2eed8dbb92 steelseries: only print firmware version on successful read 2019-05-28 07:57:22 +10:00
FFY00
a13ee32c61 steelseries: fix bug where we were wrongly dellocating dpi_{range,list}
_cleanup_ is deallocating the pointer returned by
ratbag_device_data_steelseries_get_dpi_{range,list}(). Deallocating
dpi_list results in a wrong step value, and a wrong step value then
results in a wrong step count when we try to set the dpi.

Fixes #436 and #702
2019-05-27 00:25:39 +01:00
Peter Hutterer
dbe98ed5b9 circleci: update to fedora 30
And install dbus-daemon manually, until we figure out how to correctly start
the new dbus-broker this will at least help us pass the tests.

And disable nss-systemd so we don't suffer from timeouts as dbus-daemon waits
for that to time out, see c425780220 for details.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-24 02:49:20 +01:00
Peter Hutterer
c425780220 circleci: drop libnss-systemd from Ubuntu
This is installed by software-properties-common, but since we don't
start our container with systemd, it effectively points to nowhere, adding
nothing but a delay of several minutes.

That delay affects dbus-daemon on startup and on configuration reload, it
takes several minutes to do either. ratbagctl.test installs a custom dbus
config file to be able to connect to ratbagd.devel, that config file triggers
a reload in the dbus-daemon. Since that reload takes longer than any of our
timeouts, the tests eventually fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-24 09:32:50 +10:00
Peter Hutterer
1e9839cb67 circle CI: switch to ubuntu 19.04
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-24 09:32:50 +10:00
FFY00
bbeaef749e meson: add 'sphinx-build' to sphinx executable name list 2019-05-24 07:16:19 +10:00
Peter Hutterer
240231b065 Error out if NDEBUG is defined
At some point meson #defined NDEBUG depending on the build type, thus
disabling asserts. libratbag relies on those, so let's error out if NDEBUG is
defined.

Related #685
2019-05-07 09:24:28 +02:00
Benjamin Tissoires
6f27053ab0 driver-hidpp20: re-enable changing the report rate
Fixes bf127d4c68

Related: #692

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-04-29 10:29:59 +10:00
Benjamin Tissoires
fc16a8dc7c ratabgc: handle the None value from the macro
Not sure why ratbagctl doesn't complain about it, but ratbag-command does

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-04-29 10:29:59 +10:00
Benjamin Tissoires
6256e9046f ratbagc: Fix a missing macro enum conversion
An overlook from 10305a123c

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-04-29 10:29:59 +10:00
Benjamin Tissoires
563550c473 driver-hidpp20: use the correct active dpi index
There is no guarantees the current value of dpi_index will be correct.
On my G502 the profiles are read in reverse order meaning that setting the
dpi_index can be applied to a wrong value.

Look for the correct libratbag dpi index before setting it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-04-29 10:29:59 +10:00
Benjamin Tissoires
a04f2d1c24 data: update G900 and G403 for kernel v5.2+
kernel v5.2 should solve #380, finally

Fixes #380


Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-04-24 14:46:07 +01:00
Daniel Caujolle-Bert
d86933d746 Add MX-Anywhere-2S bluetooth IDs. 2019-04-10 12:03:45 +01:00
FFY00
55f7d75567 steelseries: fix regression in v2 led
Fixes #683
2019-04-09 12:16:48 +01:00
Rene Kjellerup
6ee1c0a591 devices: add other ID for Logitech G Pro
Fixes #684
2019-04-05 22:39:33 +01: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
2b2d8e8980 ratbagctl: get the special name list from the enum
For two dicts x and y the merged dict can be created as {**x, **y}. We use
that to take the enum names and covert them to lowercase with hyphens instead
of underscores.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-12 16:33:05 +01:00
Peter Hutterer
10305a123c tools: convert our enum equivalents to python enums
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-12 16:33:05 +01:00
Peter Hutterer
11db35edba Fix flake8 warnings (#678)
The only notable one here is the regex that had an escape sequence

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-12 06:49:54 +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
FFY00
4d00a815a4 revert "data: add Logitech G100s (#670)"
This reverts commit 0e28d82a16.
2019-03-05 22:15:42 +01:00
Filipe Laíns
0e28d82a16 data: add Logitech G100s (#670) 2019-03-05 16:57:39 +01:00
Peter Hutterer
336440cddb Install the device files in the top-level datadir
Now that the SVGs are gone, we don't need the subfolder anymore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-05 09:06:05 +01:00
Peter Hutterer
b2a3d39122 libratbag: improve debugging to help with new devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-05 13:29:11 +10:00
Peter Hutterer
4b7b9d2e48 meson.build: rename the logind dep for consistency with the rest
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-04 20:17:06 +10:00
Andy Fitzsimon
57097ceddb updated logo look and feel
Rough update but headed in the right direction

* Simplified silhouette of bag
* Reduced number of rats inside the Rat Bag to two 
* Eyes are still small and potentially still not printable at small scale
* Introduced rough stylized logotype based on Google's Sedgwick Ave Display font
* Reduced total file size by a heap
2019-03-04 10:44:59 +10:00
FFY00
c7ce1a96a7 data: rename logitech-g900-wireless to logitech-lightspeed 2019-03-04 10:33:58 +10:00
Peter Hutterer
daf9580ca5 meson.build: libratbag 0.9.905
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-28 10:10:49 +10:00
Peter Hutterer
396b8bee87 doc: tab -> whitespace in the dbus docs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-28 09:56:59 +10:00
Peter Hutterer
c8c1c63531 doc: drop the libratbag-enums.h from the documentation
The various enums are now documented separately for the DBus API

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-28 09:56:59 +10:00
Peter Hutterer
704710814e doc: specify the values for the button actions
Don't rely on the libratbag enums here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-28 09:56:59 +10:00
Peter Hutterer
f497dab1d8 tools: drop the resolution capabilities from the python bindings
Should've been part of 30c482aab2

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-27 14:35:39 +10:00
Peter Hutterer
67ee0fab14 tools flake8 fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-27 14:20:58 +10: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
6d05b7df67 tools: assume good tests won't write to stderr
GObject silently catches exceptions and logs it to stderr without ever passing
on the exceptions. Avoid oversight by checking stderr in the tests.

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
Peter Hutterer
bf127d4c68 Move the ReportRate into the profile
We don't have mice that can do report rates per resolutions, so let's not
commit to that.

This is a DBus API break but also a break in ratbagd, piper will need to
update to fetch the rate/rates from the profile object now.

It's a ratbagctl break as well, ratbagctl info changes slightly and the
resolution is not argument anymore for the rate.

Fixes #645

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-27 11:31:59 +10:00
Peter Hutterer
9f9f6294c3 doc: document the LED colors a bit better
And bump the enum down to 0 so we have normal values in the DBus API

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-27 10:58:42 +10:00
Peter Hutterer
3bba3d9bcb doc: styling fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-27 10:58:42 +10:00
Peter Hutterer
6b65ed2198 tools: restore --keepalive functionality
Since 2607114709 we returned the second parser
to handle everything after the device argument. That parser didn't have the
various options we handled in the original one, causing --keepalive to stop
working. Restore this by passing the existing namespace down to the parser.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-27 10:41:26 +10:00
Peter Hutterer
8e9dd6f392 ratbagd: change the Resolution property to a variant
Instead of a fixed (uu) with an extra capability flag, let's just make this a
variant defined to be a u or a (uu), depending on whether we have a single or
a separate resolution.

In the ratbagd.py bindings we return a tuple for both, but a simple len()
check will tell us which one it is.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-26 09:19:50 +01:00
Peter Hutterer
f3df391d71 tools: do a simple name match if we can't find the device
If the specific name isn't the list (e.g. howling-woodrat) do a basic string
search on all the device names. For the normal case where users have only one
or maybe two devices and they have unique model names, they can do

	ratbagctl "Logitech G303" info

Which is something we can easily support forever as sensible API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-26 09:06:15 +01:00
Peter Hutterer
16daac7311 tools: make ratbagctl case-sensitive
This seems like a convenience thing, possibly dating back to when we thought
ratbagctl will be the primary libratbag interaction. Either way, for the
limited number of commands we have here it's better to be very strict in what
we accept to avoid accidental typos making it into the API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-26 09:06:15 +01:00
Peter Hutterer
653b834e01 tools: add a noop notify() function to all our classes
ratbagd uses GObjects and properties so we also make use of notify() a
fair bit. Make sure we don't crash out in ratbagc for that, just add an empty
noop function named notify()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-26 08:56:15 +01:00
Peter Hutterer
8c32036e03 doc: remove the LED Type property
dropped in 367aa29dfe

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-26 08:51:32 +10:00
Peter Hutterer
ba10000feb doc: drop the device capabilities
These were removed in 5328c20a58

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-26 08:51:32 +10:00
Peter Hutterer
f07007b6e6 doc: typo and styling fixes for the dbus API docs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-26 08:51:32 +10:00
Peter Hutterer
a002a58a5e tools: print stdout/stderr when a test returns the wrong returncode
It doesn't look pretty but it's much easier to figure out what's going on.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-25 10:48:50 +01:00
Peter Hutterer
57ca3086ae ratbagctl: make the device ID more interesting
Take the first 4 bytes of the device id (a sha), parse them as two 2-byte hex
values and mod them by the length of a pre-determined array of rodents and
their vocalisation methods. This gives us an index and a device name
assignement like this:

wailing-squirrel:    Logitech G500s Laser Gaming Mouse
warbling-groundhog:  Logitech MX Anywhere 2S
humming-hutia:       Logitech Gaming Mouse G303

This relies on the sha's first 4 bytes to be unique enough that they don't add
up to the same 2 values. Which is probably safe enough.

This does not affect ratbag-command which still uses the hidraw nodes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-25 10:48:50 +01:00
Peter Hutterer
a46c30253d tools: after resetting the test device, run a dbus sync
This gives us the chance to receive the new device via DBus

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-25 10:48:50 +01:00
Peter Hutterer
391a0e923e Drop the Device.Id from the DBus interface
The Device is an object on DBus, there is no need for another opaque ID, we
can just emulate this in the client. In our case by using the object
path and generating a sha1 from it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-25 10:48:50 +01:00
Peter Hutterer
cac289119d Revert "ratbagd: pick the ID from a list of preselected names"
This should not be in ratbagd. The Device ID is superfluous since we have DBus
objects anyway.

This reverts commit 12ac8b17f0.
2019-02-25 10:48:50 +01:00
Benjamin Tissoires
2607114709 ratbagctl: put the device at the beginning of the command
Having the device node last makes it easy for us to test the same line
on various devices. That is not the most common use-case - normally we'd
expect our users to have one mouse and run several commands on it
(that's the case during debugging as well).
So let's change the device node to be the first argument, it makes for
easier typing/copy-paste, etc.

Plus it makes it a lot more obvious which one the full command is
(`dpi set 800` in this example)

```
$ ratbagctl hidraw4 dpi set 800
```

Fixes: #635

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-02-22 22:59:56 +10:00
Peter Hutterer
d171f953c7 data: drop all SVGs
See the earlier commit "Drop the SVG handling from libratbag" for an
explanation, this commit merely removes the actual files from git.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 11:17:09 +01:00
Peter Hutterer
734977f176 Drop the SVG handling from libratbag
The SVGs must not be part of any stable API, there is too much behavior
implied that we cannot/do not specify. So it's perfectly likely that a future
change in the SVGs or rendering libraries breaks things in some detail. But
then we cannot update the SVGs without risking breaking other clients that
rely on the current behavior.

Besides: we only have one theme, called "gnome" because a push
towards having SVGs for other themes never happened.

And that theme isn't gnome-specific, it merely looks GNOMEy. The theme is very
much piper-specific in that it requires certain elements that piper cares
about. Currently anyway, if we make this part of our API, piper cannot change
that behavior ever without breaking others.

So let's drop SVG handling completely and rely on the clients to sort it out
for themselves.

For now the SVGs are left in the tree to make it easier to copy to Piper. Once
that's done, we will remove those too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 11:17:09 +01:00
Peter Hutterer
10a1cc9bbc ratbagd: export the Model property for the device
When the SVGs need to be maintained elsewhere, we need something reliable to
match devices with SVGs. The easiest is to provide a unique model string,
usually composed from the usb/bluetooth information.

A string format was chosen to make it more flexible for the glorious future
where we have something other than usb or bluetooth devices. Meanwhile, the
format is the well-known "usb:1234:56ef:0" string (bus, vid, pid, version).

The version in this string is a future-proof safeguard for libratbag. It will
be used where libratbag supports two devices with the same VID/PID and where
this is not otherwise differentiable. We don't have any such devices yet, so
libratbag just returns a hardcoded 0.

The format is currently defined for usb and bluetooth, in the future we may
have other strings.

The base guarantee is that this is a reliable identifier for the model that
will never change for that model. IOW this is what piper can use to map
devices to their SVGs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 11:17:09 +01:00
Peter Hutterer
367aa29dfe Drop the Led.Type property
The led type was the physical led type to describe where the LED sits.

This property is basically unused and of questionable use anyway. GUI
applications would need to rely on drawings of the mouse anyway. Scripts don't
really care because ratbagctl uses the led index anyway. The only time this
matters is when we're looking at (human) device discovery. But even then just
trying to set the LED is enough to figure out which one is which.

So let's drop this API on the assumption that it's not really needed and
maintaining and extending that enum forever is not necessary.

This is not a full purge, merely the DBus API that gets dropped.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 10:09:17 +01:00
Peter Hutterer
79711dfdad Drop the Button.Type property
The button type was the physical button type, not the logically assigned
button number.

This property is basically unused and of questionable use anyway. GUI
applications would need to rely on drawings of the mouse anyway. Scripts don't
really care because ratbagctl uses the button index anyway. The only time this
matters is when we're looking at (human) device discovery. But often clicking
around is enough to figure out the index.

So let's drop this API on the assumption that it's not really needed and
maintaining and extending that enum forever is not necessary.

This is not a full purge, merely the DBus API that gets dropped.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 10:09:17 +01:00
Peter Hutterer
32a5ad377e Drop the writable-name capability
Make this implict - if the profile has a name, it's writable. Otherwise it's
not and you'll have to rely on the index or make up your own naming.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:21:00 +10:00
Peter Hutterer
5328c20a58 Drop device capabilities
Now that the have all moved or been removed, there is no need to keep this
API.

This is a DBus API break, the Capabilities property disappears.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:21:00 +10:00
Peter Hutterer
014212bbd9 Move the query-configuration to the profile, rename to write-only
This is arguably a profile-specific thing since the device itself is static
(we still know button numbers, etc.), we just don't know the content of each
profile.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:21:00 +10:00
Peter Hutterer
3fcf13b58e Drop the superflous device capabilities
If we have a profiles/resolution/button/led, we can write to it. That is the
default assumption and where we don't have write-access to those, we should
simply not expose them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:21:00 +10:00
Peter Hutterer
55fd6c7a71 Drop the button key/macro device capability
The same information is supposed to be available in the button's action types

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:21:00 +10:00
Peter Hutterer
d6bbc33dda Drop the switchable-profile device capability
If we have more than one profile, we can switch between them. Because
otherwise having more than one profile is just showing off and we don't like
that type of behaviour, no no.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:21:00 +10:00
Peter Hutterer
d24ea1e662 Drop the switchable-resolution device capability
This capability is superfluous. If we have more than one resolution, we can
switch between them because ... well, why have more than one then?

Signed-off-by:Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:21:00 +10:00
Peter Hutterer
e4d4a7905a Move the disable-profile capability into the profile caps
This is a profile-specific capability, not a device-specific one so let's move
it there.

Arguably, the DBus API should not expose SetEnabled() where not available, but
that's a separate issue.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:21:00 +10:00
Peter Hutterer
af729ec16b Move the set-default-profile capability into the profiles
Theoretical case is where some profiles cannot be set to be the default, but
realistically: this is a profile-specific attribute so let's move the flag
there.

Arguably, the DBus API should not expose SetDefault() where not available, but
that's a separate issue.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:21:00 +10:00
Peter Hutterer
8ae35fa11b Namespace the device capabilities better
Fixes #224

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:21:00 +10:00
Peter Hutterer
561f0ac866 gskill: don't break after finding the active index
We still need to read the data of all other profiles. This broke in f26de4bb,
the previous loop only did the is-active modification

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:19:01 +10:00
Peter Hutterer
12ac8b17f0 ratbagd: pick the ID from a list of preselected names
We don't want anyone to rely on a specific content of the ID, e.g. by
hardcoding hidraw/event node numbers. So let's make this an opaque list with
no meaning other than "this is a rodent".

This is solely for the benefit of ratbagctl which uses these IDs as access
identifier.

This doesn't affect ratbag-command which still uses device paths. It also does
not affect the object path. And piper shows the device name anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 08:48:38 +10:00
Peter Hutterer
b568963b14 ratbagd: rename the 'name' variable to 'sysname'
Because that's what it is

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 08:48:38 +10:00
Peter Hutterer
583a050945 README: drop the logo to below the headline
Almost the same placement, but the horizontal line that github uses to render
headers doesn't get cut off anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 07:59:22 +10:00
Peter Hutterer
fe5ed89995 README: rewording and shuffling around
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 07:59:22 +10:00
Peter Hutterer
9ceec4f9f7 README: set a percentage size for the logo
First time I viewed this was on mobile, and the logo left enough space for a
lonely "li" on the left, with the "bratbag" in the line below the logo. Let's
call that a design faux pas and make it small enough to scale.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 07:59:22 +10:00
Benjamin Tissoires
e55c3812db Change position of the logo in the README
and use the animated one

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-02-21 14:10:23 +01:00
Benjamin Tissoires
d924218c7c logo: only change the eyes colors
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-02-21 21:47:28 +10:00
Benjamin Tissoires
8a3eb946fe Add the logo in the DBus documentation
so we can reuse it in the README with animations :)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-02-21 21:47:28 +10:00
Benjamin Tissoires
c734cec88a Add the logo in the README
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-02-21 21:47:28 +10:00
Benjamin Tissoires
109621f73e logo: make it square
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-02-21 21:47:28 +10:00
Benjamin Tissoires
6e09afd61e logo: RGB lighting!
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-02-21 21:47:28 +10:00
Benjamin Tissoires
943308ccaf logo: reshuffle the rats in their correct layers
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-02-21 21:47:28 +10:00
Peter Hutterer
253e8f6edc data: add a logo for libratbag
Because every self-respecting project needs one of those, right?

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-21 11:05:59 +01:00
Peter Hutterer
17d8bcacf6 Switch to using hidraw as base event source
We started with event nodes for some reason lost in the distant past (probably
because that's what a lot of other tools use). But since we exclusively deal
with hidraw devices here and event nodes only serve to look up the hidraw
node, let's get rid of that indirection layer and work with hidraw directly.

Note that changes how ratbagctl works, it used the event nodes before. So
anyone who hardcoded the event node in one way or another is going to see
breakage. Then again, the "eventX" string was the device ID as advertised by
ratbagd, so it's supposed to be treated as an opaque string anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-21 10:23:08 +01:00
Peter Hutterer
6280268919 ratbag-command: fix get_svg_fd()
Regression introduced in 107a649e08

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-20 10:59:14 +01:00
Peter Hutterer
caa75d170d ratbagd: make sure the profile name is ascii-only
Strings on DBus need to be valid UTF8, some of the default profile names on
the G700 include the degree character (" Profile n° 1"), the whole string ends
up being invalid UTF8.

This results in two issues:
- ratbagd gets quietly kicked off the bus when it sends that string
- ratbag-command throws an exception because Python is unhappy about the
  non-UTF8 string:
  UnicodeEncodeError: 'utf-8' codec can't encode character '\udcb0' in position 3: surrogates not allowed

The quick workaround here is to strip anything that's not ASCII from the
profile name. The same may be necessary for some device names too, but let's
wait until we see that.

For ratbag-command we convert the string to bytes and back using the 'ignore'
argument, this way we should see the original profile string without the
printf errors.

This is an incomplete fix, we'll have the same issue if a user tries to set a
non-ASCII name. The long-term fix is to convert whatever we have (probably ISO
8859-1, but can we detect that?) into UTF8 before passing it around. That
would also mean converting it back before writing to the device.

Fixes #617

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-20 11:26:23 +10:00
Peter Hutterer
a7f44211df tools: print the error message if we fail to connect to ratbagd
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-20 11:26:23 +10:00
Peter Hutterer
a3466f0e99 test: add profile name support to the internal test devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-20 11:26:23 +10:00
Peter Hutterer
222dda17a6 Don't set the resolution if it's not in our DPI list
Fixes #121

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 09:29:25 +01:00
Peter Hutterer
29fb0f855f ratbagd: map the default theme to the gnome theme
We don't install the default SVGs anymore and all the effort for new mice goes
into the gnome theme.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 09:27:55 +01:00
Peter Hutterer
91dfc3477d driver-hidpp10: fix a coverity complaint
Coverity seems to think this can use uninitialized array elements but that can
only happen when hidpp10->dpi_count is 0. In which case the callee doesn't
touch it anyway but coverity doesn't care about that bit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 09:14:58 +01:00
Peter Hutterer
42caf3bc94 hidpp20: fix self-assignment
Going by the comment above, this needs to be endian-converted.

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 09:14:58 +01:00
Peter Hutterer
7778da715e doc: some more updates/cleanups
Noteworthy: "Description" has been renamed to "Name" ages ago in ratbagd, this
just corrects the documentation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 13:23:42 +10:00
Peter Hutterer
0c2e4121af tools: sync ratbagd from piper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 12:40:17 +10:00
Peter Hutterer
107a649e08 ratbag: drop Device.Svg and Device.GetSvg()
This isn't used by anything in the tree and Piper doesn't use it either.
(`ratbagctl` queries it from the sodipodi name in the SVG).

Plus, assuming we run sandboxed the filename is useless anyway, `GetSvgFd()`
takes care of this bit though.

So let's drop this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 12:36:39 +10:00
Peter Hutterer
a17613459b circleci: drop scan-build from the jobs to run
Scan-build is at the point where it gives us too many false positives to be
reliable and they're not easily fixable other than sprinkling
"ignore_clang_sa_mem_leak" comments all over the source.

This caused us to drop F29 from the CI earlier, see 1225f421c0, but
really we just shouldn't use something that's so unreliable as part of our CI.

The main issue continues to be the use of __attribute__((cleanup)) but others
give us false positives too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-18 09:48:10 +01:00
Peter Hutterer
3392b5e276 tools: switch time.clock() to time.perf_counter()
toolbox.py:86: DeprecationWarning: time.clock has been deprecated in Python
3.3 and will be removed from Python 3.8: use time.perf_counter or
time.process_time instead

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-18 09:47:09 +01:00
Peter Hutterer
13656b60f7 doc: ref the LED enums correctly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-18 14:26:23 +10:00
Peter Hutterer
c2f93dc672 doc: reformat the DBus API docs a bit better
Use the default Python class, it's not perfect but still makes more sense than
the javascript class.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-18 14:21:39 +10:00
Peter Hutterer
468e6108ca doc: some documentation improvements
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-18 11:35:11 +10:00
Peter Hutterer
59e134149a README: update to point to the new wiki page for device notes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-01 08:59:09 +10:00
FFY00
29b2e64a1d data: add device file for Logitech G603
Co-authored-by: damex <damex.pp@gmail.com>
2019-01-30 15:06:54 +10:00
Jente Hidskes
4ce6a872ca data/gnome: increase vertical spacing in Logitech G Pro
The SVG guidelines specify a minimal vertical distance of 40px. There
were two lines in the G Pro SVG that had less, leading to the buttons
overlapping. This is visible in #607.
2019-01-26 11:41:12 +10:00
Jente Hidskes
8fa5a82376 data/gnome: fix Device layer for Logitech G Pro
The elements that were supposed to be in the Device layer were
accidentally placed in the Buttons layer, making Piper not render them
in the button page.

Fixes #607.
2019-01-26 11:41:12 +10:00
Stephen Kitt
0ef2dff374 Fix permissions on logitech-g402.device
It shouldn't be executable.

Signed-off-by: Stephen Kitt <steve@sk2.org>
2019-01-25 18:57:03 +01:00
maxice8
208bb15149 tools/shared.c: Use portable realpath() instead of (#606)
canonicalize_file_name()

Fixes compilation on musl systems
2019-01-24 14:26:05 +01:00
Peter Hutterer
549a6c47b8 libratbag 0.9.904
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-24 13:38:26 +10:00
Đặng Đoàn Đức Trung
400451efe1 Change G102/203's symlink to G-Pro (#605)
* Change G102/203 symlink to G-Pro

* Fix the symbolic link breaking
2019-01-22 19:29:43 +01:00
Zachary
2ee88948f3 data: added Logitech G603 svg (#600)
* data: added Logitech G603 svg

* data: added Logitech G603 svg

* data: added Logitech G603 svg

* data: updated Logitech G603 svg

I fixed an issue with the right and left click buttons missing and the middle button being on the incorrect layer. I also removed the logo on the mouse as I was having some issues in Inkscape due to my unfamiliarity with the software. I figured properly configured buttons is good enough for the time being.
2019-01-12 14:06:14 +01:00
Jente Hidskes
ace60f76da data/gnome/logitech-g-pro-wireless: don't use Logitech LED logo
We don't want this for copyright reasons.
2019-01-10 08:52:18 +10:00
Daniele Laudani
451af331b9 Logitech G402 support (#602)
This brings initial support for the Logitech G402, as discussed in #471.
I used the G502 svg and modified it, without changing the graphics. The two mice are aesthetically similar.

* Added G402 device file
* Added G402 svg file
* Add G402 files to build

[bentiss] squashed the 3 patches as one
2019-01-08 16:16:20 +01:00
Peter Hutterer
b87a770970 data: add MX Anywhere 2S 2019-01-07 10:19:12 +01:00
Benjamin Tissoires
e59ef319b0 hidpp20: non-rgb leds: switch back to HW control once configured
As mentioned in the code:
We revert to HW control of the LEDs.
This effectively disable the capability of changing the DPI/profile
LEDs, but this allows to make them work with the internal DPI/profile
switches.

The net result is:
- DPI/profiles can't be controlled (but who wants this?)
- The logo can properly controlled

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-01-07 10:39:55 +10:00
Benjamin Tissoires
8a1487f6f4 hidpp20: use macros for key+modifiers
Since a0830a8aaa, we can re-add the simple
keybindings capabilities. It's time the HID++ 2.0 devices get this.

This used to be working with the KEY API, but this has been dropped in
favor of the macro one.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-01-02 15:57:36 +10:00
Justin Gottula
44d36d2bf0 tools: canonicalize path first in udev_device_from_path (#592)
* tools: canonicalize path first in udev_device_from_path

This fixes a problem in which running ratbag-command with the path to a
device node symlink (e.g. /dev/logi-g502 -> /dev/input/event4), such as
one created by a udev rule, would not work correctly, due to the code
failing to resolve the symlink prior to checking for the presence of the
"/dev/input/event" prefix.

This resulted in nonsensical error messages (shown below) and the
curious inability to run ratbag-command successfully with anything but
the actual raw path to the device node itself (e.g. /dev/input/event4
would work fine, but /dev/logi-g502 would not, despite both being valid
ways of getting to the same device node).

    Error: Can't open '/dev/logi-g502': Success
    Error: Device '/dev/logi-g502' is not supported

Note that this same problem also prevented the usage of autogenerated
symlinks by udev, i.e. '/dev/input/by-id/' and '/dev/input/by-path/'.

* Update tools/shared.c

Co-Authored-By: jgottula <justin@jgottula.com>
2018-12-24 19:04:04 +01:00
Peter Hutterer
635865efa5 hidpp20: if the button is remapped, use that
A non-zero value for the remapped field means the button is mapped to that
button.

"diverted" means to decouple it from normal HID reports and report it via
HID++ only. In our case here, we "map" it, which is different.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-21 15:53:10 +01:00
Peter Hutterer
38949013f7 circleci: check for missing .device or .svg files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-20 06:55:33 +01:00
Peter Hutterer
e1879818b4 meson.build: add missing mx master.svg
Missing from cf9a3e48b7

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-20 06:55:33 +01:00
Peter Hutterer
9b2614109f tools: sync ratbagd.py from Piper - drop async commit
ratbagd now implements commit as normal always-successful call with a
potential Resync signal later if something failed on the device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-20 10:34:19 +10:00
Haochen Tong
abe99fec6a data: add device file and SVG for MX Anywhere 2 2018-12-20 10:14:54 +10:00
Haochen Tong
21936db58b hidpp20: remove redundant rc check
Protocol error code is already handled in hidpp20_request_command.
2018-12-20 10:14:54 +10:00
Haochen Tong
74f01f3de4 hidpp-generic: add physical mapping for button 169
This is the "Gesture Button" found on MX Anywhere2.
2018-12-19 23:12:04 +01:00
Haochen Tong
53ba4d975d hidpp20: add 3 new feature constants
Add HIDPP_PAGE_RESET, HIDPP_PAGE_DEVICE_NAME, and
HIDPP_PAGE_WIRELESS_DEVICE_STATUS. These feature names are found in the
"features.xml" of an LogiOptions installation. Probably not very useful
for now.
2018-12-19 23:12:04 +01:00
Haochen Tong
97306ddd5a hidpp20: ignore error on single button when enumerating special keys
The MX Anywhere 2 mouse has a problematic special key (index=7). When
trying to get the reporting value of this key, the device returns an
"invalid argument" error. [1]

To avoid giving up all good information about other keys, ignore error
(and the cause) when enumerating special keys.

[1] https://github.com/libratbag/libratbag/issues/558#issuecomment-439732655
2018-12-19 23:12:04 +01:00
Peter Hutterer
16e052d846 tools: print a nice error when we don't have the required capabilities
Fixes #583

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-19 10:15:09 +01:00
Peter Hutterer
1586913fc7 tools: don't allow setting macros where not supported
Fixes #585

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-19 10:15:09 +01:00
Peter Hutterer
cf9a3e48b7 gnome: symlink the mx master to our existing mx master 2 SVG
Those two devices look identical

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-19 09:21:36 +01:00
Peter Hutterer
ec835e2e82 data: rename the MX master svg to drop the underscore
More consistent with the rest of the files

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-19 09:21:36 +01:00
Peter Hutterer
b86211204c tools: make ratbagctl bold in the man page
And a double-space to single-space change snuck in as well

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-19 11:51:52 +10:00
Lukas Werling
1d6995be72 Add Logitech MX Master 2S 2018-12-18 16:15:28 +10:00
Aleksandar Trifunovic
536576fe8b meson: conditional check to avoid use of depricated features after Meson v0.48.0 2018-12-17 18:04:37 +00:00
Peter Hutterer
b514f49b08 tools: sync ratbagd from Piper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-13 11:58:49 +10:00
Aleksandar Trifunovic
46a466ffe1 Fix Logitech G Pro commit 2018-12-13 08:23:30 +10:00
Aleksandar Trifunovic
15f1667fa4 Add Logitech G Pro Wireless 2018-12-13 08:23:30 +10:00
Peter Hutterer
284c13b2fe ratbagd: update all properties before sending out Resync
Fixes #528

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-11 11:09:14 +10:00
Peter Hutterer
e9bb4f98ae ratbagd: make Commit() truly asynchronous
Schedule the actual operation as a callback to handle at the end of the event
loop and return success. The Resync signal will handle the rest.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-11 11:08:56 +10:00
Peter Hutterer
45b8d792cc meson.build: add the new device files to meson.build
A few of the device files didn't get installed, let's add them to the list.
This reshuffles the list a bit because the easiest way to make sure all files
are included is to run git ls-files, so let's stick to that.

Fixes #552

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-11 11:08:11 +10:00
Peter Hutterer
b93dfcfda4 data: add helper functions for checking list contents
Easier to print the lists instead of just failing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-11 11:08:11 +10:00
Peter Hutterer
3ffdc8daa0 Revert "Add Logitech G Pro wired configuration (#555)"
This wasn't added to the meson.build file so the test didn't run on it. And
the test fails. Issues found include:

- DPIRange and DPIList must not be in the Device section
- Only one of those two, not both
- The svg file was in the 'default' theme rather than in gnome

This needs to be fixed first, not sure how this would've worked at all.

This reverts commit 2371960a1d.
2018-12-04 16:34:02 +10:00
Peter Hutterer
e38bc7a760 ratbagd: set up a simple exit-on-idle
ratbagd is not something that needs stay around forever just because we
configured a mouse once. We have DBus activation and we don't store anything
anyway, so we might as well exit after a period of inactivity (20 min).

There's a slight race condition where if something comes in at exactly the
20min mark, we may shut down anyway and the messages get lost. This is too
narrow to worry about.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-28 09:33:16 +01:00
Peter Hutterer
2dca516afa data: check for missing buttons
The Logitech G502 had a wrong button ID so it doesn't show up. We have a
correctly named leader and path though so let's add that to the checks.

https://github.com/libratbag/piper/issues/240

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-28 09:18:50 +01:00
Peter Hutterer
b489ac871d data: fix the Logitech G502 button 10 label
Fixes https://github.com/libratbag/piper/issues/240

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-28 09:18:50 +01:00
Peter Hutterer
50fb898138 roccat: set the dpi list
Turns out this driver never got updated for the 'new' DPI list provided by
libratbag and thus broke with bacdab2596 when we
enforced that DPI list.

Set a fixed DPI list based on the hardcoded values we use elsewhere in this
driver.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-28 09:08:24 +01:00
Peter Hutterer
c676fcefb1 README: minor improvements (#565)
Notable: parts of the instructions have been punted to the wiki now where it's
faster to edit and be verbose about the specific instructions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-27 10:55:24 +10:00
Peter Hutterer
bb4dd2aae0 data: fix Logitech g600 button 6/7 assignment (#564)
Fixes #550

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-27 08:03:51 +10:00
Benjamin Tissoires
9b11340e91 Revert "circle CI: switch to ubuntu 18.10"
This reverts commit 874d7eccb8.

Looks like 18.10 fails at every pipeline build, so better
punting this for later.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-11-26 09:38:11 +01:00
Peter Hutterer
3cd5a1f986 hidpp20: if a command returns with error, return a neg errno
I'm pretty sure all callers rely on this command to return either 0 or a
negative errno. There's a quirky occasion where if we get a HID error (a
positive number) during hidpp20_special_keys_buttons_get_reporting, that
number eventually ends up as the 'num_controls' value in
hidpp20_special_key_mouse_get_controls().

Since the only time we care about HID++ errors is during
hidpp20_root_get_protocol_version, let's just always return -EPROTO on HID++
errors.

Fixes #558

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-26 09:27:35 +01:00
Peter Hutterer
874d7eccb8 circle CI: switch to ubuntu 18.10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-26 09:25:08 +01:00
Erol Gorancic
44c4b901e2 Steelseries Rival 600 Support.
- New svg and device file. Updated meson.build.
- New device version (version 3).
- Refactored led cycle to be general for v2 and v3.
- New defines for v3.
2018-11-26 01:27:17 +00:00
mike391
2371960a1d Add Logitech G Pro wired configuration (#555) 2018-11-26 11:25:17 +10:00
Mateusz Maćkowski
874aa8e63e Add support for Logitech G502 HERO (#559)
* Add support for Logitech G502 HERO
2018-11-26 11:24:41 +10:00
Peter Hutterer
1225f421c0 circle CI: switch fedora latest to fedora 28
Some change in F29 breaks the CI runs, so lets switch back to what we had
before so we can merge patches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-26 11:17:25 +10:00
Peter Hutterer
5f0f5d2843 driver-hidpp10: force the single profile to be active
If we can successfully read a profile but hidpp10_get_current_profile() fails
we end up with one profile, but not set to active. Fix this by always forcing
the single profile to be active.

Fixes #526
2018-11-26 11:11:42 +10:00
Peter Hutterer
1d464767e1 tools: fix error code names in ratbagd.py documentation 2018-09-27 09:44:05 +10:00
Peter Hutterer
9551dddbb8 tools: handle NULL svgs in ratbag-command
Showed up in #526
https://github.com/libratbag/libratbag/issues/526#issuecomment-420016451
2018-09-27 09:39:44 +10:00
Peter Hutterer
563c274705 tools: remove the unnecessary prefix from the error code enum
It's already encoded as part of the enum, no need to have it again for the
value
2018-09-26 13:17:36 +02:00
jit26
71ed64a843 Add Logitech G PowerPlay wireless configuration
Tested with a Logitech G903, should also work with a Logitech G703.
May also work with other Logitech mice that work with a G900 receiver.
2018-09-24 17:14:54 +01:00
Timofey Titovets
efb3efc828 Update Logitech G900 wireless config - add G903
Signed-off-by: Timofey Titovets <timofey.titovets@synesis.ru>
2018-09-18 14:51:11 +10:00
Timofey Titovets
982e6cc7fe Add Logitech G903 wired configuration
Signed-off-by: Timofey Titovets <timofey.titovets@synesis.ru>
2018-09-18 14:51:11 +10:00
Peter Hutterer
44dc754e31 meson.build: add hacks to be able to run coverity
Taken from libinput, we need to define a few gcc7 types that coverity doesn't
know about. To submit a coverity build, run meson with -Dcoverity=true

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-14 11:04:59 +02:00
Peter Hutterer
18887e4c86 meson_options: use a consistent style
Move the closing ) up to match the other options
2018-09-14 11:04:59 +02:00
Peter Hutterer
46d5fae2e5 tools: ratbagc - allow for the device to be just 'event7'
ratbagctl requires 'eventX' as argument, but ratbag-command requires
/dev/input/eventX. That's not smart, let's do better.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-14 10:23:11 +10:00
Peter Hutterer
4b31945e1d tools: change the exception to just RatbagdUnavailable
ratbag-command has an 'except RatbagdDBusUnavailable' line despite that class
never being defined. That's ok because we'll never throw it in this case but
it's still confusing (to flake8). So let's change the class name to something
more generic and define it in ratbagc.py

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-14 10:23:11 +10:00
Peter Hutterer
7e685f5196 tools: fix flake8 warnings about missing double empty lines 2018-09-13 10:51:15 +10:00
Andreas Heider
050db150f6 Add device match for MX Master 2018-09-10 17:54:03 +10:00
Peter Hutterer
a3de0e1ff7 ratbagd: provide a decent error message when the bus name is taken
sd-bus returns EEXISTS which is "File exists" and way too confusing. Let's
print out a decent error message for that case.

Relater #535
2018-09-10 04:15:01 +01:00
Peter Hutterer
acc0066f08 meson.build: add comments and tidy up a bit
Add some comments to make it slightly more obvious how the tools are being put
together.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-06 13:33:58 +02:00
Peter Hutterer
eb9f98e58d tools: ratbagc - set the LIBRATBAG_DATA_DIR environment before context start
This way we use the data files from the source directory, not the installed
ones.

Fixes #530

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-06 13:33:58 +02:00
Peter Hutterer
6d996bf1aa tools: add get_svg_fd() to ratbagc
Missing from 6000688c30

Fixes #31

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-06 13:33:58 +02:00
Peter Hutterer
34fbfe105c tools: return the full svg path for ratbagc get_svg()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-06 13:33:58 +02:00
Peter Hutterer
dfeac1bcbc tools: generate ratbagc.py from configuration_data()
No functional changes, this is prep work only

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-06 13:33:58 +02:00
Peter Hutterer
3d345570eb meson.build: libratbag 0.9.903
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-05 08:41:26 +10:00
Peter Hutterer
6000688c30 ratbagd: add GetSvgFd() to return an fd to the SVG
If we're sandboxing the client we don't have access to the SVG files directly.
So pass a read-only file descriptor to the client over DBus and let them deal
with the SVG that way.

In ratbagd.py we pull the fd off but we convert the quirky dbus error into a
normal FileNotFoundError(), much easier to catch in the caller.

On the ratbagctl side we now have to search the SVG for it's name - stored in
the 'sodipodi:docname' attribute by Inkspace. This isn't guaranteed to exist
or be always correct, but meh, it's close enough. We could continue to use the
GetSvg() call here but I want to deprecate that and remove it in the near
future.

Fixes #521

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-05 08:31:35 +10:00
Rasmus Thomsen
9b409822c3 build: support building with elogind 2018-09-04 13:51:01 +10:00
FFY00
363eab80f0 steelseries: implement cycle struct 2018-09-01 22:49:32 +02:00
Peter Hutterer
66fc7b545e meson_options: fix indentation 2018-08-31 09:06:05 +10:00
Peter Hutterer
bb4b673df8 Drop the unused libratbag-version.h
Unused since 558f59b52c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-30 08:20:23 +02:00
Peter Hutterer
e104eca02c ratbagd: add a --version commandline argument
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-30 08:20:23 +02:00
Peter Hutterer
01c362eadc ratbagd: log the device list by default
Without --verbose ratbagd just starts up with no message whatsoever. It's hard
to tell if any devices are supported or if the server just hangs. Let's log
the devices detected by default, at least that way we get some feedback.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-30 08:20:23 +02:00
Thomas Hindoe Paaboel Andersen
fff3589a20 steelseries: read settings from device
Open an extra hidraw to read current onboard settings.

Initially DPI and static LED color can be read from the rival
310. Other data/devices can be added as the protocol is better
understood.

The protocol used to extract the data seems to be both device
and firmware version specific. To be able to switch on both
cases we now store the firmware information in the drv_data.

Signed-off-by: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
2018-08-30 15:49:48 +10:00
Thomas Hindoe Paaboel Andersen
a4e1e1690d hidraw: allow opening multiple hidraw
For some devices we have to send reports on one endpoint
but read the reply on another. This commit allows us to
open and store multiple hidraws and adds API to specify
which hidraw to use for open, close, and read input report.

Signed-off-by: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
2018-08-30 15:49:48 +10:00
Peter Hutterer
38dce69838 ratbagd: remove some unused variables
Warnings introduced in 23ff4e753d

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-30 11:03:09 +10:00
Peter Hutterer
23ff4e753d ratbagd: wrap the various sd_bus functions into a macro
Make sure we log an error if any of these fail, because most really never
should, they're scaffolding we rely on to send the data. Some of these calls
(the *_read() ones) could fail if a client sends wrong data, but we might as
well log that.

This patch only wraps calls that reply on the bus, normal sd_bus_* calls that
we catch the error ourselves are handled as before.

Likewise, any errors from libratbag are left as-is. We somewhat rely on
libratbag to log something and such errors are not a failure of the actual
scaffolding.

This should make errors like https://github.com/libratbag/piper/issues/237
easier to debug.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-24 10:01:56 +02:00
Peter Hutterer
f24cb6dc66 ratbagd: always return an empty list for array-like properties []
In some cases we get Piper trying to use None as a list, see
https://github.com/libratbag/piper/issues/237

This can be reproduced by returning an error (e.g. -ENOMEM) from
ratbagd_get_devices(). That error isn't handled anywhere on the client side,
the effective result is that the property is None when calling
proxy.get_cached_property().

The error is visible on the bus:

method call time=1535084121.223284 sender=:1.1311 -> destination=:1.1310
  serial=7 path=/org/freedesktop/ratbag1;
  interface=org.freedesktop.DBus.Properties; member=GetAll
  string "org.freedesktop.ratbag1.Manager"
error time=1535084121.223433 sender=:1.1310 -> destination=:1.1311
  error_name=org.freedesktop.DBus.Error.NoMemory reply_serial=7
  string "Cannot allocate memory"

Make ratbagd.py more robust here and always return an empty list for those
properties where we expect an array. This papers over the real bug which is
that a) we need better logging in ratbagd on errors and b) something on the
other side needs to handle this error.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-24 10:01:56 +02:00
Thomas Hindoe Paaboel Andersen
b738136154 ratbagd: do not warn when converting invalid special action
Clients e.g. ratbagctl ask for all properties, so this getter gets
called often even if the button is not a special action.

We do not want to send the value for an invalid special action as
that is negative 1. Converting to unknown is good enough here so
let's just remove the error logging and convert in silence.
2018-08-23 08:04:57 +10:00
Peter Hutterer
447931d779 ratbagd: put in a check for invalid -1 sent down the wire
Before we send something as "u" down DBus, check that it's not -1, a commonly
used error code in libratbag. If so, return a dbus error instead and log where
this occured so we can fix it.

This should at least help spot these errors quickly while at the same time
hopefully not crashing piper anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-22 20:21:55 +02:00
Peter Hutterer
920b71d94c ratbagd: if the action special type is invalid, change to unknown
This prevents us from sending -1 down the wire as unsigned int.

This may be the cause of https://github.com/libratbag/piper/issues/208

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-22 20:21:55 +02:00
Peter Hutterer
a786aaf390 libratbag: whitespace fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-22 20:21:55 +02:00
Peter Hutterer
d395db1a11 libratbag: make the ratbag_*_has_* and _is_ functions return a bool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-22 20:21:55 +02:00
Peter Hutterer
ad0b7e53d9 libratbag: use !! for the led modes
We don't want to leak the bitmask we use internally.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-22 20:21:55 +02:00
Peter Hutterer
0ed621db8f tools: make the dbus directory before trying to copy to it (#517)
Popped up in https://github.com/libratbag/libratbag/pull/515

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-22 04:08:10 +01:00
Peter Hutterer
5ae473dcd1 tools: make ratbagd a bit more robust regarding None object path lists
Not sure why this is happening exactly, but it's better to handle this case
without an immdiate exception.

Fixes https://github.com/libratbag/piper/issues/228

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-20 12:53:18 +10:00
maxice8
ac384137bd meson.build meson_options.txt: Add systemd switch (#510)
Allows systems that provide libelogind (which provides a portion of
libsystemd that libratbag uses) to also compile without having to patch
out the rest of the build to remove the full systemd dependency.

This commit:

- Adds a systemd swith on meson_options.txt, a boolean set to true as
default to keep expected behaivour
- Adds a check on meson.build for the systemd switch and adds
dep_systemd
- Guards sections meant to generate systemd service units under the
systemd switch
2018-08-16 23:33:42 +01:00
maxice8
e43cf7ab08 src/libratbag-data.c tools/lur-command.c: add missing limits.h includes (#507) 2018-08-16 12:46:36 +01:00
Thomas Hindoe Paaboel Andersen
acb65a1bc8 check-svg: only warn about non-consecutive buttons
Some devices like the logitech G9 have a button in its profile
data which is not a real physical button. This breaks the direct
mapping from button number to profile number.

This patch reduces this case from an error to a warning
2018-08-13 15:50:24 +10:00
Thomas Hindoe Paaboel Andersen
e5f4b49e36 update logitech G9 SVG
Adds wheel left/right clicks and adjusts button numberings

Button5 seems to be configurable in the profile, but no such button
exists on the mouse.
2018-08-13 15:50:24 +10:00
Thomas Hindoe Paaboel Andersen
31d0fa00d9 remove image layer in kinzu SVG 2018-07-30 09:43:47 +10:00
Thomas Hindoe Paaboel Andersen
d28f330d43 set profile dirty on name change 2018-07-30 09:42:25 +10:00
Thomas Hindoe Paaboel Andersen
a29adaf913 hidpp10: use profile name from device
Tested on G9
2018-07-30 09:42:25 +10:00
Thomas Hindoe Paaboel Andersen
ea3e68cf7d meson: bump min version to 0.40.0
Needed for build_by_default
2018-07-27 21:13:29 +10:00
gandalf3
158594ec20 Point buildsystem and piper at logitech-g900 svg 2018-07-27 10:19:09 +02:00
gandalf3
6e51849ae5 Add side view, space out leaders so Adwaita dropdowns don't overlap.
After some "user testing" (having a friend try it), I've put the side
view back in. This has the benefit of keeping all buttons visible
without overlap, which would be necessary for
https://github.com/libratbag/piper/issues/71.
2018-07-27 10:19:09 +02:00
gandalf3
29731aa578 Fix remaining missing leaders and add style properties 2018-07-27 10:19:09 +02:00
gandalf3
4d0ef4f2c1 Add buttons to device layer
Also set button ids for device layer button objects
2018-07-27 10:19:09 +02:00
gandalf3
e7d03448cc Add button ids to leader lines and add leader objects
Note: mouse up and mouse down ignored for now
2018-07-27 10:19:09 +02:00
gandalf3
2725a55770 Add LED and Button leads to logitech g600 svg 2018-07-27 10:19:09 +02:00
gandalf3
e5be1a70eb Add logitech G600 svg 2018-07-27 10:19:09 +02:00
Thomas Hindoe Paaboel Andersen
26493aceaf G600: fix setting resolution 2018-07-24 09:42:45 +02:00
Thomas Hindoe Paaboel Andersen
c4f5bd5218 Driver for logitech G600
A driver for the logitech G600. The behavior is similar to the
G300 but with enough differences that it seemed cleaner to implement
as a separate driver.
2018-07-24 09:42:45 +02:00
Thomas Hindoe Paaboel Andersen
7c65b0b4a9 increase max number of report rates to 8
This is needed for the logitech G600
2018-07-24 09:42:45 +02:00
Peter Hutterer
d81c68d94f meson: change to use "-Dtests=true" instead of "enable-tests"
This is more meson-like, the "enable-foo" is a autotools leftover.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-20 07:38:00 +02:00
Peter Hutterer
a5a2ea1a70 README: fix link to the DBus interface specification
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-18 14:59:03 +10:00
Peter Hutterer
507d10378a README: replace mesonconf with meson configure
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-18 08:12:18 +10:00
Gui Ambros
08f3f7daf2 Fix UTF-8 encoding on merge_ratbagd.py, per #493 2018-07-05 20:31:34 +02:00
Luke
9b848084fd data/gnome: added device entry for G203/G102, artwork needed (#490) 2018-07-05 03:01:35 +01:00
Peter Hutterer
e1ebf7ad1b Initialize a few _cleanup_ pointers to NULL
../src/liblur.c:46:3: warning: 'd' may be used uninitialized in this function [-Wmaybe-uninitialized]
   hidpp10_device_destroy(*hidpp10_device);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/liblur.c:198:59: note: 'd' was declared here
   _cleanup_hidpp10_device_destroy_ struct hidpp10_device *d;

And similar messages

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-04 09:05:29 +02:00
Stephen Dawkins
38f46a9be8 updated sensei raw svg 2018-07-01 21:02:40 +02:00
Stephen Dawkins
d07b7582db removed sensei raw image from svg 2018-07-01 21:02:40 +02:00
Stephen Dawkins
af194a22f0 updated sensei raw image 2018-07-01 21:02:40 +02:00
Stephen Dawkins
d8c7050f6f disabled macros for steelseries if short_button is set 2018-07-01 21:02:40 +02:00
Stephen Dawkins
30e834b18b added svg for steelseries sensei raw 2018-07-01 21:02:40 +02:00
Stephen Dawkins
49770a22e7 added support for steelseries sensei raw 2018-07-01 21:02:40 +02:00
Thomas Hindoe Paaboel Andersen
de8cba13cf hidraw: use cleanup for udev enumerate 2018-06-29 11:25:03 +10:00
Benjamin Tissoires
1fab318dd3 hidpp20-drv: fix number of buttons for non-profiles mice
This was nasty. We correctly set the number of buttons but rely later
on the field set in drv_data.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-06-05 09:58:06 +10:00
Benjamin Tissoires
e2190964c2 hidpp20-drv: allow non configurable mice to work again
Given that there is a sanity check on the available resolution, we
need to provide default values. There might be a way to fetch the
actual values from the hardware but at least provide some sort of
default that re-enables the hardwares.

Fixes bacdab2596

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-06-05 09:58:06 +10:00
Benjamin Tissoires
8eddf99823 circle: allow to annotate clang static analyzer false positives
https://bugs.llvm.org/show_bug.cgi?id=3888

clang analyzer doesn't know how to handle __attribute__(cleanup()).

There are only 2 warnings raised because the analyzer only look at the
current compilation unit for checking the malloc call. So only those
2 are detected by clang and then marked as memory leak.

This also means our current continuous integration doesn't check for
memory leaks.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2018-05-25 08:45:47 +02:00
p4block
9fede0e68d Add Logitech G302 2018-05-22 09:04:27 +02:00
Peter Hutterer
1e62916e75 meson.build: libratbag 0.9.902
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-21 09:49:25 +10:00
David Guglielmi
447c69f034 data/gnome: G502: fix leds position
In Piper utility, leds configuration is inverted for g502 proteus spectrum
2018-05-17 17:14:04 +02:00
Peter Hutterer
fc0ab95087 Require meson 0.38
add_test_setup() was added in 0.38

Fixes #478

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-14 09:01:24 +10:00
Filipe Laíns
7fe4d6f097 libratbag: create list_append method (#474) 2018-04-09 09:47:53 +10:00
FFY00
fa57b417e9 steelseries: add dirty dpi check 2018-04-06 15:34:59 +02:00
FFY00
1aec9c0f54 steelseries: check button dirty flag when setting profile 2018-03-28 15:40:36 +02:00
Thomas Hindoe Paaboel Andersen
d1918a063c steelseries: sleep between messages
Adding the sleep makes the writes to the device more
reliable.
2018-03-26 21:55:55 +02:00
Thomas H. P. Andersen
770dd62b1d hidpp10: fix finding the closest dpi (#463)
value and dpi are unsigned so the delta calculations was wrong when
dpi is larger than than value. Casting to int should be fine for the
expected range of values in those variables.
2018-03-19 10:13:10 +10:00
Thomas H. P. Andersen
b474e76ac2 ratbagd: use correct enum type (#464)
RATBAG_RESOLUTION_CAP_SEPARATE_XY_RESOLUTION is a part of
ratbag_resolution_capability.
2018-03-19 10:12:34 +10:00
Thomas H. P. Andersen
6fa6e18408 meson: use three single quotes for multiline strings (#462)
This is needed for future versions of meson
2018-03-16 16:41:24 +10:00
Faalagorn
8ee19efee9 Rename etekcity device file to Etekcity Scroll Alpha (#461)
The driver is for Etekcity Scroll Alpha, based on the etekcity.svg and https://www.phoronix.com/scan.php?page=news_item&px=Libratbag-Announced
2018-03-08 10:36:17 +10:00
Yanko Kaneti
45282e7bd9 dbus service: use the actual ratbagd service name and not the alias
The alias can be used only when the service is enabled
2018-03-02 15:29:59 +10:00
Thomas Hindoe Paaboel Andersen
54b04ffff8 logitech G300: set LED mode capabilities 2018-02-23 09:18:32 +10:00
Thomas Hindoe Paaboel Andersen
1243d5bb13 steelseries: use macros for key+modifiers 2018-02-22 11:08:46 +01:00
Thomas Hindoe Paaboel Andersen
627fc5054f logitech-g300: use macros for key+modifiers 2018-02-22 11:08:46 +01:00
Thomas Hindoe Paaboel Andersen
a0830a8aaa add helpers to convert keypress to/from macro
Adds two helpers to ease the conversion between
key+modifiers and a macro. These are only intended
for single-key presses, not long macros.
2018-02-22 11:08:46 +01:00
Yanko Kaneti
02cbfc23b7 tools: Heed various PyGIDeprecationWarnings 2018-02-21 12:10:48 +10:00
Thomas Hindoe Paaboel Andersen
3da2630158 .device: add MacroLength for steelseries
Adds a setting to specify the max length of key press macros that the
device supports.

Setting MacroLength to 1 means that the device supports normal key presses,
(key + modifiers) but not multi key press macros.

0 can be used to indicate that buttons cannot be set as keys at all.
2018-02-16 09:13:58 +10:00
Thomas Hindoe Paaboel Andersen
e02d0724a3 steelseries: set LED capabilities
The Rival and earlier versions did not support cycle mode on the device.
2018-02-15 09:48:22 +10:00
Thomas Hindoe Paaboel Andersen
920fb3917f steelseries: support the original Rival
Initial support for the original Rival mouse.
Setting resolutions, report rate and LED color and
modes.

No key mappings yet, and breathing duration is fixed.
2018-02-14 14:45:24 +10:00
Thomas Hindoe Paaboel Andersen
f36b2dbce9 steelseries: default resolutions to 800/1600
The steelseries mice have 2 resolutions. The range/interval
is different per device. We cannot query the devices, so we
have to pick some defaults. Before we took the two first in
the list to be safe. It is a pretty bad default though. Using
800 and 1600 is supported by all known devices and seem as
more reasonable defaults.
2018-02-14 14:41:19 +10:00
Thomas Hindoe Paaboel Andersen
ef7e6f6db5 steelseries: correct use of return code
ratbag_hidraw_output_report returns 0 on success, not the number of bytes
written.
2018-02-12 12:03:23 +10:00
Thomas Hindoe Paaboel Andersen
3459fab8ec reset LED dirty flag on commit 2018-02-12 12:02:31 +10:00
Thomas Hindoe Paaboel Andersen
8063385d03 steelseries: default button mapping for sensei 310
The default button mapping the sensei 310 does not match
the table for the two known steelseries mice. The 6th button
is no longer resolution cycle, so the single table no longer
fits. Let's construct the table depending on the number of
buttons on the device.
2018-02-07 01:18:20 +01:00
Thomas Hindoe Paaboel Andersen
3dabcaa3a0 steelseries: add sensei 310
Very similar to the rival 310, but with 2 additional buttons
2018-02-07 01:18:20 +01:00
Matthias Gerstner
6c182b8e9b meson/dbus: support build time option to restrict D-Bus access
This change makes it possible to pass '-Ddbus-group=<group>' to limit
the access to the ratbagd D-Bus service. The default remains to allow
everyone access to the service.

This allows integrators to choose more conservative security settings
e.g. only allowing users in the 'games' group to talk to the ratbagd
daemon.
2018-01-29 12:48:30 +10:00
Peter Hutterer
ae805a3568 circleci: update to use Ubuntu 17.10
17.04 is EOL

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-19 10:46:56 +01:00
Peter Hutterer
d0001b8e0e circleci: use meson configure rather than mesonconf
This broke with meson 0.44 and results in an error:
RuntimeError: Could not determine how to run Meson. Please file a bug with details.

See https://github.com/mesonbuild/meson/issues/2761

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-19 10:46:56 +01:00
Ogier Bouvier
cbcdc4b724 ratbagd: ensure boolean passed to sd_* are 4 bytes wide
fix #433

Signed-off-by: Ogier Bouvier <obouvier@logitech.com>
2017-12-19 10:01:53 +01:00
Peter Hutterer
3bc3da967c meson.build: libratbag 0.9.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-12-18 13:46:50 +10:00
Peter Hutterer
b50ffef327 meson: require meson version 0.36
For add_project_arguments

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-12-18 13:21:32 +10:00
Ogier Bouvier
ec223eb2e6 hidpp20: force at least one profile to be enabled
fix #428

Signed-off-by: Ogier Bouvier <obouvier@logitech.com>
2017-12-13 15:06:39 +01:00
Ignacio Vazquez-Abrams
573d3d399e Allow meson to skip the test that requires root if root is unavailable 2017-12-04 09:05:09 +10:00
Thomas Hindoe Paaboel Andersen
0f5beb619e steelseries: support cycle and breathing LED mode
To specify the colors to cycle trough we write a list of
colors and their individual share of the total cycle duration.

Solid colors only have a single color in their list.

Breathing mode will cycle to and from the picked color and black.

Cycle mode will cycle through red, green, and blue.
2017-11-27 08:54:06 +10:00
Thomas Hindoe Paaboel Andersen
89aff23c11 use SVGs from the source dir in .devel
When using ratbagctl.devel we would use the .device files
from the source dir. This patch also makes it use the .svg
files from the source dir. This makes it easier to edit the
svg and less surprising now that it follows the .devices files.

To match the source file layout the .devices files are now
installed into a 'devices' subdirectory.
2017-11-25 16:46:50 +01:00
Thomas Hindoe Paaboel Andersen
fd27957b57 steelseries: add a support for the Kinzu V2 2017-11-22 14:35:09 +10:00
Thomas Hindoe Paaboel Andersen
554ee88c86 steelseries: move hardcoded values to .device
The steelseries driver used some hardcoded values for as the
only supported device was the rival 310. This moves that data
to the .device file.

The default resolutions used are changed from hardcoded 1000
and 2000, to the two first entries in the dpi list. Picking
actual values from the specified dpi list or range is safer.
2017-11-22 14:35:09 +10:00
Thomas Hindoe Paaboel Andersen
868d71a08b data: add section for SteelSeries mice
Add a section in the .device files for SteelSeries mice.
The mice cannot be queried and we need to store data for each
device of number of buttons, leds, and dpi list/range. Lastly
a "device version" is added. The latest models use a slightly
different protocol, so we needed something to distinguish them
with.
2017-11-22 14:35:09 +10:00
Jente Hidskes
9b3c33a2fe Convert LED effect rate in Hz to effect duration in ms
As discussed in https://github.com/libratbag/piper/issues/175
2017-11-15 08:53:56 +01:00
Benjamin Tissoires
109cc69da9 circle.yml: fix CI builds
Looks like https://bugzilla.redhat.com/show_bug.cgi?id=1483553 is
the key.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-11-03 19:44:05 +01:00
Thomas Hindoe Paaboel Andersen
113bd4859e steelseries: add writing buttons 2017-10-27 08:35:10 +10:00
Thomas Hindoe Paaboel Andersen
2a2b7487d4 steelseries: init the buttons to defaults 2017-10-26 10:25:56 +10:00
Thomas Hindoe Paaboel Andersen
2b4022dcbf steelseries: set report rate list 2017-10-26 10:25:56 +10:00
Thomas Hindoe Paaboel Andersen
7555cf1607 G300: set DPIs as a fixed list
Set the list of DPIs directly instead of use the _from_range call.

The G300 has few and coarse resolution options. Using the
exponential'ish range is not a good fit for devices with so
few dpis.

The logitech G300 can set:
250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2250, 2500

but piper would offer:
250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750,
800, 850, 900, 950, 1000, 1100, 1200, 1300, 1400, 1500,
1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500

We overpromise by offering more finegrainded options than the
mouse can do and end up with three times as many options than
we should.
2017-10-25 23:21:28 +02:00
Benjamin Tissoires
9c75a7cc7e tools: ratbagctl: add --nocommit
Allows to batch commands for setting multiple parameters at once.

Fixes #399

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-25 09:19:24 +02:00
Benjamin Tissoires
0337ae41ab tools: valgrind: shut up some non relevant memory leaks
Fixes #405

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-24 08:25:17 +10:00
Peter Hutterer
ff39e67615 Don't install the default theme svgs
No-one appears to be using these and the efforts to create SVGs
go into the GNOME ones (used by piper). Leave them in the git tree in case
someone wants to pick them up but until we have a consumer it's not worth it
installing them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-23 09:30:09 +02:00
Peter Hutterer
7ba5563eeb meson: silence compiler warning in swig generated files
libratbag@sha/libratbag.c: In function ‘_wrap_error__varargs__’:
libratbag@sha/libratbag.c:6392:3: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
   error((char const *)arg1,arg2);

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-23 10:19:57 +10:00
Thomas Hindoe Paaboel Andersen
968b9383d3 G300: move LED leader to LEDs layer
It does not seem to make any difference in Piper but let's be
correct anyway
2017-10-20 07:47:48 +10:00
Joshua Strobl
be6c381751 docs: Ensure we also check for python3 sphinx build exec suffixed without a hyphen. 2017-10-20 07:46:12 +10:00
Joshua Strobl
27a0db37d8 Merge Logitech G403 devices files. 2017-10-20 07:37:03 +10:00
Peter Hutterer
5858816b53 hidpp20: fill the led modes from the 8070 effect ids
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-19 09:23:56 +10:00
Peter Hutterer
a1376180b4 hidpp20: check for monochrome only effects in 8070
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-19 09:23:56 +10:00
Peter Hutterer
75d1400206 hidpp20: set the LED caps based on what the device reports
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-19 09:23:56 +10:00
Peter Hutterer
78475a6d15 hidpp20: use the full getInfo request, not just the count
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-19 09:23:56 +10:00
Peter Hutterer
63f93111fb hidpp20: remove unused reg paramater
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-19 09:23:56 +10:00
Benjamin Tissoires
1ea21ed6ce ratbagd: clean up ratbag devices on SIGINT
Or valgrind complains a lot.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-18 16:12:44 +02:00
Benjamin Tissoires
18a8fb9651 hidpp20-drv: cleanup hidpp20drv_update_button*
There is no point anymore to have an extra 'action' argument, and make
both type of function look the same.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-18 08:25:45 +10:00
Benjamin Tissoires
2e836a40d3 macro: fix memleak, again
action->macro is supposed to be allocated once and stay for the
entire life of the button. However, it was outrageously overwritten
when setting the action. Take some actions and keep the macro action
around.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-18 08:25:45 +10:00
Benjamin Tissoires
c09872e589 macro: fix memleak
The group is set but never freed.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-18 08:25:45 +10:00
Thomas Hindoe Paaboel Andersen
575b7bce98 add driver and svg for steelseries rival 310
The driver does not yet support button mappings or any
non-solid LED modes.

The device does not support reading out the current
configuration. On probe some default values are used
to get a usable profile.
2017-10-18 00:19:12 +02:00
Thomas Hindoe Paaboel Andersen
3e04abde30 add function to remove capabilites 2017-10-18 00:19:12 +02:00
Thomas Hindoe Paaboel Andersen
790c5e90bd add RATBAG_LED_TYPE_SCROLL_WHEEL 2017-10-18 00:19:12 +02:00
Thomas Hindoe Paaboel Andersen
85a358e07c G9: remove DPI 0 2017-10-18 08:12:27 +10:00
Thomas Hindoe Paaboel Andersen
3af0544421 hidpp10: fix last entry in dpi_list_from_range 2017-10-18 08:12:27 +10:00
Peter Hutterer
f69b4d53f6 hidpp20: implement 8060 adjustable report rate
The bitmask in the 8060 report is for ms between reports. We could do all, but
really we only care about a few resolutions, anything else is too niche to
bother with.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Peter Hutterer
cb4be02a56 tools: add 'rate get-all' to the resolutions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Peter Hutterer
bacdab2596 Sanity-check the list of dpi values and report rates
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Peter Hutterer
ec7bb2f63a Add list of report rates to the resolutions
Same blueprint as the list of DPI values

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Peter Hutterer
74a5551a8d Allow for zero number of dpi values to be set
At least in the DBus API we can't just say "doesn't exist", so let's allow for
a zero-sized list.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Peter Hutterer
3e0c803a37 driver-hidpp20: fix some indentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Peter Hutterer
55682c3a5d tools: add dpi get-all to the ratbagctl man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Peter Hutterer
ae9e287b8d Fix a comment referring to a function name in the typemap
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Peter Hutterer
03c264cec1 tools: remove erroneous 'self' in function call
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Peter Hutterer
410e01de61 gskill: add a missing empty line
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Peter Hutterer
d167dfd83b gskill: init the DPI list correctly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Peter Hutterer
9b7d8f5f24 Fix missing nres assignments
For directly set resolution lists, nres remained at 0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Benjamin Tissoires
366fbc3fda Fix some flake8 warnings
$> flake8-3 tools/ratbagctl.devel.in tools/ratbagctl.in tools/ratbagctl.test.in .
tools/ratbagctl.in:166:1: E302 expected 2 blank lines, found 1
tools/ratbagctl.in:173:25: E201 whitespace after '['
tools/ratbagctl.in:173:68: E202 whitespace before ']'
tools/ratbagctl.in:314:1: E302 expected 2 blank lines, found 1
tools/ratbagctl.in:318:1: E302 expected 2 blank lines, found 1
tools/ratbagctl.test.in:281:43: E261 at least two spaces before inline comment
tools/ratbagctl.test.in:302:31: E261 at least two spaces before inline comment
tools/ratbagctl.test.in:306:43: E261 at least two spaces before inline comment
tools/ratbagctl.test.in:337:43: E261 at least two spaces before inline comment
tools/ratbagctl.test.in:576:1: E302 expected 2 blank lines, found 1

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 19:06:57 +02:00
Benjamin Tissoires
f1d20f1f35 tools: ratbag-command.py: fix new resolutions list
This one gets a little bit meesy given that the libratbag expects a
C array. Provide some wrapping aound it and hope we won't have to
do it again and again.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 19:06:57 +02:00
Benjamin Tissoires
558f59b52c tools: replace ratbag-command.c with ratbag-command.py
Let the .c file die, and try to maintain the python version only.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 19:06:57 +02:00
Benjamin Tissoires
1a3ef63519 tools: ratbag-command.py: add verbose mode
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 19:06:57 +02:00
Benjamin Tissoires
17380baae9 tools: ratbag-command.py: lazy evaluation of the devices
We do not need to parse all the devices, but only the one given in the
command line. Make ratbagc.py handle this case properly.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 19:06:57 +02:00
Benjamin Tissoires
314c3e2f78 ratbag-command.py: allow valgrind to show something useful
sudo valgrind --suppressions=./tools/valgrind-ratbag-command.supp \
              --leak-check=full \
              python3 ./build/ratbag-command.py

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 19:06:57 +02:00
Benjamin Tissoires
6ba5cc3319 meson.build: shut up a warning for the generated swig python wrapper
It's generated and it works, no need to have the missing-prototypes
warning on.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 19:06:57 +02:00
Benjamin Tissoires
1148d172b5 Generate a direct python wrapper around libratbag with swig
And use it to create ratabg-command.py

Benefits are that we bypass ratbagd, meaning we can attach gdb or run
valgrind on the tools themselves.

Problem is the python wrapper doesn't clean up after itself, and so
running valgrind is moot

Fixes #274

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 19:06:57 +02:00
Benjamin Tissoires
a930cdad87 ratbagctl: update man
Should be closer to the truth now.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 12:02:56 +02:00
Peter Hutterer
b951d83a64 Add ratbagd_led_has_mode() and the required dbus additions
To be able to query which modes are available.

Exposed via ratbagctl as
./build/ratbagctl.devel led 0 capabilities event4

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-16 08:47:32 +10:00
Benjamin Tissoires
f56df6b1d0 enums.h: few doc fixups
Replacing the doctext where they should be in enum ratbag_led_mode.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 07:09:26 +10:00
Benjamin Tissoires
1e35b2ace6 circle.yml: cache dnf packages
We are reusing a lot the fedora container, but we need to always download
and install the same set of packages. Store them in the workspace to
speed up the tests.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-13 18:29:35 +02:00
Benjamin Tissoires
e75c20a249 circle.yml: fix doc deploy key
Of course, it was working on the local tests, but broke on upstream.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-13 18:24:54 +02:00
Benjamin Tissoires
c63ffdd3ef circle.yml: deploy docs when the master branch is updated
Note that the push requires a specific private key in the libratbag
circle CI organization, meaning that only the master branch of libratbag
will be allowed to push to the doc repo.

Note also that only the master branch will trigger the request:
- any PR will not trigger the request
- any push on the master branch of a personal repo will fail while
  attempting to write the docs, if the repo is setup to use circleCI too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-13 17:47:26 +02:00
Peter Hutterer
40658c6d0e hidpp10: pass the dpi list to libratbag as-is
If our device only has a discrete number of DPIs, pass it on as-is to
libratbag rather than pretending it's a range and then failing to set the
DPIs.

For the actual ranged devices we use libratbag's now-exponential range
mapping rather than passing all possible ones on. This relies on us having the
same steps that libratbag uses, should be safe enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 17:46:05 +02:00
Peter Hutterer
251efd3b40 tools: add dpi get-all to ratbagctl
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 17:46:05 +02:00
Peter Hutterer
94320099b0 Convert the resolution range into something resembling an exponential one
Because 8000 vs 8050 dpi shouldn't matter...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 17:46:05 +02:00
Peter Hutterer
f592cabcd7 Replace the resolutions min/max with an explicit list of dpi values
Previously, we could get a min/max value but there was no guarantee that it
any value in between would actually work on the device. Some devices have a
discrete number of resolutions (e.g. 500, 1000, 2000, 2500), most others have
at least a minimum step size (so 1234 isn't a valid dpi value).

Change the min/max to a discrete list of which resolutions are supported. This
allows a UI to adjust its interface dynamically - e.g. a combobox if there are
only 3 resolutions or a slider if there are a million of them.

This is a DBus API break

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 17:46:05 +02:00
Peter Hutterer
a58096fade tools: always print 'dpi' after resolutions
We printed '500' but '500x500dpi', let's make this consistent.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 17:46:05 +02:00
Peter Hutterer
b140bc2827 test: add dpi min/max tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 17:46:05 +02:00
Peter Hutterer
aeaa69b9e1 Move the log defines higher so we can use them anywhere
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 17:46:05 +02:00
Peter Hutterer
a535897ae7 Use Sphinx for the DBus interface documentation
Better than the markdown we were using before, even though we're currently
(ab)using the js/c++ domains for the structure. There is no DBus domain in
sphinx yet.

The main motivation was to get the enums into the documentation since they are
exported ABI.

Generating the documentation is quirky - we use doxygen to extract the
comments from the C header file and then use XSLT to convert to .rst which
sphinx can use. Still better than having to maintain even more copies of the
enums.

Since this is only of interest for maintainers that need to upload the
documentation, it is turned off by default.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 08:59:33 +02:00
Peter Hutterer
1074a2b2e6 circle.yml: drop doxygen and graphviz - obsolete now
We're not building docs anymore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 08:59:33 +02:00
Peter Hutterer
51c1be3806 Move the enums into their separate header file
libratbag is not a library anymore. Move all the stuff that we need for the
DBus interface (i.e. the enum values) into its own header file so they're
all in one place and we don't have to worry about it anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 08:59:33 +02:00
Peter Hutterer
b9e647ccb8 Remove c++ guard
libratbag is not a public header, so we don't have to worry about C++ anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 08:59:33 +02:00
Thomas Hindoe Paaboel Andersen
e063aa3d2a hidpp10: Fix LED read/write
With this the LEDs can be read and written on the G9.

The G9 is as far as I know the only hid++1.0 mouse with RGB LED. The
other mice are monochrome.
2017-10-12 08:07:59 +10:00
Peter Hutterer
9a74e30c64 Use foreach loops to iterate though the profiles
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-11 09:14:56 +02:00
Peter Hutterer
f26de4bb29 Change driver probe() as a flat function
Previously, probe() would call ratbag_init_profiles() which in turn would call
the various function pointers in the driver to fill in profiles, buttons and
leds (the latter while filling in profiles). This made the probe() function
harder to understand than necessary and unreliable because it wasn't always
clear which bits were already set up while some driver function was called and
which ones weren't yet.

This patch switches to a flat probe(). The driver still needs to call
ratbag_init_profiles(), libratbag sets up everything (to default values). Then
the driver can fill in the rest as it wants.

This patch still makes use of the current infrastructure, the drivers
just call the read_profile and read_button functions manually now.

Fixes #370

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-11 09:14:56 +02:00
Peter Hutterer
e9008eeaba Align resolution creation with the button/profile/led creation bits
Resolutions were still stored in an array over a linked list like the
buttons/leds/profiles and initializing them from a driver was different than
buttons or leds. This brings the resolutions in line with the buttons and
leds.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-11 09:14:56 +02:00
Peter Hutterer
d5dc8eccd6 DBus: some more documentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-11 09:13:44 +02:00
Peter Hutterer
13736d0ced DBus: thighten the definition of the 'Id' for a device
We can't guarantee it's a sysname even though that is what we use for evdev
devices. Future devices may just be some custom-assigned name for a remote
dbus API

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-11 09:13:44 +02:00
Peter Hutterer
a926afe8de ratbagd: standardise the log messages a bit better
Prefix with the sysname of the device, then have a 'failed to ...'

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-11 09:13:44 +02:00
Peter Hutterer
af78dc4ec2 ratbagd: rename device->name to device->sysname
Because that's what it is and it makes it less confusing in the code

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-11 09:13:44 +02:00
Peter Hutterer
1c85d77d56 data: add LedTypes keyword argument to the device files
At least on HID++ 2.0, the LED types appear to be random and don't match the
protocol specs. Other protocols don't even have those bits, so let's make this
a generic entry.

This is pre-filled for all LEDs but drivers can override it where required.

Fixes #377

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-10 09:30:50 +10:00
Peter Hutterer
c8929b50fa meson: fix default value in meson_options.txt
Keyword is named 'value', not 'default'

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-10 08:41:55 +10:00
Peter Hutterer
e58e79cb8d Fix a comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-10 08:41:55 +10:00
Joshua Strobl
049e12b2eb Correct G403 ID. Added Wireless-specific G403 device file. 2017-10-09 21:37:22 +02:00
Benjamin Tissoires
5c71f9552d tools: ratbagctl: make flake8 happy
tools/ratbagctl.in:146:92: E128 continuation line under-indented for visual indent
tools/ratbagctl.in:147:92: E126 continuation line over-indented for hanging indent
tools/ratbagctl.in:154:91: E128 continuation line under-indented for visual indent
tools/ratbagctl.in:155:91: E126 continuation line over-indented for hanging indent
tools/ratbagctl.in:161:118: E128 continuation line under-indented for visual indent
tools/ratbagctl.in:162:118: E126 continuation line over-indented for hanging indent

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-09 19:17:32 +02:00
Benjamin Tissoires
c3be9e1af1 tools: ratbagctl: add missing led types
Or the G502 fails while reading the LEDs

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-09 19:14:04 +02:00
Peter Hutterer
186d626c40 Remove RATBAG_LED_TYPE_UNKNOWN from the enum list
A driver is supposed to know what type an LED is, unknown doesn't help anyone
here. So replace this with a private #define and abort when a driver doesn't
set the type. This also adds a requirement that any driver initializing a LED
must have the read_led() function, otherwise we can't fill it in correctly.

And bump the enum up by one, the first valid value should start at 1 (or some
other non-boolean value).

Related #365
Fixes #364

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 19:12:17 +02:00
Peter Hutterer
dfc433cb74 test: fix LED indexing
Leftover from when we used the LED type as indices, that hasn't been true for
a while.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 19:12:17 +02:00
Peter Hutterer
ab2dae47af hidpp20: require HIDPP_PAGE_COLOR_LED_EFFECTS for LEDs to work
If HIDPP_PAGE_COLOR_LED_EFFECTS fails but the profile returns a nonzero LED
count we crash later in hidpp20drv_read_led() because all the led info is
null.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 19:12:17 +02:00
Peter Hutterer
ec442b960d hidpp20: don't set the device's num_leds, it's overwritten later
This should all be handled by libratbag, not the driver.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 19:12:17 +02:00
Benjamin Tissoires
670720b40f hidpp20: fix .type parsing for sw_leds
struct hidpp20_led_sw_ctrl_led_info holds a u8 for the .type field.
Attempting to convert a value which is already a u8 ends up setting
0 and thus discarding the type information.

Fix by removing the extra step.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-09 19:12:00 +02:00
Ogier Bouvier
0787e35964 data: add device file and svg for Logitech G703 wired
Signed-off-by: Ogier Bouvier <obouvier@logitech.com>
2017-10-09 12:12:26 +10:00
Peter Hutterer
9f4df9582c test: move an not-null assert to above where we deference it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 12:01:56 +10:00
Peter Hutterer
d282590746 test: set all leds to logo
Because that's exactly what we rely on right now - zalloc sets it to 0 which
is type logo.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 12:01:56 +10:00
Peter Hutterer
9e5047976b hidpp10: rename a variable from 'profile' to 'typestr'
To avoid confusion

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 12:01:56 +10:00
Peter Hutterer
d69a2ec5ba hidpp10: use _cleanup_ for a profile
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 12:01:56 +10:00
Peter Hutterer
4bfd5d9a13 Add helper functions to loop through profiles, buttons and leds
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 12:01:56 +10:00
Peter Hutterer
091e651831 Fix a comment, the deprecated functions *should* be removed
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 12:01:56 +10:00
Thomas Hindoe Paaboel Andersen
d52c2c0320 hidpp10: remove empty callback
write_profile is deprecated and none of the other drivers have an empty
implementation like this.
2017-10-07 09:39:22 +10:00
Thomas Hindoe Paaboel Andersen
cd71ce67b1 hidpp10: only update current resolution once per commit
With the swtich to the commit style the function
hidpp10drv_write_resolution_dpi is doing too much work.

Before commit style the function would:
* get the profile
* get the current resolution
* write the profile (resets it to default dpi)
* set the current (updated) resolution

With the commit style we call the function for every resolution
in every dirty profile we now:
* get the current resolution
* set the current (updated) resolution
Then later:
* write the profile (resets to default dpi)

This patch changes this to only doing one set of the current resolution
when the active profile has been written. This reduces the traffic to the
device and sets the current resolution after the profile write.
2017-10-05 17:20:49 +02:00
Thomas Hindoe Paaboel Andersen
43f501907e hidpp10: fix setting resolution on G9
The G9 sends a short report and does not
have separate DPIs for x and y.
2017-10-05 17:20:49 +02:00
Peter Hutterer
d26d5b83f1 test: set RATBAG_TEST in code, not in meson
It's a fixed value so it's much easier to set this in the test binaries rather
than requiring the user to set this in the env before running a test manually.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-04 18:53:25 +10:00
Peter Hutterer
c401414310 tools: update ratbagd.py for the new logo types
Added in 835a694c4b

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-04 10:13:53 +10:00
Thomas Hindoe Paaboel Andersen
c34fe85780 G9: add entry for LEDs count 2017-10-03 23:06:01 +02:00
Thomas Hindoe Paaboel Andersen
a19a79d33a hidpp10: add Leds entry to .device file
For the device I have I do not see a way to get
this information by querying the device.

If the value is set in the .device file it will
override anything that the hidpp10 driver itself
would have found.
2017-10-03 23:06:01 +02:00
Ogier Bouvier
8edf6e7609 tools: use new RATBAG_LED_TYPEs
Signed-off-by: Ogier Bouvier <obouvier@logitech.com>
2017-10-03 19:48:32 +10:00
Ogier Bouvier
835a694c4b driver-hidpp20: add feature discovery for 0x1300
fix #325

Signed-off-by: Ogier Bouvier <obouvier@logitech.com>
2017-10-03 19:48:32 +10:00
Ogier Bouvier
a47492e62c hidpp20: add support for non-RGB LEDs, feature 0x1300
Signed-off-by: Ogier Bouvier <obouvier@logitech.com>
2017-10-03 19:48:32 +10:00
Peter Hutterer
186a1deda8 led: change RGB to RGB888 and add 1-bit RGB
1-bit RGB is needed for the Logitech G300, let's rename the main RGB to
indicate how many bits we actually have.

See #335

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-03 08:58:34 +02:00
Thomas Hindoe Paaboel Andersen
132212652f G9: add .svg for GNOME 2017-10-02 22:31:40 +02:00
Peter Hutterer
5a40d93a30 ratbagd: disable coredumps in ratbagd.devel
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-02 10:25:24 +02:00
Peter Hutterer
f62940c1e5 tools: specify the full path for the dbus permissions file
Since we unconditionally call unlink() on that path later, let's make sure
we actually copy to that file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-02 10:25:24 +02:00
Peter Hutterer
0f808ed387 tools: fix a linebreak to be less confusing
We os.path.join the first to arguments, fix the line breaks so this is obvious

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-02 10:25:24 +02:00
Peter Hutterer
d8edf2d9e4 tools: unlink the dbus file if ratbagd.devel fails to start
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-02 10:25:24 +02:00
Jente Hidskes
6827f5ed81 tools/ratbagd.py: sync with Piper 2017-09-30 08:51:50 +10:00
Thomas Hindoe Paaboel Andersen
f3208b499b G300: set the color depth 2017-09-29 00:18:22 +02:00
Thomas Hindoe Paaboel Andersen
94e0842a06 G300: add support LEDs 2017-09-29 00:18:22 +02:00
Thomas Hindoe Paaboel Andersen
e0de98ba01 set CAP_LED for mice with only 1 LED
Even if there is only 1 LED we should set
the cap to let Piper change it in the GUI
2017-09-28 09:06:28 +10:00
Thomas Hindoe Paaboel Andersen
1adb147f6d expand documentation of probe call
Add a comment that drivers are expected to initialize and
read all profiles in the probe callback.

Fixes #333
2017-09-28 09:05:59 +10:00
Peter Hutterer
b1c4bba3b2 led: add support for color depth
The initial value of 400 in the enum is chosen so it looks weird when someone
tries to interpret the value as integer. Values of 1, 2, 4, etc. could be
confused with something realistic.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-22 09:18:28 +02:00
Thomas Hindoe Paaboel Andersen
cdbdcd23e6 G300: set min/max DPI 2017-09-21 19:21:28 +02:00
Thomas Hindoe Paaboel Andersen
23d1290b22 G300: set the active resolution
It was implemented but never used before. Use it when writing the
active profile.O
2017-09-21 08:51:21 +10:00
Thomas Hindoe Paaboel Andersen
5edcdfba5b G300: use int instead of signed 2017-09-20 15:55:37 +10:00
Thomas Hindoe Paaboel Andersen
6d105a002c G300: fix writing multiple profiles
Writing multiple changed profiles was broken as we would exit the
loop after the first profile write. We were returning the number
of bytes written and this was interpreted as an error.

Fix it my returning 0 when we have written the correct number of
bytes to the mouse.
2017-09-20 15:55:37 +10:00
Ogier Bouvier
3b1a41f154 hidpp20: fix special button mapping
fix #348

Signed-off-by: Ogier Bouvier <obouvier@logitech.com>
2017-09-19 13:48:17 +02:00
Peter Hutterer
0153efbf9c Remove now superfluous libratbag.sym
We don't ship a library anymore, so dealing with library symbols isn't
necessary.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-18 14:24:50 +02:00
Jente Hidskes
db34ab5255 RatbagdButton: fix missed dbus return value
I missed this one in #336.
2017-09-17 21:34:47 +10:00
Benjamin Tissoires
52e10d029f tools: ratbagctl.test: assert on the ratbagd process
If we could not start the process, there is a high chance we are running
the tests against a different ratbagd implementation so there is no point.

Also, an exception will get raised later during the tear down of the
module saying that "'NoneType' object has no attribute 'terminate'".

This is less than ideal to notify that the process has not been started.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-15 08:55:34 +02:00
Benjamin Tissoires
1c94ef5c56 tools: ratbagctl: only warn that no devices are available in list_devices
If the other commands try to access a node, there will be an other error
("Unable to find device X"). So there is no points in having this as a
global check.

For the .devel and .test versions, we are guaranteed to have the
test_device at least, so no worries on this side too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-15 08:55:34 +02:00
Benjamin Tissoires
5efd83fc41 tools: make sure we check for ratbagd_process returncode
It was accidentally put as a dead code in 6cfca9e34b.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-15 08:55:34 +02:00
Jente Hidskes
33966989db ratbagd: add ACTION_SPECIAL_INVALID to the table
So we at least don't crash, see #383.
2017-09-14 16:02:56 +02:00
Ogier Bouvier
c56c76e07d hidpp20: fix resolution count detection
fix #343

Signed-off-by: Ogier Bouvier <obouvier@logitech.com>
2017-09-14 16:02:40 +02:00
Thomas Hindoe Paaboel Andersen
8440a36f92 G300 SVG: add 20 px margin 2017-09-14 09:49:41 +02:00
Thomas Hindoe Paaboel Andersen
3e31b45db0 SVG for G300 in GNOME theme 2017-09-14 09:49:41 +02:00
Ogier Bouvier
548a40dba6 hidpp20: store correct size for feature list
Signed-off-by: Ogier Bouvier <obouvier@logitech.com>
2017-09-13 10:17:37 +02:00
Benjamin Tissoires
c437882e96 tools: ratbag-command: info: make use of _cleanup_
Better code :)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Ogier Bouvier
4a61dc413b support sector size that are not multiple of 16
Signed-off-by: Ogier Bouvier <obouvier@logitech.com>

Squashed the comment into this
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
59df7defdb tools: add hidpp20-reset
Basically a nuclear weapon to reset the flash to 0.
Use it with caution!

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
77fa6a1e65 hidpp20: fill in all profiles, even if they are not there
If a profile is either wrong or not there, we rely on the ROM to get
a correct profile.

Fixes #280

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
0f8031c201 hidpp20: add commit API for onboard profiles
The driver is supposed to prepare everything in memory and then, at the
end commit on the device.

Bug #280 is still not fixed as we should initialize empty profiles first.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
5842dccc2a hidpp20: check if crcs are valid once on plug
To check if device is using ROM or Flash settings.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
0c5b1998a5 hidpp20: move down hidpp20_initialize
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
f52ebd0dba hidpp20: move up hidpp20_internal_profile
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
1857378a76 hidpp20: new memory model
Only reading/writing full sectors are allowed (because we need to set and
read the crc anyway).

Fixes #122

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
d2600583bb hidpp20: do not mixed hex and decimal
because this is bad

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
e2a4684f83 hidpp20: use min when possible
s/x <= y ? x : y/min(x, y)/

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
ed39cf3dee hidpp20: reshuffle onboard_profile allocate/initialize
allocate was actually both initializing and allocating through initialize.
Things started to get complicated.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
c4d3b1e606 hidpp20: fix Invalid writes
Valgrind complains...

Fixes 19451f9df7

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Benjamin Tissoires
be1fb30751 tools: ratbag-command: fix a memory leak
valgrind complains that we did not release the profile, so we shall.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-13 09:21:53 +02:00
Jente Hidskes
a2b3c32124 RatbagdResolution: clamp values instead of returning an error
We cannot return error codes, but requesting a resync is overkill.
Instead, let's be nice and clamp these values.
2017-09-13 08:44:50 +10:00
Jente Hidskes
26e7237010 RatbagdLed: clamp values instead of returning an error
We cannot return error codes, but requesting a resync is overkill.
Instead, let's be nice and clamp these values.
2017-09-13 08:44:50 +10:00
Jente Hidskes
26a6215122 RatbagdResolution: rename get_rate to get_report_rate for consistency 2017-09-13 08:44:50 +10:00
Jente Hidskes
376adfdf2a ratbagd: fix return values in dbus methods
See #316.
2017-09-13 08:44:50 +10:00
Jente Hidskes
d990e3f027 RatbagdDevice: add a Resync signal
This signal is emitted upon an internal error, signalling clients to
resync their values.

Related to #316.
2017-09-13 08:44:50 +10:00
Jente Hidskes
2473f66cb3 Move note on return values to the interface documentation 2017-09-13 08:44:50 +10:00
Jente Hidskes
8e9bf7b48a Add the Name property to the interface documentation 2017-09-13 08:44:50 +10:00
Peter Hutterer
7edae05b37 ratbagd: fix verbose_raw setting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-11 19:05:51 +10:00
Peter Hutterer
909749fc00 tools: drop the parser debug printfs
Not required anymore, I think

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-11 09:26:07 +02:00
Peter Hutterer
15b4b4a3ca tools: pass the verbosity arguments down to ratbagd
Starting with -vv, we print out the ratbagd log messages to stdout/stderr,
-vvv switches ratbagd to raw mode. We start at level 2 so that we can have the
single -v reserved for ratbagctl itself.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-11 09:26:07 +02:00
Peter Hutterer
cad05f1256 tools: parse the argument before starting ratbagd
No point starting ratbagd for things like --help or invalid commands

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-11 09:26:07 +02:00
Peter Hutterer
703e1f6f0d ratbagd: allow for --verbose=raw
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-11 09:26:07 +02:00
Ogier Bouvier
19451f9df7 hidpp20: fix last feature discovery
Signed-off-by: Ogier Bouvier <obouvier@logitech.com>
2017-09-08 15:40:55 +02:00
Thomas Hindoe Paaboel Andersen
3314b41202 hidpp10: fix outdated info message 2017-09-08 08:56:03 +10:00
Thomas Hindoe Paaboel Andersen
f636fd8f53 G300: set active resolution
For the active profile we read the active resolution
from the mouse during probe.

When changing the active profile we set the default
resolution to active.
2017-09-07 10:30:37 +02:00
Jente Hidskes
77847f570c tools/ratbagd: remove KeyMapping methods
Cleanup after afaf3fa83d.
2017-09-07 10:24:38 +02:00
Peter Hutterer
afaf3fa83d ratbagd: Drop KeyMapping from the DBus interface
Plan is to remove the key mapping altogether and make it transparent from the
Macro mappings (in libratbag/the drivers). Meanwhile, remove the DBus API so
nothing can actually start using it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-07 08:25:59 +02:00
Peter Hutterer
4c7f644599 hwdb: drop the remaining hwdb files
Now that we use the .ini style device configuration and everything has been
migrated, we don't need the hwdb/rules files anymore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-07 09:21:45 +10:00
Peter Hutterer
692f7f008a Fix typo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-07 09:21:45 +10:00
Benjamin Tissoires
0a62c3dfa8 hidpp20: fix mem leak
Valgrind complains about it, so let's fix it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-05 19:18:10 +10:00
Benjamin Tissoires
7cd2cfed44 tools: ratbagctl.devel: fix commit() async call
If we leave ratbagctl.devel too soon, ratbagd gets killed before it even
receives the async call for commmit(), meaning everything we do on the
device is lost.

0.5 is empirical. It seems on my system 0.2 is enough (0.1 doesn't seem
to work). Hopefully this value is not device dependent.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-04 19:55:53 +10:00
Benjamin Tissoires
c31e11d385 tools: fix permissions for ratbagctl
not sure why, but stat.S_IEXEC only sets exec permission for the user,
meaning that the installed file can't be run by anybody else than root.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-04 19:55:53 +10:00
Thomas Hindoe Paaboel Andersen
efe6021e76 G300: fix profile switching
The profile ID's used are:
  profile 0: 0x80
  profile 1: 0x90
  profile 2: 0xA0

These were miscalculated as 0x80, 0x81, and 0x82.
2017-09-04 09:25:38 +10:00
Stephen Kitt
8d67389042 Don't install ratbag-command manpage
Since we no longer install ratbag-command itself, there isn't much
point installing its manpage.

Signed-off-by: Stephen Kitt <steve@sk2.org>
2017-09-04 08:24:34 +10:00
Peter Hutterer
4037587f74 Get the libratbag data dir from the environment variable
And set it for the tests, so we can test with in-tree files.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-01 09:49:32 +02:00
Peter Hutterer
94daeb1444 ratbagd: split the test device out into a seprate file
It always bothered me that it was in the middle of the normal ratbagd, which
made fiding it more effort than neccessary. Split it out into a separate file
so it's easily identifiable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-01 09:30:38 +02:00
Peter Hutterer
937b30c415 circle.yml: set LANG to UTF-8
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-01 07:37:03 +02:00
Peter Hutterer
6f0242f05b Add missing include for stdint.h to libratbag-test.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-01 10:53:37 +10:00
Thomas Hindoe Paaboel Andersen
921837fd0f ratbagctl: typo fix 2017-08-31 21:32:28 +02:00
Jente Hidskes
d06cdcc53c tools/ratbagd.py: sync with Piper 2017-08-31 15:25:38 +02:00
Benjamin Tissoires
5828355426 Fix flake 8 warnings
./tools/toolbox.py:105:1: E302 expected 2 blank lines, found 1
tools/ratbagctl.in:369:13: F821 undefined name 'RatbagdMacro'

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-08-31 15:06:08 +02:00
Jente Hidskes
50dc321b7b tools/ratbagctl.in: use RatbagDevice's active_profile property 2017-08-31 14:34:03 +02:00
Jente Hidskes
43f033db80 tools/ratbagctl.in: use RatbagProfile's active_resolution property 2017-08-31 14:34:03 +02:00
Jente Hidskes
623c53f1e4 tools/ratbagctl.in: use RatbagdMacro to print the macro 2017-08-31 14:34:03 +02:00
Jente Hidskes
39762718b9 tools/ratbagd.py: sync with Piper 2017-08-31 14:34:03 +02:00
Benjamin Tissoires
ae3804f7b4 tools/toolbox.py: add dbus sync helper function
A quick and easy way to sync anything coming from dbus (like property updates)
without needing to be hooked into a glib mainloop directly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 14:34:03 +02:00
Peter Hutterer
0dd08dfb84 tools/ratbagctl.test.in: decode ratbagctl output with utf8 for the tests
The macros with their fancy characters need utf8, not ascii

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 14:34:03 +02:00
Peter Hutterer
bb23f68d53 util: avoid reallocation of zero-sized memory in dpi list parsing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 09:48:52 +02:00
Peter Hutterer
83345a17d2 hidpp20: add an assert to shut up scan-build
Not sure why it thinks we're potentially dereferencing a NULL-pointer here but
from the trace it looks like it thinks macro and a previously nullified
profile->macros are the same. They aren't, macro was just allocated here and
shouldn't be NULL if we get here.

Anyway, add an assert and move on.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 09:48:52 +02:00
Peter Hutterer
b9f6554767 ratbagd: fix enum type for resolutions
Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 09:48:52 +02:00
Peter Hutterer
7eadd20879 hidpp10: fix a coverity warning about OOB access
Make sure that the index we pass into long_clear_bit is never higher than the
number of bits in the single long we use as array here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 09:48:52 +02:00
Peter Hutterer
3844a60837 hidp20: fix dead code in macro parsing
If rc is positive, it's the number of items.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 09:48:52 +02:00
Peter Hutterer
6cdf8a901a ratbagd: fix use of potentially unused variable
Simply abort if the macro value is bad, that's a libratbag bug and should
never happen.

Found in #312

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 09:48:52 +02:00
Peter Hutterer
c868c43179 tools: fix use of unset variable
Found in #312

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 09:48:52 +02:00
Peter Hutterer
01ca2a6de7 ratbagd: drop the unused IsActive and IsDefault resolution signals
Obsolete, now that we're just updating the property.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 09:37:59 +02:00
Peter Hutterer
d64af72f74 ratbagd: fix profile IsActive property changes
We sent a signal out but not the "property has changed" signal we actually
needed.

Fixes #295

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 09:37:59 +02:00
Peter Hutterer
c2fe745813 data/gnome: add a quick and dirty SVG checker for the GNOME SVGs
Checks for the three layers we need and that any buttons in the files are
consecutive and have the right layers

Fixes #196

Co-authored-by: Jente Hidskes <hjdskes@gmail.com>
2017-08-31 08:40:58 +02:00
Peter Hutterer
ddefbf95a3 test: ignore python allocation leaks in our valgrind runs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 08:40:58 +02:00
Peter Hutterer
a2b651985e data/gnome: fallback: add missing button6-path
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 08:40:58 +02:00
Jente Hidskes
788c261ce9 data/gnome: roccat kone XTD: add missing leaders for wheel tilt buttons 2017-08-31 08:40:58 +02:00
Peter Hutterer
35070cc17e data/gnome: roccat kone XTD: fix button numbering
Somehow I skipped over buttons 7 and 8

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 08:40:58 +02:00
Jente Hidskes
79be057e91 data/gnome: G502: add missing text-align style property 2017-08-31 08:40:58 +02:00
Peter Hutterer
aa8f506dd0 data/gnome: G502: fix SVG to be 400 pixels height
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 08:40:58 +02:00
Peter Hutterer
c6486b1960 tools: add missing vim config line to toolbox.py
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 14:08:23 +10:00
Peter Hutterer
2f8e3a1610 tools: fix typos in test case class names
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 14:08:20 +10:00
Peter Hutterer
432d32bedc ratbagd: set the active profile before sending signals
Found by @bentiss, see #295

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 13:08:41 +10:00
Peter Hutterer
8cb2d21ff5 Remove unnecessary NULL check before free()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 13:03:07 +10:00
Peter Hutterer
1103c208a8 ratbagd: if the svg doesn't exist, supply the fallback one
We keep the hardcoded fallback.svg for the test device, otherwise we get an
error every time we start ratbagd.devel

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-31 10:48:38 +10:00
Peter Hutterer
7e59f0f974 data: add a fallback.svg file
This SVG is generic enough to cover 7-button mice with up to 3 LEDs that are
supported but don't have an SVG. The SVG style is intentionally NOT a generic
mouse to make it obvious that something isn't right here. If we use a generic
mouse, people may not put the effort into a proper SVG style because the
generic mouse is good enough.

The fallback is currently only used for test devices
2017-08-31 10:48:38 +10:00
Benjamin Tissoires
c647d6df99 profiles: add name get/set capability
Some devices can have a custom name, so let's export that capability.

In ratbagd, libratbag/ratbag_profile_set_name() returns an error, we
put it under silence, the client has to check for the capabilities
before asking ratbagd to change the profile name.

Fixes: #266

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-08-31 10:22:51 +10:00
Benjamin Tissoires
97a927bb7d profiles: add a per profile capabilities field
Doesn't do much now without the next commit

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-08-31 10:22:51 +10:00
Benjamin Tissoires
7c650aeeca tools: ratbagctl: add "name" command to return the device name
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-08-31 10:22:51 +10:00
Thomas Hindoe Paaboel Andersen
3fd7cd0137 improve error for missing device files 2017-08-31 08:17:15 +10:00
Thomas Hindoe Paaboel Andersen
7e97936f0e reset GError before reuse
If the error variable is not reset then we may end up freeing it
again in the next block. This can cause problems later for glib.

Fixes #311
2017-08-31 08:07:19 +10:00
Peter Hutterer
643a4a89f4 ratbagd: fix assertion error when quitting with more than 1 devices attached
RATBAGD_FOREACH_DEVICE does not allow unlinking the device during the loop.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-30 09:42:47 +10:00
Peter Hutterer
cfd93cf332 drop now obsolete ratbag_device_get_udev_property
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-28 17:50:20 +02:00
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>
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
Jente Hidskes
0a6b4b3778 ratbagd: change the led type to the enum 2017-07-26 18:07:19 +02:00
Jente Hidskes
b4f451285e ratbagd: change the special mapping to the enum 2017-07-26 18:07:19 +02:00
Jente Hidskes
5f0ebdead7 tools/ratbagd.py: sync with Piper 2017-07-26 10:16:55 +02:00
Benjamin Tissoires
de3bb0e579 implement resolution active set (#249)
Fixes #80

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-26 08:32:16 +02:00
Benjamin Tissoires
9dcd2c6c05 trivial flake8 fixes
whitespaces, missing RatbagdButton and more whitespaces

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 18:44:04 +02:00
Benjamin Tissoires
34196c9960 tools: ratbagd.py: add readwrite=False when we are using explicit setters
Assigning an action on a button has some side effects, and this is why we
do not have writable properties on those.
Mark the _set_dbus_property() as read only so we do not get a bunch of
PropertyReadOnly exceptions.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 18:24:10 +02:00
Peter Hutterer
5399d15658 ratbagd: add support for test device button types
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 18:24:10 +02:00
Peter Hutterer
5f98d8d029 ratbagd: rename test's button type to action_type
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 18:24:10 +02:00
Peter Hutterer
10903e2434 ratbagd: change the button type to the enum value
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 18:24:10 +02:00
Peter Hutterer
b7f53effa1 ratbagd: add macro support
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 18:24:03 +02:00
Peter Hutterer
129551f3f4 ratbagd: add support for macros in the test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 17:17:03 +02:00
Peter Hutterer
4f62424e8a driver-test: fix macro initialization
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 17:17:03 +02:00
Peter Hutterer
ae65ab3ae8 tools: ratbagctl: fix printing of special key map
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 17:17:03 +02:00
Peter Hutterer
96067f18ca ratbagd: change the key action types to enums
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 17:16:54 +02:00
Peter Hutterer
67e1c8667b Change enum value of the unknown value type
Keeps the values as uints

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 16:47:27 +02:00
Peter Hutterer
ab67517584 tools: fix typo - s/UNKOWN/UNKNOWN/
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 16:47:27 +02:00
Peter Hutterer
9fe892f10f tools: ratbagctl: add support for resolution default set/get
https://github.com/libratbag/libratbag/issues/246

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 12:17:15 +02:00
Peter Hutterer
bf18e9b795 ratbagd: fix resolution_set_default
https://github.com/libratbag/libratbag/issues/246

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 12:17:15 +02:00
Peter Hutterer
e95bb9601c tools: ratbagd: skip superfluous is None check
We'll throw an exception before this happens

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 12:17:15 +02:00
Jente Hidskes
a16ffa3946 DBusInterface: mark Resolution as read-write 2017-07-25 11:27:08 +10:00
Peter Hutterer
8c97a12741 Don't install ratbag-command
libratbag is now a static library only and the only exposed interface is the
DBus interface. We have ratbagctl for that interface.

ratbag-command shouldn't be installed, it becomes a pure developer tool now.
We still keep it around for that reason, but let's not install it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 11:14:13 +10:00
Peter Hutterer
0982d6a4a9 Drop libratbag as separate library
Now that ratbagd is part of libratbag, the DBus interface is the preferred way
to interact with a device. Shipping libratbag as a .so file means we have to
worry about two ABIs when it's unlikely that anyone ever uses the libratbag.so
directly.

Make it a static library internally instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 11:14:13 +10:00
Benjamin Tissoires
3160d86050 tools: ratbagctl: do not use chevrons and report active profile
ratbag-command uses parentheses, not chevrons, and it also reports
which profile is currently active.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 11:09:24 +10:00
Benjamin Tissoires
6faa59c70d tools: ratbagctl: add support for separate X/Y resolutions
Big commit because of the test suite changes.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 11:09:24 +10:00
Benjamin Tissoires
ced958f135 hidpp10: implement enable/disable profiles
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 11:06:59 +10:00
Benjamin Tissoires
d5ccaed457 hidpp10: implement commit API
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 11:06:59 +10:00
Benjamin Tissoires
2c799eca30 hidpp10: correctly retrieve the profile directory and use it
We need to read the directory and the profiles only once.
Nothing tells us how many profiles are supported, so use the specifications
from Logitech website, and add a hwdb entry for those.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 11:06:59 +10:00
Benjamin Tissoires
98fb63e2e3 hidpp10: assign the active resolution when the profile is not active
Same than hidpp20.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 11:06:59 +10:00
Benjamin Tissoires
55bab29233 hidpp20: enable/disable profiles and report it correctly
Bunch of errors while processing the dictionary of enabled profiles.
Got everything working out quite well on the G900 and G403, so I guess
others should behave properly.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 11:06:59 +10:00
Benjamin Tissoires
c0c77100ad ratbagd: implement enable/disable profile
We also maps the commands to ratbag-command.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 11:06:59 +10:00
Benjamin Tissoires
aa50df8eaf tools: ratbag-command: fix enable/disable profiles
The usage help is wrong, it's not how it works.
It'll be too much pain to fix it the other way around, and I prefer
using "ratbag* profile N enable" than "ratbag* profile enable N".

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 11:06:59 +10:00
Benjamin Tissoires
c12ca6008a tools: ratbagctl: add missing commits
On devices supporting the commit API, ratbagctl did not write anything
to the device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 11:06:59 +10:00
Peter Hutterer
c6bc6b2576 tools: ratbagd: don't silence UnknownProperty errors
Now that we've moved all properties to read-write where required, unleash the
exception again - any UnknownProperty error is now a bug.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
f53bf7d4ad ratbagd: make the LED properties writable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
40bd189cc0 ratbagd: make the resolution properties writable
This also drops the separate x/y properties and instead just returns a tuple
for "Resolution".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
7097f1dea6 ratbagd: remove GetResolutionByIndex
This is superfluous, it's trivial enough to get the Resolutions property and then
work with that. We're not talking about a huge amount of data anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
70f3da98db ratbagd: add IsActive/IsDefault to Resolution
This replaces the calls in the profile.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
f281bd751e ratbagd: drop 'GetProfileByIndex'
This is superfluous, it's trivial enough to get the Profiles property and then
work with that. We're not talking about a huge amount of data anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
04b54d26e2 ratbagd: add 'IsActive' property to the profile
Instead of a GetActiveProfile in the device, make this a property of the
profile. The SetActive method stays around, it's less prone to mis-use than
the property since we cannot allow a caller to go "profile.is_active = False"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
19cdf6d7e9 ratbagd: drop SvgPath property from device
Obsolete now that we have theme support, use GetSvg() instead

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
0018431f31 ratbagd: remove DeviceNew/DeviceRemoved signals
Our device list is so small that having separate signals is a bit pointless,
updating the property should be sufficient.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
8380e1686b Tidy up the dbus documentation
Use more sectioning and more precise descriptions of the function signatures.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
c14ffe36e3 ratbagd: send a PropertyChanged signal when modifying the device list
We have DeviceAdded and DeviceRemoved signals but given the expected number
of devices (less than 2 in most cases) it's easier to just update the Devices
property. The DeviceAdded/Removed signals stick around for now, they will be
removed later.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
a4dd9bcdf3 ratbagd: change the remote property value when writing a property
set_cached_property merely updates the proxy's own copy, it doesn't do
anything to the remote. Manually call the DBus.Properties.Set interface
to do that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
c1cabeeeeb meson: reduce the valgrind test timeouts
Factor 5 should be enough, factor 100 is a bit excessive

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 10:32:41 +02:00
Peter Hutterer
ca69365a86 meson: run ratbagctl.test as part of ninja test
Or at least do so when we're root.

Test is skipped on CircleCI because we don't have DBus.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 10:32:41 +02:00
Peter Hutterer
98fa9c168a tools: ratbagd: throw an error if the system bus is unavailable
When running in a container (CircleCI), dbus may not be available. Throw one
of our errors to be consistent with our behavior when the name owner isn't
available.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 10:32:41 +02:00
Peter Hutterer
0e26b6e2be tools: ratbagctl: check ratbagd for immediate exit before continuing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 10:32:41 +02:00
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
Peter Hutterer
df2a06690d Fix device capability check
We now have a lot more bits to cater for, so let's use an array.

Broken with 487e66e64d

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Jente Hidskes
2c4cdc6dc6 ratbagd-led: mark DBus properties as EMITS_CHANGE 2017-07-10 20:41:12 +10:00
Jente Hidskes
96c2f404d2 ratbagd-led: add error check for RGB 0-255 range 2017-07-10 20:41:12 +10:00
Clément Vuchener
e33a515fd6 data: add toned-down SVG for Logitech G500/G500s (#214)
* data/gnome: add SVG for Logitech G500/G500s

* data/gnome: add buttons 0 and 1 to the G700
2017-07-10 09:30:56 +02:00
Jente Hidskes
8fc58e259c Use toned-down device SVGs (#182)
* data/gnome: add GNOME theme requirements

* data/logitech-g403.svg: add G403 GNOME SVG

* data/logitech-g502.svg: add G502 GNOME SVG

* data/logitech-g700.svg: add G700 GNOME SVG

* meson: install GNOME SVG files
2017-07-07 16:05:36 +02:00
Christian Kellner
caadd86091 hwdb: add G403 entry
The G403 comes in a (optional) wireless version too; the dongle
that come with it has the product id c539, which is already
handled and also works (by the G900) entry.

Signed-off-by: Christian Kellner <christian@kellner.me>
2017-07-07 15:12:55 +02:00
Jente Hidskes
e16aafe86c data: move default SVGs under default/ subdirectory..
.. and install them in the appropriate directory after #209
2017-07-07 15:07:45 +02:00
Peter Hutterer
6a0ebe9e45 ratbagd: add support for svg theming
Two new DBus interfaces:
org.freedesktop.ratbagd1.Manager.Themes -> string array
org.freedesktop.ratbagd1.Device.GetSvg('theme') -> string

The Themes property is a static list of available themes. These are currently
hardcoded in ratbagd, but the theme 'default' is guaranteed to exist.

The GetSvg() method takes a theme name and returns the full file path to the
themed SVG.

Longer-term this will deprecate the Svg and SvgPath properties in the Device
but for now we leave them there.

https://github.com/libratbag/libratbag/issues/204

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-07 08:20:01 +02:00
Benjamin Tissoires
79f4b9c0d6 tools: add ratbagctl.devel to launch both ratbagd and ratbagctl
When developing with ratbagd, we need to test against master, not
the system-wide installed daemon.

Allow to name space ratbagd with the creation of a new (not installed)
rabtagd.devel daemon, that is tagged with the git sha of the ratbagd
folder.

Handle this namespace in ratbagctl by looking at an environment variable
RATBAGCTL_DEVEL.

Then provide a python script that launches both rabtagd.devel and
ratbagctl with the correct environment variable set so that they can
talk to each other.

Note that we blindly overwrite the dbus .conf file as nobody else than
developers should have one.

Note: the tagging of ratbagd.devel (like the meson bit) won't run unless
a rebuild is triggered. So we don't necessarily always get the right git
tag. However, touching ratbagctl.in triggers a rebuild, so we should be
OK-ish.

Fixes #206

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-07 16:02:46 +10:00
Benjamin Tissoires
e6433abd09 tools: import ratbagd.py from piper
We are updating it, let us keep it in sync

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-07 16:02:46 +10:00
Peter Hutterer
96f3b7858b tools: fix ratbagctl error when dbus isn't available (#210)
File "./build/ratbagctl", line 713, in main
    cmd.func(r, cmd)
UnboundLocalError: local variable 'r' referenced before assignment

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-06 08:39:27 +02:00
Peter Hutterer
f5abc191d8 ratbagd: drop the ActiveResolutionChanged signal generation (#208)
* ratbagd: drop the ActiveResolutionChanged signal generation

Leave the signal in the DBus API for now so we can hook it up later, but
stop the signal being generated. Changing the dpi does not change the active
resolution.

https://github.com/libratbag/libratbag/issues/205

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

* ratbagd: fix signal dbus interface name

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-06 08:20:43 +02:00
Benjamin Tissoires
251b602323 ratbagd: call the correct set_resolution based on the capabilities
ratbagd unconditionally called set_resolution_xy while libratbag expects
the caller to check on the capabilities. Instead of letting this burden
to the dbus user, have ratbagd handle this for us.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-05 11:33:21 +02:00
Peter Hutterer
fe3169182c meson: fix valgrind setup
The previous approach had no effect, it wasn't doing things correctly.
Add a proper valgrind setup, run with:

       mesontest --setup=valgrind

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
[fixed rebase conflict]
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-05 09:36:30 +02:00
Peter Hutterer
642a5339bc meson: drop invalid configuration: tag for install_data
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-05 09:35:51 +02:00
Benjamin Tissoires
c251053f03 circle.yml: add workaround for meson upstream bug
Meson currently doesn't clean up after itself on uninstall.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-05 08:37:18 +10:00
Benjamin Tissoires
4b97b00518 circle.yml: uninstall and checks if there are any leftovers
Check if $PREFIX is still there after uninstall, and if so show
which files are left.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-05 08:37:18 +10:00
Jente Hidskes
faa1a24c25 RatbagdDevice: add commit method
Fixes #198
2017-07-04 17:02:18 +02:00
Benjamin Tissoires
b78b5cd73e circle.yml: add install step
It doesn't cost much to actually install the files, so we can check
where they are installed.

Also add mesonconf before building so we can see in the logs
the various configure environment.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-03 19:14:10 +10:00
Peter Hutterer
4eb5411bf1 meson: fix svg data dir (#191)
It was missing the prefix

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-03 10:28:20 +02:00
Peter Hutterer
22af1176d3 meson: hack around Fedora's systemd libdir confusion
Fedora uses /usr/lib64 as libdir but systemd uses /usr/lib for its files. We
used libdir to install the unit files, which then end up in
/usr/lib64/systemd/systemd where it will be ignored. There's no good way to
avoid this beyond detecting this mismatch and hacking around it.

To keep custom prefixes intact, this patch detects a /usr prefix and checks
with systemd's pkconfig, if the libdir and the systemd unitdir mismatch, then
we adjust the path.

https://github.com/libratbag/libratbag/issues/188

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-03 09:57:20 +02:00
Benjamin Tissoires
bb6d8a6ea4 update circle CI link 2017-07-01 17:43:26 +02:00
Benjamin Tissoires
935f68ae8f enhance circle.yml with workflows
Circle CI uses docker, so nothing prevents us from running several
tests in parallel for different distributions. Ideally, we should also
be able to test the install and be sure we can talk to ratbagd
with the dbus activation on those various distributions.

This version runs both Fedora rawhide and Ubuntu 17.04 at the same
time.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-01 10:38:01 +10:00
Peter Hutterer
2fd939f514 resolution: add support for min/max resolutions
https://github.com/libratbag/libratbag/issues/180

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 09:07:24 +02:00
Peter Hutterer
dbc0672061 README: clarify the two developer-specific notes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 07:24:54 +02:00
Peter Hutterer
804f2eec76 README: clean up the Running ratbagd section
We install everything, so rather than having commands that aren't needed,
simply describe what we're doing and hope for the best.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 07:24:54 +02:00
Peter Hutterer
73c24319d1 README: move the dbus interface description out
No-one reads anything longer than 140 char anymore, so let's move the DBus
Interface description out. The average visitor to this site won't care.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 07:24:54 +02:00
Peter Hutterer
6b3fc6338e README: cleanup, de-duplication, etc.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 07:24:54 +02:00
Peter Hutterer
c6855df5fc Drop the semaphore status in the README and the build script
Semaphore only provides Ubuntu 14.04 which is too old for us. We now have
CircleCI integration which can run docker images, so let's leave that and drop
Semaphore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 07:24:54 +02:00
Benjamin Tissoires
9ed61fd072 Add circle.yml
Semaphore CI is still using Ubuntu 14.04, and the shipped systemd version
is just too old.
OTOH, Circle CI 2.0 (still beta as of today) allows to use any docker
image as a base for running the tests. Meaning that we can have a fedora
rawhide image as a base and we do not have to handle the update of systemd
meson and others.

Ship a basic circle.yml for Circle CI to run our tests and add the badge
in the README.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-30 07:53:22 +10:00
Benjamin Tissoires
1a764944e7 Merge pull request #184 from whot/wip/ratbagd-merge
This merges ratbagd into libratbag, keeping the histories of both projects intact (hence the rather large merge). The meson.build files are merged and a few things are shuffled around to look like one normal project directory. The build artifacts are still the same, i.e. we still build libratbag and ratbagd.
2017-06-29 17:19:30 +02:00
Peter Hutterer
e311f89357 Provide a min/max dpi for the resolutions
For a GUI application like Piper, it's required that we know the range to
present to the user.

This patch includes the code for HID++ 1.0 and 2.0, other drivers need to
follow.

https://github.com/libratbag/libratbag/issues/180

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 09:07:18 +02:00
Peter Hutterer
ecdba84977 hidpp20: use min/max macros over ternary condition
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 09:07:18 +02:00
Peter Hutterer
c003eccb1e hidpp10: fix a comment, dpi_table is not null-terminated
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 09:07:18 +02:00
Peter Hutterer
f36fdc0492 meson: drop the separate shared library for ratbagd
We can reinstate that when we need it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 15:03:11 +10:00
Peter Hutterer
907b96d447 meson: drop unused defines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 15:03:11 +10:00
Peter Hutterer
b4682e836c ratbagd: move the source from ratbagd/src to just ratbagd/
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 15:02:56 +10:00
Peter Hutterer
30e8fbedd8 Drop separate ratbagd COPYING file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 15:02:38 +10:00
Peter Hutterer
fc1887c01f Merge ratbagd README into libratbag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 15:01:08 +10:00
Peter Hutterer
d51acfd730 Move ratbagd dbus and tools to top-level directory
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 15:01:07 +10:00
Peter Hutterer
35e38a5469 Merge ratbagd's meson file into libratbag's
I couldn't get the subdir() to work, it would throw exceptions somewhere
internal to meson. So instead, just merge the two together.
This still builds everything as before, it's just a single meson file now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 15:01:05 +10:00
Peter Hutterer
2ae3976868 Merge ratbagd into libratbag 2017-06-29 14:59:13 +10:00
Jente Hidskes
5dcdc3c652 Add an API for LEDs 2017-06-29 11:56:37 +10:00
Peter Hutterer
af68f6046c Fix a doxygen reference
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-20 14:07:28 +10:00
Jente Hidskes
c0c4ba156a README: fix install instructions
The instructions still referred to in-source builds. Meson instead uses
an out of tree build directory, hence we update the paths to point to
the build directory.

Fixes #32.
2017-06-14 10:52:41 +02:00
Jente Hidskes
22135f31d5 ratbagd-device: update for new capabilities in libratbag
Fixes #29.
2017-06-12 18:49:44 +10:00
Raghavendra Kamath
0c7ca85f5b Add new artwork of Logitech G9 2017-06-10 12:25:07 +10:00
Raghavendra Kamath
478c5bbb68 Adjust text and resolution in svg.
To make the text look consistent font size is now set to 12pt in all svg & default resolution is adjust according to new inkscape (0.92) defaults
2017-06-10 12:25:07 +10:00
Peter Hutterer
487e66e64d Group the the capabilities and provide some more generic topic-like caps
This makes code that just checks for general abilities easier to write, the
specific thing we can do (e.g. switch profiles) is expressed as separate bit.

This is an ABI break

Related to #172

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-09 08:51:26 +02:00
Jente Hidskes
2b5b0b1772 Fix boolean instruction for Meson
https://github.com/libratbag/libratbag/issues/175
2017-06-08 12:30:02 +02:00
bentiss
13bb5b52e1 Fix boolean instruction for Meson
Fixes issue #175

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-08 11:14:52 +02:00
Peter Hutterer
90d2a48cfb ratbagctl: default to list-devices without argv
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-08 09:15:21 +02:00
Peter Hutterer
97a37d21e1 Drop the python bindings, move them into ratbagctl
The python bindings were mostly boilerplate and a 1:1 mapping of the dbus
interface anyway. Packaging them for distributions is difficult, so given how
little benefit they provide, let's just stop shipping them.

Those who need those bindings (like piper) can either make their own or copy
them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-08 09:15:21 +02:00
Peter Hutterer
9cf6100e00 python: switch ratbagctl shebang to python3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-07 09:19:05 +02:00
Benjamin Tissoires
932cf905ef ratbagd 0.4
- changed licence of rb-tree to have a consistent MIT licence
- new signal for active resolution changes

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 16:04:39 +02:00
Benjamin Tissoires
7da53c61cf meson.build: libratbag 0.9
- convert Logitech devices to the commit API (those compatible)
- fixes for ratbag-command regarding LEDs (still few caveats left)
- some coverity fixes
- a brand new lur-command man page

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:26:37 +02:00
Benjamin Tissoires
714c0d5330 hidpp20: reset the LEDs before writing to it
We somehow now know how to write effects.
No need to carry around some left overs from previous configurations.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Benjamin Tissoires
dc92abb5e5 tools: replace tabs by spaces in ratbag-command usage
It's a mix of tabs and spaces. Let's use spaces to keep the formatting.

And move "switch-etekcity" back to the end, it's a special case.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Benjamin Tissoires
b0c515b59d tools: allow to set more than one setting for the LEDs
Or we will take the defaults that are not intuitive (like white color
when setting to on).

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Benjamin Tissoires
8e6c13832e hidpp20: led: document the internal structure and match the documentation
Shouldn't change the behavior, but this allows adding the other effects
found in the documentation.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Benjamin Tissoires
e33f655f61 hidpp20: do not waste memory
Currently we only support mice with 2 LEDs in the profile. No need
to have 32 placeholders.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Benjamin Tissoires
8e8b7b0611 hidpp20: make sure we read/write correct endianness to the device
rate is big endian, so we need to convert it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Benjamin Tissoires
d28f2f0123 hidpp20: keep function names consistent
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Benjamin Tissoires
a8eea870f5 hidpp20: make sure we check all modes in the switch statement
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Benjamin Tissoires
7e12e45311 hidpp20-drv: no need to use doubles
We are using a uint in the end, so better have proper order in the
multiplications/divisions than using doubles.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Benjamin Tissoires
b31c1d5ff3 tools: ratbag-command: have only one function to dump the LED settings
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Benjamin Tissoires
f6949458b7 tools: make led a first class citizen of ratbag-command
Allows to follow the usage message: we do not need to provide the
currently active profile.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Benjamin Tissoires
15dd6b4f2b hidpp20: color effects, fix endianness
We are receiving big endian, thus the weird power of two locations.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-06 15:03:47 +02:00
Stephen Kitt
7afd59149c Add lur-command manpage
This is copied from the Debian package.

Signed-off-by: Stephen Kitt <steve@sk2.org>
2017-05-30 14:11:48 +10:00
Stephen Kitt
a47f506293 Fix ratbag-command manpage
* Description capitalisation
* Grammar
* Hyphen encoding
* --version

Signed-off-by: Stephen Kitt <steve@sk2.org>
2017-05-30 14:11:48 +10:00
Peter Hutterer
ad88f755a4 shared: relicense rbtree to MIT
To avoid having multiple licenses within a project as small as ratbagd, and to
avoid having to deal with any fallout from mixing MIT and LGPL.

Pre-approved by David Herrmann who wrote that code, see
https://github.com/libratbag/ratbagd/issues/23#issuecomment-302741861

Fixes https://github.com/libratbag/ratbagd/issues/23

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-29 13:52:38 +02:00
Benjamin Tissoires
f243abb65c release.sh: remove unreachable test now that we switched to meson
and I must say, why would you not run this script in the current
directory.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-05-29 17:29:12 +10:00
Benjamin Tissoires
a4b177436d hidpp20: take into account sectors on 16bits
First part of fixing #122.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-05-29 10:33:33 +10:00
Benjamin Tissoires
8367569236 hidpp10: fix coverity issue
profile->dpi_modes[i].led[] is an array of boolean.
Given that the callers (hidpp10_fill_dpi_modes_*()) already are doing the
comparison against 0x02, I guess this is just copy/paste error.

Fixes #152

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-05-29 10:32:08 +10:00
Benjamin Tissoires
5bbb2b28ea hidpp20drv: switch to the commit API
I do not like duplicating ratbag_old_write_profile() into each driver,
but, heh.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-05-29 09:15:07 +10:00
bentiss
2b92ab6dd6 hidpp20drv: fix segfault with G502 (#163)
When using the G502 without RGB LEDs, the feature 8070 is not here.
And this segfaults :)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-05-24 11:52:56 +03:00
Christian Kellner
c05c3dcaa3 tools: consistently call led mode "breathing"
Rename "breath" in the help text and reporting for the led mode to
"breathing". The actual command to set the mode was already called
that way.

Signed-off-by: Christian Kellner <christian@kellner.me>
2017-05-24 09:05:15 +10:00
Jente Hidskes
dd71c23a04 resolution: add set_default method
Fixes #8.
2017-05-23 13:30:21 +10:00
Jente Hidskes
299c49c291 README: remove ambiguity in signal descriptions 2017-05-17 12:50:35 +10:00
Jente Hidskes
b1feabaf64 resolution: add signal for active resolution changes
This implements a signal that is fired whenever the active resolution
changes. For now the signal is only fired when the resolution changes
through the setter, ratbagd_resolution_set_resolution, as profile changes may
not always be hooked up in the hardware.

Reference #8.
2017-05-17 12:50:35 +10:00
Jente Hidskes
2722e008e0 profile: add signal for active profile changes
This implements a signal that is fired whenever the active profile
changes. For now the signal is only fired when the profile changes
through the setter, ratbagd_profile_set_active, as profile changes may
not always be hooked up in the hardware.

Fixes #7.
2017-05-17 12:50:35 +10:00
Benjamin Tissoires
178b08cd0a ratbagd 0.3
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2017-05-12 16:35:41 +02:00
Benjamin Tissoires
bf20845249 meson.build: libratbag 0.8
- coverity fixes
- new --version to ratbag-command
- cleaning up the meson build tools

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-05-09 14:55:15 +02:00
Jente Hidskes
4dc15451b7 README: s/make install/ninja install/ 2017-05-09 14:38:38 +02:00
Jente Hidskes
3a764b6aae README: replace configure switches with mesonconf switches 2017-05-09 14:38:38 +02:00
Jente Hidskes
190e78c79c README: small documentation fixes 2017-05-09 14:38:38 +02:00
Peter Hutterer
eb01399f26 tools: fix OOB for LED color parsing
Let's not forget about the null-terminator, he feels lonely otherwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 10:14:47 +02:00
Peter Hutterer
c815654c94 tools: add --version to ratbag-command
Behold, the glory of our version number!

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 09:24:41 +02:00
Peter Hutterer
f1ce908b50 meson: quote the libratbag version properly
Otherwise ETOOMANYDECIMALSEPARATORS, confusion, mayham, anarchy, the lot.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 09:24:41 +02:00
Peter Hutterer
fb07204d9f meson: drop garbage argument from configure_file
Unsurprisingly, meson does not support the ratbag keyword argument. Though it
should, because we're great. But anyway, this lead to the argument being
ignored which means it didn't get an 'input' argument, which means that
libratbag-version.h.in was ignored. And since it all works anyway (Behold! The
magic! Ooooh! Aaaah!) we can just drop that file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 09:24:41 +02:00
Peter Hutterer
1e5648b11d tools: terminate option list with a zero entry
Because, well, that's what we're supposed to do. Unless you want to think
outside the (array) box, but that has never helped anyone, has it?

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 09:24:41 +02:00
Peter Hutterer
0902e3420f tools: replace getopt magic number 2 with 'optional_argument'
So *that's* what 2 means...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 09:24:41 +02:00
Peter Hutterer
2750f8c49b Mark the unknown button type as explicit fallthrough
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 07:50:21 +10:00
Peter Hutterer
57ffc9c5d3 meson: drop a bunch of compiler flags
These all affect the final executable and should be under the control of the
distro.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-09 07:50:21 +10:00
Jente Hidskes
a2b858008f meson: use join_paths with dbusdir for consistency 2017-05-08 20:44:30 +10:00
Jente Hidskes
28956126ec meson: correctly install service files
https://github.com/libratbag/ratbagd/issues/18
2017-05-08 20:44:30 +10:00
Peter Hutterer
698d8ab365 Replace ifndef include guards with pragma once
Now that we use meson exclusively and meson uses this for its config.h, you
wouldn't get around it anyway. Besides, the main compilers support it and
libratbag is too niche to worry about others.

This also *adds* the pragma to tools/shared.h where it was previously missing,
and changes it to be the top statement in hidpp-generic.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-05 09:02:15 +02:00
Peter Hutterer
44471d3c42 meson: use warning_level=2 instead of manual -Wall -Wextra
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 10:14:50 +02:00
Peter Hutterer
ad1fa22196 hidpp10: fix out-of-bounds access
sizeof() gives us twice as many elements as we have indices for on this 16-bit
array.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
04ebd96bb7 roccat: fix the neverending story^Wtimeout
If we don't change count, the value of count < MAX_RETRY is always true.

Coverity is a champ, isn't it?

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
09b5ae14b1 liblur: fix memory leak
Rather than having a bunch of gotos just define a cleanup for this device and
let the magic do the rest.

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
8aa127186c gskill: fix memory leak
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
a962082173 hidpp20: constify a helper function
Just because we can

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
5c0dbe4d5c hidpp20: fix dereference before null check
Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
5934816b11 tools: check for negative index coming from argv
Coverity is unhappy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
28dd84713f Reset the button action struct to zero before use
A semi false-positive from Coverity, because action.macro is unset. Doesn't
matter because we never use it, but having it zeroed is the nice thing to do
(and what we do in the other functions).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
11b31cf9bd Fix a comment typo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
dfd2d88953 tools: fix coverity warnings
Assigned but not used.

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:52:59 +02:00
Peter Hutterer
6a097bd691 meson: drop -g, the meson buildtype option takes care of that
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:49:34 +02:00
Peter Hutterer
2776d1ce8e meson: use warning_level=2 instead of manual -Wall -Wextra
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-02 09:49:34 +02:00
Peter Hutterer
fa12517fb2 Drop autotools
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 10:13:56 +02:00
Peter Hutterer
9624d1bdcd Add meson build file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 10:13:56 +02:00
Peter Hutterer
8f7bf150df Use automake to generate ratbagctl
All we do is a single sed, we can leave that to automake.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 10:13:56 +02:00
Peter Hutterer
f5270e1539 Change the sed replacement for meson's benefit
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 10:13:56 +02:00
Peter Hutterer
0834b210ca Remove now-obsolete autogen.sh script
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 08:26:07 +02:00
Peter Hutterer
cc41adbbf9 gitignore: drop build/ from gitignore again
As pointed out elsewhere, the build directory is decided by the user and
should thus be a user-specific gitignore configuration.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 08:26:07 +02:00
Peter Hutterer
8944353716 Update for new caps in libratbag 0.6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-25 08:26:14 +02:00
Peter Hutterer
53ff42ea55 README: remove the compilation instructions for systemd
By now you should have 229.

And replace the instructions with actual ratbagd build instructions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-25 08:26:14 +02:00
Peter Hutterer
63a666025f Update gitignore for meson
Drop all automake detritus, leave only the default build directory meson
suggests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-25 08:11:40 +02:00
Peter Hutterer
25a92e61ef configure.ac: drop xslt check
Some leftover from the triassic period or so

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-24 10:13:22 +02:00
Peter Hutterer
70a33ec78d Drop AM_MAINTAINER_MODE
This isn't useful

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-24 10:13:22 +02:00
Peter Hutterer
d358d7433b Include config.h before anything else
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-24 10:13:22 +02:00
Peter Hutterer
08ce9773dd Remove liblur.pc.in
Should've been removed with b8ed1ea

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-24 10:11:38 +02:00
Peter Hutterer
f745734d90 meson: generate the libratbag.pc file through configure_file
pkgconfig.generate() does not (yet) have a parameter for setting custom
variables - we need that for pkgdatadir to point to the SVG files. Swap to
using configure_file with the old .pc.in file that was forgotten in the tree
anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-24 10:11:38 +02:00
Benjamin Tissoires
5443083b1d meson.build: libratbag 0.7
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-04-20 11:59:48 +02:00
Benjamin Tissoires
cc19496699 Fix release.sh for meson
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-04-20 11:59:48 +02:00
Peter Hutterer
b595691c5e meson: break up the two long error messages
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-20 11:28:05 +02:00
Peter Hutterer
7d784a1a91 doc: use USE_MDFILE_AS_MAINPAGE to include the README.md as mainpage
Supported as of doxygen 1.8.3 (Dec 2012), see
http://www.stack.nl/~dimitri/doxygen/manual/changelog.html#log_1_8_3

Fixes #145

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-20 11:28:05 +02:00
Peter Hutterer
a664042f64 meson: add doxygen input files to source list
To rebuild the documentation when either changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-20 11:28:05 +02:00
Benjamin Tissoires
5bc4470a8c Fix warning: ‘x’ may be used uninitialized in this function
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-04-20 11:20:07 +02:00
Peter Hutterer
b8ed1ea3a4 Remove autotools build system
And thus drop the code to parse the top_srcdir from the arguments to the
symbols-leak-test, not the env.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-19 14:40:57 +02:00
Peter Hutterer
f2ad49cf20 Add meson build file
For a builddir called 'builddir', the following commands are sufficient now:

    meson builddir
    ninja -C builddir
    sudo ninja -C builddir install

Meson only needs to be run once after checkout or after the removal of the
builddir.

Fixes https://github.com/libratbag/libratbag/issues/142

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-19 14:40:57 +02:00
Peter Hutterer
fd6a9e73ed test: always run the symbols-leak-test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-19 14:40:57 +02:00
Peter Hutterer
db57a8e7b6 test: pass TOP_SRCDIR via the env or as $1
Prep work for meson, even though we'll eventuall drop the env bit. This just
removes the extra symbols-leak-test.in step.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-19 14:40:57 +02:00
Peter Hutterer
2a35bf009f configure.ac: drop "auto" detection of test dependencies
Always build the tests, if someone doesn't want it disable it with a configure
flag but at least be explicit about it.

Justification: any developer should build the full stack as intended by
default. Distributions may disable bits and pieces, but they shouldn't rely on
auto-detection to figure it out, they should explicity disable those bits they
don't want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-04 10:00:38 +02:00
Peter Hutterer
42d49d74ab configure.ac: drop "auto" detection of doxygen dependencies
Always build the documentation, if someone doesn't want it disable it with a
configure flag but at least be explicit about it.

Justification: any developer should build the full stack as intended by
default. Distributions may disable bits and pieces, but they shouldn't rely on
auto-detection to figure it out, they should explicity disable those bits they
don't want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-04 10:00:38 +02:00
Peter Hutterer
a9f34249fc configure.ac: remove an erroneous quotation mark
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-04 10:00:38 +02:00
Peter Hutterer
1ce59bcc1f doc: drop the custom INPUT to doxygen
Not necessary, we have it in the doxygen.in
2017-04-03 09:55:53 +02:00
Peter Hutterer
bb35821c45 tools: fix signed vs unsigned comparison warnings
And use this to start using C99 variable style, for pure loop variables it's
better to have them declared in the loop itself.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-03 09:55:53 +02:00
Peter Hutterer
bbec42c426 tools: include config.h for ratbag-command
And that then pulls in _GNU_SOURCE for us

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-03 09:55:53 +02:00
Peter Hutterer
cb487a6d1a tools: fix compiler warning 'no previous prototype'
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-03 09:55:53 +02:00
Peter Hutterer
7fdcf62bf2 tools: fix compiler warning
../tools/shared.c:132:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-03 09:55:53 +02:00
Peter Hutterer
f82c1119bf tools: fix Makefile, it's SOURCES, not SOURCeS
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-03 09:55:53 +02:00
Peter Hutterer
f60f8a12ab tools: fix string parsing for LED colors 2017-03-31 15:07:01 +10:00
Peter Hutterer
fd348d456d tools: add missing LED_OFF switch case
And add the missing break
2017-03-31 15:07:01 +10:00
Peter Hutterer
0f73a97bc8 tools: move variable declaration up
We do C99, but not this :)
2017-03-31 15:07:01 +10:00
Peter Hutterer
7783f50110 tools: fix unused variable warnings 2017-03-31 15:07:01 +10:00
Jente Hidskes
617cd628ea python: replace == None with is None
== checks for value equivalence, but in this case what we
really want is address equivalence. Hence we use is.
2017-03-31 08:22:21 +10:00
Jente Hidskes
9601ba1323 python: catch more DBus exceptions
Gio.bus_get_sync may return None when the DBus service is not available (see
libratbag/piper#2). In addition to this, the service may time out when it is
being started in which case Gio.DBusProxy.new_sync will raise a GLib.Gerror.

This commit checks for both scenarios and raises a RatbagdDBusUnavailable
exception when either one of them occurs. This will in turn be caught in for
example Piper to properly deal with this.
2017-03-31 08:22:21 +10:00
Benjamin Tissoires
b85fcd0cee hwdb: add missing G900 over USB entry
Allows to have the nice picture

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-03-22 11:49:19 +01:00
Stephen Kitt
fc874c0249 Add manpages for ratbagctl and ratbagd
Signed-off-by: Stephen Kitt <steve@sk2.org>
2016-10-07 11:17:44 +02:00
bentiss
a9dc630fae Merge pull request #10 from whot/master
dbus cleanup
2016-03-17 09:14:41 +01:00
Peter Hutterer
d874a2e5f1 ratbagd 0.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-16 10:12:09 +10:00
Peter Hutterer
a658b117a7 device: add support for QUERY_CONFIGURATION device capability
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-15 14:40:44 +10:00
Peter Hutterer
638b505ade manager: drop GetDeviceById
We don't really expect more than 2-3 devices even on a test box. This function
serves little purpose, we can easily require a caller to just get all devices
(usually just one anyway) and then go from there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-15 13:39:28 +10:00
Peter Hutterer
ff3730f3fb device: use "Name" instead of "Description"
This is the terminology used in libratbag as well (and everywhere else where
we deal with input devices).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-15 13:29:19 +10:00
Peter Hutterer
00f488dc13 resolution: switch the capabilities to an enum
Strings can suffer from locale issues, the official recommendation for DBus
APIs is to use enums here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-15 13:12:18 +10:00
Peter Hutterer
ca2f32ea58 device: switch the capabilities to an enum
Strings can suffer from locale issues, the official recommendation for DBus
APIs is to use enums here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-15 13:12:18 +10:00
Peter Hutterer
0ebbccc6cf ratbagctl: fix error when printing separate x/y resolutions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-15 12:23:44 +10:00
Peter Hutterer
7c622ecc58 Adjust for new libratbag 0.4 API
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-15 10:18:23 +10:00
Peter Hutterer
917308d24d Document the DBus interface in the README
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-14 17:02:17 +10:00
Peter Hutterer
97eee9e0c5 ratbagd 0.1.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 12:02:19 +10:00
Peter Hutterer
5cc234e27e configure.ac: add missing AC_SUBST for the dbus config dir
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 11:27:16 +10:00
Peter Hutterer
2bbcc51a8b ratbagd 0.1.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 10:40:01 +10:00
Peter Hutterer
1824b977f7 Fix typo in README
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 09:17:34 +10:00
Peter Hutterer
99011fd3bf configure.ac: fix dbus install directories
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-11 09:16:48 +10:00
Peter Hutterer
346631cd75 Skip the manual NULL assignment after unref
libratbag guarantees that unref() always returns NULL

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-10 13:03:56 +10:00
Peter Hutterer
8517e103b0 ratbagd 0.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-10 12:05:40 +10:00
Peter Hutterer
815a81a610 Spice up the README a bit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-10 12:05:40 +10:00
Peter Hutterer
20b9339620 README: update install instructions for dbus
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-10 12:05:40 +10:00
Peter Hutterer
2e93ac07f6 Update gitignore for a few things
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-10 12:05:40 +10:00
Peter Hutterer
f385622ec6 Makefile: add a comment marker for the dbus/systemd config files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-10 12:05:40 +10:00
Peter Hutterer
de83186c3c Create the dbus directory in $builddir
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-10 12:05:40 +10:00
Peter Hutterer
fa0d57dd47 Install the dbus config as well
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-10 12:05:40 +10:00
Peter Hutterer
b164fa622f Change to a dbus-activated service
We don't shut down once activated but that doesn't mean we need to run when
never requested.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2016-03-10 12:05:40 +10:00
bentiss
e4c654841b Merge pull request #3 from whot/master
fix cleanup code  and restart on abort
2016-03-09 09:41:26 +01:00
bentiss
a411248c7c Merge pull request #2 from whot/wip/pkg-cleanup
minor autotools cleanup
2016-03-09 09:39:45 +01:00
Peter Hutterer
a066203b4a systemd: fix typo in service file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-09 14:08:20 +10:00
Peter Hutterer
819c70fa9a systemd: restart on abort
Now that we clean up properly, the most common crash should be fixed. Restart
on abort by default so ideally all we need to do is restart piper or whatever
consumes the API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-09 13:45:03 +10:00
Peter Hutterer
9f9383e6ff profile: free the buttons/resolutions on profile cleanup
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-09 13:45:03 +10:00
Peter Hutterer
70222b3033 Use PKG_CHECK_VAR to check for the pkgdatadir
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-09 13:10:14 +10:00
Peter Hutterer
5e2d7de6c2 configure.ac: remove a couple of unused items
This configure.ac is largely a copy from systemd so it included things that we
don't use locally.
- we don't use grep, awk or ln
- AC_SYS_LARGEFILE and AC_CANONICAL_HOST are unecessary
- pkg.m4 - if that's missing you don't have pkgconfig installed. stop trying
  to build things then :)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-09 13:04:22 +10:00
Peter Hutterer
aceef4d0d0 ratbagd 0.0.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-04 14:27:18 +10:00
Peter Hutterer
654956baa6 Fix distcheck
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-04 14:27:08 +10:00
Peter Hutterer
212ab08c15 device: export the full path to the SVG as well
Exporting just the filename requires the caller to know where that file sits.
That's useful for things like e.g. icons where callers may several sets to
chose from but here most callers will just use the default svg provided by
libratbag.

Export that, so that we don't have build-time dependencies in the callers just
for that single path.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-04 08:54:26 +10:00
bentiss
18a0be561f Merge pull request #1 from whot/python-bindings
Add a python module for ratbagd, replace ratbagctl with a python version
2016-03-03 15:30:19 +01:00
Peter Hutterer
0528981a0a Replace ratbagctl with a python version
It's a lot easier to interact with ratbagd from a python script than it is
with C code. Plus this means we test the bindings whenever we use ratbagctl.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-03 20:13:10 +10:00
Peter Hutterer
eac1e91638 Add a python module to talk to ratbagd
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-03 20:12:48 +10:00
Peter Hutterer
a8600faeb3 button: use dash, not underscore, for button type names
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-03 15:11:29 +10:00
Peter Hutterer
9c33eede5c Add a COPYING file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-03 14:56:37 +10:00
Peter Hutterer
6c285fa2a1 button: emit property change events when we update a button
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-29 13:55:58 +10:00
Peter Hutterer
d6116e00bc ratbagd 0.0.1
This reverts the version number but ratbagd is nowhere near stable (because
libratbag itself isn't stable yet) and the dbus API can change at any time.
I'm not committing to keeping the current dbus API around for backwards
compatibility reasons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-29 10:24:47 +10:00
Peter Hutterer
c54b382775 Require libratbag 0.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-29 09:59:51 +10:00
Peter Hutterer
184e2b646c Add a systemd service file
We don't have dbus-activation yet, so just define it as a normal dbus service
for now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-29 09:54:00 +10:00
Peter Hutterer
8a8379c7eb button: return -1 for invalid special values
Otherwise it looks like the function doesn't exist

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-25 15:23:58 +10:00
Peter Hutterer
8e8d827e00 Export button mappings over dbus
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-24 12:40:49 +10:00
Peter Hutterer
2fad2e3ccd resolution: mark the dpi/rate as changable
And make sure we actually save the new value too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-22 13:29:02 +10:00
Peter Hutterer
4c66d7f5ba dbus: allow normal users to talk to ratbagd
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-22 09:42:47 +10:00
Peter Hutterer
124385fc31 ratbagctl: print all properties
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
5fe39f94ab ratbagctl: fix show-profile to handle the resolution objects
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
e8d1645150 ratbagctl: Switch ActiveProfile parsing to an integer
Fallout from c04f1b57aa

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
d1ea517f9a ratbagctl: drop DefaultProfile parsing
Dropped in d049c13062

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
c6627d6266 device: if we can't fetch the description or svg, return an empty string
Less exception handling needed on the client side.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
2138ab05e5 Replace fprintfs with a new log_error helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
ce3038fd8e Use streq over strcmp
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
555d00c9a8 ratbagd: if --verbose is specified, set libratbag to verbose too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
12f013681a Add rudimentary for buttons
This just exports the button index so far and makes sure we can write clients
that deal with button objects instead of making stuff up to test for buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:03 +10:00
Peter Hutterer
7a498310e2 resolution: remove unused variables
Copy/paste leftover from the profile.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 15:14:15 +10:00
Peter Hutterer
9af58224fa resolution: export capabilities as dbus properties
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 11:14:13 +10:00
Peter Hutterer
61abdb57a7 device: export all capabilities as dbus properties
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 11:12:00 +10:00
Peter Hutterer
e0cb0c70e1 README: fix typo, this is ratbagd, not libratbag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 09:12:36 +10:00
Benjamin Tissoires
420a05cabf README: Add instructions to have libsystemd >= 227
Works on F23. There are few dependencies pulled by configure that I did
not put there.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 09:12:33 +10:00
Peter Hutterer
262dd532e6 Add a log_verbose logging function for debug output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-17 10:33:20 +10:00
Peter Hutterer
80ed6d1399 resolution: switch to an index for ActiveResolution/DefaultResolution
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-16 17:00:27 +10:00
Peter Hutterer
c04f1b57aa device: switch active profile over to return an index only
Returning the object path makes it harder for the client to identify which
object is the active one. A simple index into the devices array is easier to
handle.

Note: another approach was to have an IsActive property on the profile
directly. This would require updating all properties when the active profile
is changed, it's simpler to just have one index.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-16 17:00:27 +10:00
Peter Hutterer
7aca92f2b3 resolution: add support for setting resolutions and report rate
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-16 09:56:12 +10:00
Peter Hutterer
e199278d6f profile: switch DefaultResolution/ActiveResolution over to an object path
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:36 +10:00
Peter Hutterer
f2a55bca55 profile: add GetResolutionByIndex
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:35 +10:00
Peter Hutterer
bcd62aec6b resolutions: switch to using objects for resolutions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:23 +10:00
Peter Hutterer
c4e4330bd1 profile: prefix the profile object path with a 'p'
sd_bus_encode_many() escaps elements starting with a digit so our 0 profile
has an object path of /.../_30. This is quite confusing during debugging.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:12 +10:00
Peter Hutterer
c70b53a162 profile: add support for setting the active profile
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:11 +10:00
Peter Hutterer
3262def07c device: add support for get-svg
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:11 +10:00
Peter Hutterer
d049c13062 device: drop default profile fetching, removed from libratbag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:01 +10:00
Peter Hutterer
5ffed21e0e Remove cleanup func define for sd_bus_message_unref
Added to systemd in 4afd3348c7506dd1d36305b7bcb9feb8952b9d6b
2016-02-11 17:16:58 +10:00
David Herrmann
92ffda48ee Merge pull request #2 from whot/master
Add missing attributes.m4
2016-01-16 20:34:42 +01:00
Peter Hutterer
91a4a325ae Add missing attributes.m4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-20 09:06:17 +10:00
David Herrmann
7cff5e58f0 Merge pull request #1 from bentiss/master
Add Readme and the policy file required
2015-10-15 11:01:52 +02:00
Benjamin Tissoires
17f0fc41d1 Add Readme and the policy file required
Or running ratbagd (as root) raises a "Permission denied".

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-10-14 11:34:27 -04:00
David Herrmann
958e86f67e ratbagctl: pick default device if none given for show-device
Lets use the new get_device_path() helper to allow calling show-device
without any argument. This follows what show-profile does already.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 19:02:12 +02:00
David Herrmann
acb0118897 ratbagctl: split get_profile_path()
Split get_profile_path() and provide an helper for get_device_path() on
its own.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 19:00:27 +02:00
David Herrmann
85a045c538 ratbagctl: move get_profile_path()
Move get_profile_path() up to make it available to other verbs as well.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 18:57:42 +02:00
David Herrmann
fbffe241e6 ratbagctl: add show-profile verb
New verb: show-profile

This simply prints a profile of a given device by querying ratbagd for
all information on the selected profile.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 18:56:25 +02:00
David Herrmann
765fd1565a ratbagd: expose resolutions on the bus
Add a new property to profiles that exposes resolutions on the bus. We
simply expose a dictionary entry for each resolution, hence, we can
easily extend it in the future. However, we avoid the full overhead of
real dbus objects, as there is no real need for it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 18:55:03 +02:00
David Herrmann
1a677c0b1d ratbagd: add DBus methods to retrieve object paths
Add two new helpers to query ratbagd for the object-paths of a specific
object:
  GetDeviceByName: Return device given a device name
  GetProfileByIndex: Return a profile given a profile index

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 18:53:54 +02:00
David Herrmann
eeb8788413 ratbagctl: print the default profile
Include the default profile in 'show-device' output.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:35:00 +02:00
David Herrmann
c24ca68d63 ratbagd: expose 'DefaultProfile'
Add a new property that exposes the default profile.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:34:32 +02:00
David Herrmann
e189dc3b1f ratbagd: never return ENODATA for Get()
We should always provide valid data if requested via Get().
Unfortunately, DBus still does not include 'maybe' types, so we just
return something that is clearly invalid data.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:33:30 +02:00
David Herrmann
ff8f391e91 ratbagctl: implement list-devices and show-device
Two new verbs for ratbagctl:
 - list-devices: list all available devices
 - show-device: show detailed information about a single device

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:23:51 +02:00
David Herrmann
0a9c2824ba ratbagd: expose profile information
Expose a list of profiles, including a tag for the active profile, from
within each ratbagd device via DBus.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:23:51 +02:00
David Herrmann
dc37d3bf62 ratbagd: ignore NULL profiles
Never return information about non-existant profiles. Just skip NULL
profiles silently, when iterating.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:23:51 +02:00
David Herrmann
2780e6f3d7 ratbagd: simplify profile DBus paths
Refrain from hierarchical paths and instead use object prefixes with
unique paths each. This avoids several nasty DBus-enforced behaviors
regarding deep hierarchies. Furthermore, it keeps the names shorter,
which is always a nice side-effect.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:23:51 +02:00
David Herrmann
260df58856 ratbagd: profile profile accessors
Provide two new profile accessors that return the path and index of a
profile. This also requires us to cache the dbus path in the profile
itself.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:23:51 +02:00
David Herrmann
cba28a97a0 ratbagd: add ratbagd_device_get_name()
New helper to return the name of a device. This will be required to build
hierarchical paths in the sub-classes, like profiles.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:23:51 +02:00
David Herrmann
eca2203603 ratbagd: add manager interface
Instead of relying on the cricket ObjectManager interface, use our own
manager interface. This gets rid of ridiculous recursive behavior of the
ObjectManager interface and instead allows us to control the behavior.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 14:09:23 +02:00
David Herrmann
e926212554 ratbagd: remove ratbagd_device_list()
This is no longer needed. Use the device-iterator in ratbagd.c directly
and then drop ratbagd_device_list().

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 13:25:05 +02:00
David Herrmann
65463b6efb ratbagd: add device iterator
Add iterators for ratbagd_device objects.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 13:22:13 +02:00
David Herrmann
9ac799bc95 ratbagd: add ratbagd_device_get_path()
Add helper to retrieve the device path from outside of ratbagd-device.c.
This will be needed for the non-object-manager based enumerators and
signals introduced to org.freedesktop.ratbag1.Manager.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 13:21:27 +02:00
David Herrmann
7e4d757bdf ratbagd: cache device path
Cache device path in device->path and avoid re-calculating it all the
time.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 13:09:45 +02:00
David Herrmann
1a8037cd6c ratbagd: expose profiles on the bus
Profiles are static children of devices. Expose them as 2nd-level objects
underneath their parent devices on the bus.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-26 18:53:55 +02:00
David Herrmann
dbc8a37b56 ratbagd: move dbus device management
Make sure the device management (lookup and enumeration and registration)
is done from the parent, not the child. Hence, move it into ratbagd.c over
ratbagd-device.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-26 18:07:18 +02:00
David Herrmann
b1851ada93 ratbagd: split dbus handling from object handling
Make sure our dbus callbacks to not contain any logic themselves. They
should be simple wrappers around our internal object handling.

This also makes use of the new sd-bus pat helpers, to-be-released with
systemd-v227 next week.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-26 18:02:00 +02:00
David Herrmann
c0799b0c1d ratbagd: drop UNPRIVILEGED from properties
This does not work, we cannot flag properties as UNPRIVILEGED. Drop it.
Lets figure out later what exactly we want as privilege level to
enumerate and query device properties.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-26 17:59:58 +02:00
David Herrmann
e461710811 ratbagd: add basic device properties
Add two device properties:
  - Id: Returns the string ID to identify the device
  - Description: Returns the ratbag-device name

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-25 16:27:45 +02:00
David Herrmann
bea8e89cc7 ratbagd: create libratbag_device contexts
Make sure to create libratbag_device contexts for each device we add. If
libratbag returns NULL, we just ignore the devices. Otherwise, we keep
the context around and manage the device.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-25 16:05:26 +02:00
David Herrmann
17d66153b0 ratbagd: ignore anything but event devices
We are only interested in evdev, so ignore anything but input-event
devices.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-25 15:57:14 +02:00
David Herrmann
8ca0c11154 ratbagd: keep libratbag context around
Make sure the ratbagd context has a reference to a valid libratbag
context at all times. We need this to access libratbag devices, so lets
reference on in our own context.

This also adds a dependency for libratbag via autotools.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-25 12:51:11 +02:00
David Herrmann
c4afc3d5c0 shared: add safe_close()
Add safe_close() helper that makes close(2) a bit nicer to use. This also
introduces PROTECT_ERRNO, which makes sure a function does not clutter
errno if called.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-25 12:49:44 +02:00
David Herrmann
c22d51e439 build: be more consistent in variable names
Rename UDEV_* to LIBUDEV_* to be more consistent regarding other
pkg-build dependencies.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-25 12:35:43 +02:00
David Herrmann
aa052ae005 Import initial components
This adds two new components:

1) ratbagd
   The ratbagd daemon is a very basic dbus daemon that provides an
   org.freedesktop.DBus.ObjectManager based enumeration and modification
   API for libratbag devices. So far, all it does is enumerate input
   devices on the bus. However, this will be extended to advertise full
   libratbag hierarchies on the bus and allow clients to modify
   properties via DBus.

   So far, it is root-only, but the DBus policy can be losened and PolKit
   support can be added.

2) ratbagctl
   A very basic command-line tool to manage ratbagd. It's basically a
   command-line interface for the DBus API of ratbagd.

   So far, it has no hookup for anything. This will be added once ratbagd
   gains further DBus APIs.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-24 20:05:27 +02:00
David Herrmann
3f0b41ec3c Initialize ratbagd repository
Initial commit for the ratbagd project, a dbus daemon to manage libratbag
devices and proxy user accesses.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-24 16:45:22 +02:00
279 changed files with 32888 additions and 22317 deletions

20
.editorconfig Normal file
View File

@@ -0,0 +1,20 @@
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[*.{c,h}]
indent_style = tab
tab_width = 8
trim_trailing_whitespace = true
[{*.{py,py.in},tools/ratbagctl.*.in}]
indent_style = space
indent_size = 4
[*.{yml,xsl}]
indent_style = space
indent_size = 2

42
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,42 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Information**
<!-- If your issue is related to a Logitech device please make sure you are running at least Linux 5.2 -->
- `ratbagd` version (`ratbagd --version`):
- Distribution:
- Kernel version (ex. `uname -srmo`): `KERNEL VERSION HERE`
Device info (if applicable):
```
$ ratbagctl <device> info
OUTPUT HERE
```
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Logs**
Please start the daemon with verbosity and reproduce the issue.
First make sure it isn't running already.
```
$ ratbagd --verbose=raw
OUTPUT HERE
```
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

39
.github/actions/meson/action.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
# A Github Action to build a repository with meson
name: "Setup and run meson"
description: "Setup and run meson"
inputs:
builddir:
description: "The build directory"
default: "builddir"
srcdir:
description: "The source directory"
default: "."
meson_args:
description: "Arguments passed to meson setup"
default: ""
meson_skip_test:
description: "Set to a nonempty string to skip meson test"
default: ""
meson_test_args:
description: "Arguments passed to meson test"
default: ""
meson_precmd:
description: "Set to 'sudo' to run with sudo"
default: ""
ninja_args:
description: "Arguments passed to ninja"
default: ""
ninja_precmd:
description: "Set to 'sudo' to run with sudo"
default: ""
runs:
using: "composite"
steps:
- run: |
${{inputs.meson_precmd}} meson setup ${{inputs.builddir}} ${{inputs.srcdir}} ${{inputs.meson_args}}
${{inputs.meson_precmd}} meson configure ${{inputs.builddir}}
${{inputs.ninja_precmd}} ninja -C ${{inputs.builddir}} ${{inputs.ninja_args}}
if [[ -z "${{inputs.meson_skip_test}}" ]]; then
${{inputs.meson_precmd}} meson test -C ${{inputs.builddir}} --print-errorlogs ${{inputs.meson_test_args}};
fi
shell: bash

17
.github/actions/pkginstall/action.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: "Install packages"
description: "Install a set of packages from sources"
inputs:
apt:
description: "The package list to install with apt"
pip:
description: "The package list to install with pip"
pip_precmd:
description: "Set to the string 'sudo' to run through sudo"
default: ""
runs:
using: "composite"
steps:
- run: sudo ${{ github.action_path }}/install-apt.sh ${{ inputs.apt }}
shell: bash
- run: ${{inputs.pip_precmd}} ${{ github.action_path }}/install-pip.sh ${{ inputs.pip }}
shell: bash

14
.github/actions/pkginstall/install-apt.sh vendored Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash -x
# If called without arguments, just skip the rest
if [[ -z "$@" ]]; then
exit
fi
# Don't care about these bits
echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
echo 'path-exclude=/usr/share/locale/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
apt-get update
apt-get install -yq --no-install-suggests --no-install-recommends $@

9
.github/actions/pkginstall/install-pip.sh vendored Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash -x
# If called without arguments, just skip the rest
if [[ -z "$@" ]]; then
exit
fi
python -m pip install --upgrade pip
python -m pip install --upgrade "$@"

50
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: linux
on: [ push, pull_request ]
env:
UBUNTU_DEP_BUILD: |
gcc g++ pkg-config systemd libevdev-dev libglib2.0-dev
libjson-glib-dev libsystemd-dev libudev-dev libunistring-dev
python3-dev python3-evdev swig python3-sphinx
UBUNTU_DEP_TEST: check python3-gi python3-lxml valgrind
PIP_PACKAGES: meson ninja libevdev pyudev pytest sphinx_rtd_theme black ruff
jobs:
build-and-dist:
runs-on: ubuntu-20.04
strategy:
matrix:
meson_args:
- ''
- '-Dbuildtype=plain'
- '-Dbuildtype=release'
- '-Ddocumentation=true'
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/pkginstall
with:
apt: $UBUNTU_DEP_BUILD $UBUNTU_DEP_TEST
pip: $PIP_PACKAGES
- name: meson test ${{matrix.meson_args}}
uses: ./.github/actions/meson
with:
meson_args: --prefix=$PWD/_instdir ${{matrix.meson_args}}
ninja_args: install
- name: check installation of data files
run: diff -u <(cd data/devices; ls *.device) <(cd _instdir/share/libratbag; ls *.device)
- name: ninja uninstall
uses: ./.github/actions/meson
with:
meson_args: --prefix=$PWD/_instdir
ninja_args: uninstall
- name: check if any files are left after uninstall
run: (test -d _instdir && tree _instdir && exit 1) || exit 0
# Capture all the meson logs, even if we failed
- uses: actions/upload-artifact@v3
if: ${{ always() }} # even if we fail
with:
name: meson test logs
path: |
builddir/meson-logs/testlog*.txt
builddir/meson-logs/meson-log.txt

31
.github/workflows/pages.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: pages
on:
push:
branches:
- master
env:
UBUNTU_DEP_BUILD: gcc g++ pkg-config systemd libevdev-dev libglib2.0-dev libjson-glib-dev libsystemd-dev libudev-dev libunistring-dev python3-dev python3-evdev python3-pip swig python3-sphinx python3-sphinx-rtd-theme
PIP_PACKAGES: meson ninja
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/pkginstall
with:
apt: $UBUNTU_DEP_BUILD
pip: $PIP_PACKAGES
- name: Build docs
uses: ./.github/actions/meson
with:
meson_args: -Ddocumentation=true -Dtests=false
meson_skip_test: yes
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./builddir/doc/html/
allow_empty_commit: true

53
.gitignore vendored
View File

@@ -1,53 +0,0 @@
*.o
*.pc
*.la
*.lo
*.swp
*~
*.sig
*.tar.*
*.announce
*.patch
*.rej
*.trs
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
install-sh
libtool
ltmain.sh
missing
stamp-h1
.libs/
.deps/
src/libratbag-version.h
doc/libratbag.doxygen
doc/html
tags
test-driver
compile
m4
symbols-leak-test
symbols-leak-test.log
test-build-cxx
test-build-linker
test-build-pedantic-c99
test-build-std-gnuc90
test-iconv-helper
test-suite.log
test-context
test-device
test-*.log
ratbag-command
hidpp10-dump-page
hidpp20-dump-page
lur-command

View File

@@ -1,4 +1,5 @@
Copyright © 2015 Red Hat, Inc.
Copyright © 2015-2017 Red Hat, Inc.
Copyright © 2015 David Herrmann <dh.herrmann@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),

View File

@@ -1,6 +0,0 @@
SUBDIRS = src doc test tools hwdb data
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
valgrind:
(cd test; $(MAKE) valgrind)

175
README.md
View File

@@ -1,28 +1,115 @@
/*!@mainpage
libratbag
=========
libratbag is a configuration library for gaming mice. It provides a generic
way to access the various features exposed by these mice and abstracts away
hardware-specific and kernel-specific quirks.
<img src="https://libratbag.github.io/_images/logo.svg" alt="" width="30%" align="right">
Documentation
-------------
libratbag provides **ratbagd**, a DBus daemon to configure input devices,
mainly gaming mice. The daemon provides a generic way to access the various
features exposed by these mice and abstracts away hardware-specific and
kernel-specific quirks.
API documentation is available here:
libratbag currently supports devices from Logitech, Etekcity, GSkill,
Roccat, Steelseries. See [the device
files](https://github.com/libratbag/libratbag/tree/master/data/devices) for
a complete list of supported devices.
http://libratbag.github.io/libratbag/
Users interact through a GUI like
[Piper](https://github.com/libratbag/piper/). For developers, the
`ratbagctl` tool is the prime tool for debugging.
Architecture
------------
Installing libratbag from system packages
-----------------------------------------
libratbag has two main components, the front-end API and wrapper code, and
the back-end HW-specific drivers:
libratbag is packaged for some distributions, you can use your system's
package manager to install it. See [the
wiki](https://github.com/libratbag/libratbag/wiki/Installation) for details.
+-----+ +-----+ +-----------+ +----------+
| app | -> | API | -> | hw-driver | -> | protocol | -> device
+-----+ +-----+ +-----------+ +----------+
Compiling libratbag
-------------------
libratbag uses the [meson build system](http://mesonbuild.com) which in
turn uses ninja to invoke the compiler. Run the following commands to clone
libratbag and initialize the build:
git clone https://github.com/libratbag/libratbag.git
cd libratbag
meson builddir
ninja -C builddir
sudo ninja -C builddir install
The default prefix is `/usr/local`, i.e. it will not overwrite the system
installation. For more information, see [the
wiki](https://github.com/libratbag/libratbag/wiki/Installation).
And to build or re-build after code-changes, run:
ninja -C builddir
sudo ninja -C builddir install
To remove/uninstall simply run:
sudo ninja -C builddir uninstall
Note: `builddir` is the build output directory and can be changed to any
other directory name. To set configure-time options, use e.g.
meson configure builddir -Ddocumentation=false
Run `meson configure builddir` to list the options.
Running ratbagd as DBus-activated systemd service
-------------------------------------------------
To run ratbagd, simply run it as root `sudo ratbagd`. However,
ratbagd is intended to run as dbus-activated systemd service and installs
the following files:
/usr/share/dbus-1/system.d/org.freedesktop.ratbag1.conf
/usr/share/dbus-1/system-services/org.freedesktop.ratbag1.conf
/usr/share/systemd/system/ratbagd.service
These files are installed into the prefix by `ninja install`, see also the
configure-time options `-Dsystemd-unit-dir` and `-Ddbus-root-dir`.
Developers are encouraged to simply symlink to the files in the git
repository.
For the files to take effect, you should run
sudo systemctl daemon-reload
sudo systemctl reload dbus.service
And finally, to enable the service:
sudo systemctl enable ratbagd.service
This places the required symlink into the systemd directory so that dbus
activation is possible.
The DBus Interface
-------------------
Full documentation of the DBus interface to interact with devices is
available here: [ratbagd DBus Interface description](https://libratbag.github.io/).
libratbag Internal Architecture
-------------------------------
libratbag has two main components, libratbag and ratbagd. Applications like
Piper talk over DBus to ratbagd. ratbagd uses libratbag to access the actual
devices.
+-------+ +------+ +---------+ +-----------+
| Piper | -> | DBus | -> | ratbagd | -> | libratbag | -> device
+-------+ +------+ +---------+ +-----------+
Inside libratbag, we have the general frontend and API. Each device is
handled by a HW-specific backend. That HW backend is responsible for the
device-specific communication (usually some vendor-specific HID protocol).
+---------+ +-----+ +------------+ +----------+
| ratbagd | -> | API | -> | hw backend | -> | protocol | -> device
+---------+ +-----+ +------------+ +----------+
The API layer is HW agnostic. Depend on the HW, the protocol may be part of
the driver implementation (e.g. etekcity) or a separate set of files
@@ -31,36 +118,24 @@ implemented. The HW driver then only accesses the bits required for
libratbag. This allows us to optionally export the protocol as separate
library in the future, if other projects require it.
Adding Devices
--------------
Adding Devices to libratbag
---------------------------
As of commit 3605bede4 libratbag now uses a hwdb entry to match the device
with the drivers. To access a device through libratbag, the udev property
RATBAG_DRIVER must be set for a device's event node. Check with
libratbag relies on a device database to match a device with the drivers.
See the [data/devices/](https://github.com/libratbag/libratbag/tree/master/data/devices)
directory for the set of known devices. These files
are usually installed into `$prefix/$datadir` (e.g. `/usr/share/libratbag/`).
sudo udevadm info /sys/class/input/eventX | grep RATBAG_DRIVER
Adding a new device can be as simple as adding a new `.device` file. This is
the case for many devices with a shared protocol (e.g. Logitech's HID++).
See the
[data/devices/device.example](https://github.com/libratbag/libratbag/tree/master/data/devices/device.example)
file for guidance on what information must be set. Look for existing devices
from the same vendor as guidance too.
If your device is not yet assigned the property, it is not in the hwdb. It
may however be supported by one of our existing drivers. Try enabling it by
adding the device vendor-id/product-id to the hwdb file in
`hwdb/70-libratbag-mouse.hwdb`. For example, for a HID++ 1.0 device, edit
the 70-libratbag-mouse.hwdb file and add an entry with `RATBAG_DRIVER=hidpp10`.
For the other drivers, look for the id of the driver in driver-{drivername}.c
file and do the same.
Once your device is added to the hwdb, install libratbag and trigger a hwdb
update:
sudo udevadm hwdb --update
sudo udevadm control --reload
Then unplug/replug your mouse. `RATBAG_DRIVER` should appear in the udev
properties of your device with the value you previously set. If the property
is not assigned, the hwdb entry does not correctly match your device or the
installed udev rules/hwdb entries are not picked up by udev.
If the device doesn't work, you'll have to start reverse-engineering the
device-specific protocol. Good luck :)
If the device has a different protocol and doesn't work after adding the
device file, you'll have to start reverse-engineering the device-specific
protocol. Good luck :)
Source
------
@@ -70,20 +145,20 @@ Source
Bugs
----
Bugs can be reported in the issue tracker on our github repo:
https://github.com/libratbag/libratbag/issues
Bugs can be reported in [our issue tracker](https://github.com/libratbag/libratbag/issues)
Mailing list
------------
libratbag discussions happen on the input-tools mailing list hosted on
freedesktop.org: http://lists.freedesktop.org/archives/input-tools/
libratbag discussions happen on the [input-tools mailing
list](http://lists.freedesktop.org/archives/input-tools/) hosted on
freedesktop.org
Device-specific notes
---------------------
A number of device-specific notes and observations can be found in our
"device-notes" repository: http://libratbag.github.io/device-notes/
wiki: https://github.com/libratbag/libratbag/wiki/Devices
License
-------
@@ -98,7 +173,3 @@ libratbag is licensed under the MIT license.
> Software is furnished to do so, subject to the following conditions: [...]
See the COPYING file for the full license information.
[![Build Status](https://semaphoreci.com/api/v1/projects/7905244a-c0b5-468b-9071-d846de3ce9f1/545192/badge.svg)](https://semaphoreci.com/libratbag/libratbag)
*/

View File

@@ -1,9 +0,0 @@
#!/bin/sh
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=.
(
cd "$srcdir" &&
autoreconf --force -v --install
) || exit
test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"

View File

@@ -1,164 +0,0 @@
AC_PREREQ([2.64])
m4_define([libratbag_major_version], [0])
m4_define([libratbag_minor_version], [6])
m4_define([libratbag_micro_version], [0])
m4_define([libratbag_version],
[libratbag_major_version.libratbag_minor_version.libratbag_micro_version])
AC_INIT([libratbag],
[libratbag_version],
[],
[libratbag],
[])
AC_SUBST([LIBRATBAG_VERSION_MAJOR], [libratbag_major_version])
AC_SUBST([LIBRATBAG_VERSION_MINOR], [libratbag_minor_version])
AC_SUBST([LIBRATBAG_VERSION_MICRO], [libratbag_micro_version])
AC_SUBST([LIBRATBAG_VERSION], [libratbag_version])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
# Before making a release, the LIBRATBAG_LT_VERSION and LIBLUR_LT_VERSION
# strings should be modified.
# The strings are of the form C:R:A.
# a) If binary compatibility has been broken (eg removed or changed interfaces)
# change to C+1:0:0.
# b) If interfaces have been changed or added, but binary compatibility has
# been preserved, change to C+1:0:A+1
# c) If the interface is the same as the previous version, change to C:R+1:A
LIBRATBAG_LT_VERSION=4:0:0
LIBLUR_LT_VERSION=3:2:0
AC_SUBST(LIBRATBAG_LT_VERSION)
AC_SUBST(LIBLUR_LT_VERSION)
AM_SILENT_RULES([yes])
AC_USE_SYSTEM_EXTENSIONS
# Check for programs
AC_PROG_CC_C99
AC_PROG_CXX # Only used by build C++ test
AC_PROG_GREP
# Initialize libtool
LT_PREREQ([2.2])
LT_INIT
PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(LIBUDEV, [libudev])
PKG_CHECK_MODULES(LIBEVDEV, [libevdev])
if test "x$GCC" = "xyes"; then
GCC_CXXFLAGS="-Wall -Wextra -Wno-unused-parameter -g -fvisibility=hidden"
GCC_CFLAGS="$GCC_CXXFLAGS -Wmissing-prototypes -Wstrict-prototypes"
fi
AC_SUBST(GCC_CFLAGS)
AC_SUBST(GCC_CXXFLAGS)
AC_ARG_WITH(udev-base-dir, AS_HELP_STRING([--with-udev-base-dir=DIR], [where udev base directory is]))
if test -n "$with_udev_base_dir" ; then
UDEV_BASE_DIR="$with_udev_base_dir"
else
UDEV_BASE_DIR="$prefix/lib/udev"
fi
AC_SUBST(UDEV_BASE_DIR)
AC_ARG_ENABLE([documentation],
[AC_HELP_STRING([--enable-documentation],
[Enable building the documentation (default=auto)])],
[build_documentation="$enableval"],
[build_documentation="auto"])
if test "x$build_documentation" = "xyes" -o "x$build_documentation" = "xauto"; then
AC_PATH_PROG(DOXYGEN, doxygen)
if test "x$DOXYGEN" = "x"; then
if test "x$build_documentation" = "xyes"; then
AC_MSG_ERROR([Documentation build requested but doxygen not found. Install doxygen or disable the documentation using --disable-documentation])
fi
else
AC_MSG_CHECKING([for compatible doxygen version])
doxygen_version=`$DOXYGEN --version`
AS_VERSION_COMPARE([$doxygen_version], [1.6.0],
[AC_MSG_RESULT([no])
DOXYGEN=""],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([yes])])
if test "x$DOXYGEN" = "x" -a "x$build_documentation" = "xyes"; then
AC_MSG_ERROR([Doxygen $doxygen_version too old. Doxygen 1.6+ required for documentation build. Install required doxygen version or disable the documentation using --disable-documentation])
fi
fi
AC_PATH_PROG(DOT, dot)
if test "x$DOT" = "x"; then
if test "x$build_documentation" = "xyes"; then
AC_MSG_ERROR([Documentation build requested but graphviz's dot not found. Install graphviz or disable the documentation using --disable-documentation])
fi
else
AC_MSG_CHECKING([for compatible dot version])
dot_version=`$DOT -V 2>&1|$GREP -oP '(?<=version\W)@<:@0-9.@:>@*(?=\W(.*))'`
AS_VERSION_COMPARE([$dot_version], [2.26.0],
[AC_MSG_RESULT([no])
DOT=""],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([yes])])
if test "x$DOT" = "x" -a "x$build_documentation" = "xyes"; then
AC_MSG_ERROR([Graphviz dot $dot_version too old. Graphviz 2.26+ required for documentation build. Install required graphviz version or disable the documentation using --disable-documentation])
fi
fi
if test "x$DOXYGEN" != "x" -a "x$DOT" != "x"; then
build_documentation="yes"
else
build_documentation="no"
fi
fi
AC_ARG_ENABLE(tests,
AS_HELP_STRING([--enable-tests], [Build the tests (default=auto)]),
[build_tests="$enableval"],
[build_tests="auto"])
PKG_CHECK_MODULES(CHECK, [check >= 0.9.10], [HAVE_CHECK="yes"], [HAVE_CHECK="no"])
if test "x$build_tests" = "xauto"; then
build_tests="$HAVE_CHECK"
fi
if test "x$build_tests" = "xyes"; then
if test "x$HAVE_CHECK" = "xno"; then
AC_MSG_ERROR([Cannot build tests, check is missing])
fi
AC_PATH_PROG(VALGRIND, [valgrind])
fi
AC_DEFINE(BUILD_TESTS, [1], ["Build the test suite])
AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"])
AM_CONDITIONAL(BUILD_DOCS, [test "x$build_documentation" = "xyes"])
AC_CONFIG_FILES([Makefile
data/Makefile
doc/Makefile
doc/libratbag.doxygen
hwdb/Makefile
src/Makefile
src/libratbag.pc
src/libratbag-version.h
src/liblur.pc
test/Makefile
tools/Makefile])
AC_CONFIG_FILES([test/symbols-leak-test],
[chmod +x test/symbols-leak-test])
AC_OUTPUT
AC_MSG_RESULT([
Prefix ${prefix}
udev base directory: ${UDEV_BASE_DIR}
Build documentation ${build_documentation}
Build tests ${build_tests}
Tests use valgrind ${VALGRIND}
])

View File

@@ -1,2 +0,0 @@
libratbagdatadir = $(datadir)/libratbag
dist_libratbagdata_DATA = $(shell find $(top_srcdir)/data -name "*.svg" -printf "%P\n")

View File

@@ -1,26 +0,0 @@
libratbag data files
====================
These SVG files should approximate the device to make it immediately
recognizable. Detail work not required, the graphic is an illustration only.
Requirements
------------
- Canvas size: 750x750 pixels
- Two layers in the final SVG: a lower layer named "Device" with the device
itself, "Leaders" with the buttons and leader-lines
- The device should be approximately centered on the canvas and occupy a
meaningful portion of the canvas without making it look cramped
- Button labels must be in 12pt Sans, starting with Button0
- Wheel buttons may be labeled separately if required (look at the Etekcity
for an example)
Technique
---------
The simplest approach is to find a photo of the device and import it into
inkscape. Put it on the lowest layer, create a new layer "Device" above it
and start tracing the outlines and edges of the device. Fill in the shapes
and your device should resemble the underlying photo. Delete the photo
layer, add leaders and button labels and you're done.

11
data/devices/README.md Normal file
View File

@@ -0,0 +1,11 @@
libratbag data files
====================
This directory contains the data files for each supported device. libratbag
reads these files to identify the backend driver for any given device. If a
device is not listed, libratbag will not support it.
See the device.example file for instructions on the various options.
See the libratbag wiki for more information:
https://github.com/libratbag/libratbag/wiki/Adding-a-device/

View File

@@ -0,0 +1,12 @@
[Device]
Name=ASUS ROG GX860 Buzzard Mouse
DeviceMatch=usb:0b05:1816
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=10
Leds=0
Dpis=2
DpiRange=100:8200@100

View File

@@ -0,0 +1,14 @@
# ASUS ROG Chakram, but corded
[Device]
Name=ASUS ROG Chakram Core
DeviceMatch=usb:0b05:1958
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=5
Leds=3
Dpis=4
DpiRange=100:16000@100
Quirks=DOUBLE_DPI;STRIX_PROFILE

View File

@@ -0,0 +1,14 @@
[Device]
Name=ASUS ROG Chakram X
DeviceMatch=usb:0b05:1a18
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=5
Leds=3
Dpis=4
Wireless=1
DpiRange=100:36000@100
Quirks=DOUBLE_DPI

View File

@@ -0,0 +1,14 @@
[Device]
Name=ASUS ROG Chakram
DeviceMatch=usb:0b05:18e3;usb:0b05:18e5
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=5
Leds=3
Dpis=4
Wireless=1
DpiRange=100:16000@100
Quirks=DOUBLE_DPI;STRIX_PROFILE

View File

@@ -0,0 +1,13 @@
[Device]
Name=ASUS ROG Gladius II Origin PNK LTD
DeviceMatch=usb:0b05:18cd
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=8
Leds=3
Dpis=2
DpiRange=100:12000@100
Quirks=DOUBLE_DPI

View File

@@ -0,0 +1,14 @@
# "ASUS ROG Gladius II" without "DPI target button"
[Device]
Name=ASUS ROG Gladius II Origin
DeviceMatch=usb:0b05:1877
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=8
Leds=3
Dpis=2
DpiRange=100:12000@100
Quirks=DOUBLE_DPI

View File

@@ -0,0 +1,13 @@
[Device]
Name=ASUS ROG Gladius II
DeviceMatch=usb:0b05:1845
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=9
Leds=3
Dpis=2
DpiRange=100:12000@100
ButtonMapping=f0;f1;f2;e4;e5;e6;e7;e8;e9

View File

@@ -0,0 +1,13 @@
[Device]
Name=ASUS ROG Harpe Wireless
DeviceMatch=usb:0b05:1a92
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=5
Buttons=5
Leds=1
Dpis=4
Wireless=1
DpiRange=100:36000@50

View File

@@ -0,0 +1,13 @@
[Device]
Name=ASUS ROG Keris Wireless AimPoint
DeviceMatch=usb:0b05:1a68
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=5
Buttons=7
Leds=1
Dpis=4
Wireless=1
DpiRange=100:36000@50

View File

@@ -0,0 +1,14 @@
[Device]
Name=ASUS ROG Keris Wireless
DeviceMatch=usb:0b05:195e;usb:0b05:1960
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=8
Leds=2
Dpis=4
Wireless=1
DpiRange=100:16000@100
Quirks=DOUBLE_DPI

View File

@@ -0,0 +1,13 @@
[Device]
Name=ASUS ROG Pugio
DeviceMatch=usb:0b05:1846
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=10
Leds=3
Dpis=2
DpiRange=100:7200@100
ButtonMapping=f0;f1;f2;e4;e5;e6;0;e8;e9;e1;e2

View File

@@ -0,0 +1,14 @@
[Device]
Name=ASUS ROG Spatha X
DeviceMatch=usb:0b05:1979;usb:0b05:1977
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=5
Buttons=14
Leds=3
Dpis=4
Wireless=1
DpiRange=100:19000@50
ButtonMapping=f0;f1;f2;e4;e5;e6;e8;e9;ea;eb;ec;ed;ee;ef

View File

@@ -0,0 +1,14 @@
[Device]
Name=ASUS ROG Strix Carry
DeviceMatch=usb:0b05:18b4
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=8
Leds=0
Dpis=2
Wireless=1
DpiRange=100:7200@100
Quirks=STRIX_PROFILE

View File

@@ -0,0 +1,12 @@
[Device]
Name=ASUS ROG Strix Impact
DeviceMatch=usb:0b05:1847
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=1
Buttons=6
Leds=1
Dpis=2
DpiRange=100:5000@100

View File

@@ -0,0 +1,13 @@
[Device]
Name=ASUS ROG Strix Impact II Wireless
DeviceMatch=usb:0b05:1947;usb:0b05:1949
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=8
Leds=3
Dpis=4
Wireless=1
DpiRange=100:16000@100

View File

@@ -0,0 +1,12 @@
[Device]
Name=ASUS ROG Strix Impact II
DeviceMatch=usb:0b05:18e1
DeviceType=mouse
Driver=asus
[Driver/asus]
Profiles=3
Buttons=8
Leds=3
Dpis=4
DpiRange=200:6200@100

109
data/devices/device.example Normal file
View File

@@ -0,0 +1,109 @@
# Example description file for a libratbag device
#
# Make sure the file has a recognizable name with a '.device' suffix
[Device]
# The kernel name of the device. This name is not used by libratbag, it is
# used by debugging tools.
Name=Logitech Example Device
# DeviceMatch is a triplet of bus:vid:pid, where bus is 'usb' or bluetooth'
# and pid/vid are lowercase 4-digit hexadecimal numbers with preceding
# zeroes.
DeviceMatch=usb:12ab:00f2
# The libratbag driver backend
Driver=hidpp10
# The type of this Device: either 'mouse', 'keyboard' or 'other'
DeviceType=mouse
# Only one group of driver-specific properties is permitted and it must be
# [Driver/<drivername>]. It is a bug do have any other [Driver/foo] group in
# a device file, but this example file lists all.
[Driver/hidpp10]
# The number of profiles, must be greater than 0
Profiles=1
# The type of the profile
ProfileType=G9
# The range of available resolutions in the form min:max@step
# Mutually exclusive with DpiList
DpiRange=50:5700@50
# The list of available resolutions, separated by semicolons.
# Mutually exclusive with DpiRange
# Where possible, DpiRange should be preferred
DpiList=50;200;400;800
# The HID++ 1.0 device index
# Should be unset unless required
# DeviceIndex=1
# The number of LEDs
Leds=1
[Driver/hidpp20]
# The HID++ 2.0 device index
# Should be unset unless required
# DeviceIndex=1
[Driver/asus]
# Number of profiles
Profiles=3
# Number of buttons
Buttons=8
# Number of LEDs
Leds=3
# Number of DPI presets
Dpis=2
# Set if device is wireless
# Wireless=1
# DPI range in format min:max@step
DpiRange=100:16000@100
# Button mapping
# ButtonMapping=f0;f1;f2;e4;e5;e6;e8;e9
# Device quirks
# Quirk=DOUBLE_DPI;STRIX_PROFILE
# Replace `FEED` in the group name with firmware version of the device.
# To find the right value, see the output of ratbagd and search a message like:
# "ratbag error: Device with firmware version FEED is not supported"
# Official software utility configuration file key: `PSD` (converted from
# ASCII codes).
[Driver/sinowealth/devices/FEED]
# Number of buttons.
# Official software utility configuration file key: `KM` (divided by 2).
# Default: 0.
Buttons=6
# Device name.
DeviceName=CoolVendor CoolMouse
# The order of LED pins on the mouse.
# Change this to `RBG` if LED colors are weird.
# Use `None` if there are no LEDs on the mouse.
# Permitted values: ("RGB", "RBG", "None").
LedType=RGB
# Number of profiles, called "modes" in official software utilities.
# If you are unsure what the "mode" thing is about, don't set this field.
# Official software utility configuration file key: `MDNUM` (divided by 3).
# Default: 1.
Profiles=1
# Sensor type.
# This field is unused, only used for book-keeping purposes.
# Official software utility configuration file key: `Sensor`.
SensorType=PMW3289

View File

@@ -0,0 +1,5 @@
[Device]
Name=Etekcity Scroll Alpha
DeviceMatch=usb:1ea7:4011
Driver=etekcity
DeviceType=mouse

View File

@@ -0,0 +1,11 @@
[Device]
Name=Glorious Model D
DeviceMatch=usb:258a:0033
DeviceType=mouse
Driver=sinowealth
[Driver/sinowealth/devices/V102]
Buttons=6
DeviceName=Glorious Model D
LedType=RBG
SensorType=PMW3360

View File

@@ -0,0 +1,11 @@
[Device]
Name=Glorious Model O/O-
DeviceMatch=usb:258a:0036
DeviceType=mouse
Driver=sinowealth
[Driver/sinowealth/devices/V103]
Buttons=6
DeviceName=Glorious Model O/O- (updated firmware)
LedType=RBG
SensorType=PMW3360

View File

@@ -0,0 +1,6 @@
# G.Skill MX-780
[Device]
Name=G.Skill MX-780
DeviceMatch=usb:28da:3101
Driver=gskill
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# Logitech M325 over unifying
[Device]
Name=Logitech M325
DeviceMatch=usb:046d:400a
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# Logitech M500s
[Device]
Name=Logitech M500s
DeviceMatch=usb:046d:c093
DeviceType=mouse
Driver=hidpp20

View File

@@ -0,0 +1,6 @@
# Logitech M545
[Device]
Name=Logitech M545
DeviceMatch=usb:046d:4052
DeviceType=mouse
Driver=hidpp20

View File

@@ -0,0 +1,6 @@
# Logitech M570
[Device]
Name=Logitech M570
DeviceMatch=usb:046d:1028
Driver=hidpp10
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# Logitech M585/M590
[Device]
Name=Logitech M585/M590
DeviceMatch=usb:046d:406b;bluetooth:046d:b01b
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# Logitech M705
[Device]
Name=Logitech M705
DeviceMatch=usb:046d:101b
Driver=hidpp10
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech M720
DeviceMatch=usb:046d:405e;bluetooth:046d:b015
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# Logitech MX Anywhere 3
[Device]
Name=Logitech MX Anywhere 3
DeviceMatch=bluetooth:046d:b025;usb:046d:4090
DeviceType=mouse
Driver=hidpp20

View File

@@ -0,0 +1,6 @@
# Logitech MX Anywhere 3S
[Device]
Name=Logitech MX Anywhere 3S
DeviceMatch=bluetooth:046d:b037
DeviceType=mouse
Driver=hidpp20

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech MX Anywhere 2
DeviceMatch=usb:046d:404a;usb:046d:4072;usb:046d:4063;bluetooth:046d:b013;bluetooth:046d:b018;bluetooth:046d:b01f
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech MX Anywhere 2S
DeviceMatch=bluetooth:046d:b01a;usb:046d:406a
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# Logitech MX Anywhere 3B
[Device]
Driver=hidpp20
Name=Logitech MX Anywhere 3B
DeviceType=mouse
DeviceMatch=bluetooth:046d:b02d

View File

@@ -0,0 +1,6 @@
# Logitech MX Ergo
[Device]
Name=Logitech MX Ergo
DeviceMatch=bluetooth:046d:b01d;usb:046d:406f
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# Logitech MX Master 2S
[Device]
Name=Logitech MX Master 2S
DeviceMatch=bluetooth:046d:b019;usb:046d:4069
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# Logitech MX Master 3
[Device]
Name=Logitech MX Master 3
DeviceMatch=bluetooth:046d:b023;usb:046d:4082
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
DeviceMatch=bluetooth:046d:b035
DeviceType=mouse
Driver=hidpp20
Name=Logitech MX Master 3S for Business

View File

@@ -0,0 +1,5 @@
[Device]
DeviceMatch=bluetooth:046d:b034
DeviceType=mouse
Driver=hidpp20
Name=Logitech MX Master 3S

View File

@@ -0,0 +1,6 @@
# Logitech MX Master
[Device]
Name=Logitech MX Master
DeviceMatch=usb:046d:4041;bluetooth:046d:b012;usb:046d:4060;bluetooth:046d:b017;bluetooth:046d:b01e;usb:046d:4071
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech MX Vertical
DeviceMatch=bluetooth:046d:b020;usb:046d:407b;usb:046d:c08a
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=MX518
DeviceMatch=usb:046d:c08e
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech Marathon M705
DeviceMatch=usb:046d:406d
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# Logitech T650 over unifying
[Device]
Name=Logitech T650
DeviceMatch=usb:046d:4101
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# Logitech Wireless Touchpad (Unifying)
[Device]
Name=Logitech Wireless Touchpad
DeviceMatch=usb:046d:4011
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,8 @@
[Device]
Name=Logitech G Powerplay
DeviceMatch=usb:046d:405f
Driver=hidpp20
DeviceType=other
[Driver/hidpp20]
DeviceIndex=7

View File

@@ -0,0 +1,5 @@
[Device]
DeviceMatch=usb:046d:c339
DeviceType=keyboard
Driver=hidpp20
Name=Logitech G PRO Keyboard

View File

@@ -0,0 +1,8 @@
[Device]
Name=Logitech G Pro Wireless
DeviceMatch=usb:046d:4079;usb:046d:c088
Driver=hidpp20
DeviceType=mouse
[Driver/hidpp20]
DeviceIndex=1

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G Pro X Wireless Superlight
DeviceMatch=usb:046d:4093;usb:046d:c094
DeviceType=mouse
Driver=hidpp20

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech Gaming Mouse G Pro
DeviceMatch=usb:046d:c085;usb:046d:c08c
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# G102, G103 and G203 (USB)
[Device]
Name=Logitech Gaming Mouse G102/G103/G203
DeviceMatch=usb:046d:c084;usb:046d:c092;usb:046d:c09d
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# WARNING: this file was automatically converted and has not yet been vetted
[Device]
Name=Logitech G300
DeviceMatch=usb:046d:c246
Driver=logitech_g300
DeviceType=mouse

View File

@@ -0,0 +1,6 @@
# G302 over USB
[Device]
Name=Logitech Gaming Mouse G302
DeviceMatch=usb:046d:c07f
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G303 Shroud Edition
DeviceMatch=usb:046d:c097
DeviceType=mouse
Driver=hidpp20

View File

@@ -0,0 +1,6 @@
# G303 over USB
[Device]
Name=Logitech Gaming Mouse G303
DeviceMatch=usb:046d:c080
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,9 @@
[Device]
Name=Logitech Gaming Mouse G305
DeviceMatch=usb:046d:4074
Driver=hidpp20
DeviceType=mouse
[Driver/hidpp20]
Leds=0
Quirk=G305

View File

@@ -0,0 +1,6 @@
# Logitech G402 Gaming Mouse USB
[Device]
Name=Logitech G402 Gaming Mouse
DeviceMatch=usb:046d:c07e
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G403 Hero
DeviceMatch=usb:046d:c08f
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G403 Wireless
DeviceMatch=usb:046d:405d;usb:046d:c082
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G403
DeviceMatch=usb:046d:c083
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
DeviceMatch=usb:046d:c33a
DeviceType=keyboard
Driver=hidpp20
Name=Logitech G413

View File

@@ -0,0 +1,11 @@
# Name=Logitech G5 2007
[Device]
Name=Logitech G5
DeviceMatch=usb:046d:c049
Driver=hidpp10
DeviceType=mouse
[Driver/hidpp10]
DpiList=400;800;1600;2000
Profiles=1
ProfileType=G500

View File

@@ -0,0 +1,8 @@
[Device]
Name=G5
DeviceMatch=usb:046d:c041
Driver=hidpp10
DeviceType=mouse
[Driver/hidpp10]
DpiList=400;800;1600;2000

View File

@@ -0,0 +1,10 @@
[Device]
Name=Logitech G500
DeviceMatch=usb:046d:c068
Driver=hidpp10
DeviceType=mouse
[Driver/hidpp10]
DpiRange=0:5700@23.53
ProfileType=G500
Profiles=1

View File

@@ -0,0 +1,10 @@
[Device]
Name=Logitech G500s
DeviceMatch=usb:046d:c24e
Driver=hidpp10
DeviceType=mouse
[Driver/hidpp10]
DpiRange=0:8200@50
ProfileType=G500
Profiles=1

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G502 Hero Wireless
DeviceMatch=usb:046d:407f;usb:046d:c08d
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G502 Hero
DeviceMatch=usb:046d:c08b
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G502 Proteus Core
DeviceMatch=usb:046d:c07d
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G502 Proteus Spectrum
DeviceMatch=usb:046d:c332
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G502 X Wireless
DeviceMatch=usb:046d:c098
DeviceType=mouse
Driver=hidpp20

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G502 X
DeviceMatch=usb:046d:c099
DeviceType=mouse
Driver=hidpp20

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G513
DeviceMatch=usb:046d:c33c
Driver=hidpp20
DeviceType=keyboard

View File

@@ -0,0 +1,6 @@
# WARNING: this file was automatically converted and has not yet been vetted
[Device]
Name=Logitech G600
DeviceMatch=usb:046d:c24a
Driver=logitech_g600
DeviceType=mouse

View File

@@ -0,0 +1,10 @@
# Logitech G602 over wireless USB
[Device]
Name=Logitech G602
DeviceMatch=usb:046d:402c
Driver=hidpp20
DeviceType=mouse
[Driver/hidpp20]
DeviceIndex=1
Quirk=G602

View File

@@ -0,0 +1,6 @@
# Logitech G603
[Device]
Name=Logitech G603
DeviceMatch=usb:046d:406c;bluetooth:046d:b01c
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G604
DeviceMatch=usb:046d:4085;bluetooth:046d:b024
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,8 @@
[Device]
Name=Logitech G635
DeviceMatch=usb:046d:0a89
DeviceType=mouse
Driver=hidpp20
[Driver/hidpp20]
Buttons=0

View File

@@ -0,0 +1,10 @@
# Logitech G7
# http://support.logitech.com/en_us/product/g7-laser-cordless-mouse/specs
[Device]
Name=Logitech G7
DeviceMatch=usb:046d:c51a
Driver=hidpp10
DeviceType=mouse
[Driver/hidpp10]
Profiles=1

View File

@@ -0,0 +1,13 @@
# Logitech G700 over wireless USB
# http://support.logitech.com/en_us/product/wireless-gaming-mouse-g700/specs
[Device]
Name=Logitech G700
DeviceMatch=usb:046d:c531
Driver=hidpp10
DeviceType=mouse
[Driver/hidpp10]
DpiRange=0:5700@23.53
ProfileType=G700
DeviceIndex=1
Profiles=5

View File

@@ -0,0 +1,12 @@
# Logitech G700 over USB
# http://support.logitech.com/en_us/product/wireless-gaming-mouse-g700/specs
[Device]
Name=Logitech G700
DeviceMatch=usb:046d:c06b
Driver=hidpp10
DeviceType=mouse
[Driver/hidpp10]
DpiRange=0:5700@23.53
ProfileType=G700
Profiles=5

View File

@@ -0,0 +1,12 @@
# Logitech G700s over USB
# http://support.logitech.com/en_us/product/g700s-rechargable-wireless-gaming-mouse/specs
[Device]
Name=Logitech G700s
DeviceMatch=usb:046d:c07c
Driver=hidpp10
DeviceType=mouse
[Driver/hidpp10]
DpiRange=0:8200@50
ProfileType=G700
Profiles=5

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G703 Hero
DeviceMatch=usb:046d:4086;usb:046d:c090
Driver=hidpp20
DeviceType=mouse

View File

@@ -0,0 +1,5 @@
[Device]
Name=Logitech G703
DeviceMatch=usb:046d:c087;usb:046d:4070
Driver=hidpp20
DeviceType=mouse

Some files were not shown because too many files have changed in this diff Show More