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
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
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