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