Commit Graph

461 Commits

Author SHA1 Message Date
Yaroslav Chvanov
85cab665b5 tools: remove helpers for the deprecated ratbag_button_type 2023-02-25 13:03:37 +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
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
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
Yaroslav Chvanov
4b2b5a2038 ratbagctl: capitalize device type instead of having it in upper case 2023-02-14 16:29:21 +03:00
Julian Kandlhofer
4f36371af3 implement 'DeviceType' property
Signed-off-by: Julian Kandlhofer <julian.kandlhofer@gmail.com>
2023-02-14 16:29:20 +03:00
Yaroslav Chvanov
440292fda1 device: add firmware version API 2023-01-03 04:21:07 +03:00
Yaroslav Chvanov
7a5b9b4367 Fix typos throughout the codebase 2023-01-03 04:17:44 +03:00
Yaroslav Chvanov
f595c96495 ratbagctl: fix typo 2022-12-26 23:44:48 +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
56e0ee9279 ratbagctl: check if disabling buttons is supported 2022-12-23 04:01:29 +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
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
0b8f4a25b1 tools: put the list of possible button action types into a const 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
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
Kyoken
e0dc0a3a5b fix ratbag-command led setting 2022-01-24 12:55:12 +10:00
Stephen Kitt
206bc5996d man: add both variants in ratbagctl.1 synopsis
PR #1188
2021-06-30 19:23:30 +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
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
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
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
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
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
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
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
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
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
Filipe Laíns
e63802b01a ratbagd: make raw the default verbosity level (#857)
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2019-12-05 08:07:46 +10:00
Peter Hutterer
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
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