Commit Graph

82 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
a9545b2b63 test: use a simply assert instead of using a helper 2023-03-02 14:05:37 +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
80fa7f5b8f Use 'key in dict' instead of 'key in dict.keys()' 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
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
87f1409b7a test: remove usage of the deprecated LED type field 2023-02-25 14:02:37 +03:00
Yaroslav Chvanov
274f19e84b test: don't allow the deprecated LedTypes field 2023-02-25 13:39:47 +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
b0a9f24afb test: remove a duplicate import 2023-02-24 23:44:00 +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
7a5b9b4367 Fix typos throughout the codebase 2023-01-03 04:17:44 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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