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