In case the udev property is not present, we might want to query
the driver for the SVG name.
This is useful for driver-test as there is no udev device attached to
it, and for hidpp20 as we have auto-detection. We should then be able
to implement this in hidpp20 also so that the name gets automatically
created.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
If the profile is not active, we do not know which resolution is currently
used. Instead of having ratbagd complaining, just set the default as
active.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This shuts up a scan-build warning about a memleak that looked like a false
positive but I couldn't get rid of.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
rc may be a negative errno or a positive hidpp error code. If the latter we
used to continue with a NULL macro pointer, eventually crashing.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Just logging and error and continuing is not enough, we'll eventually
dereference garbage values.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This makes code that just checks for general abilities easier to write, the
specific thing we can do (e.g. switch profiles) is expressed as separate bit.
This is an ABI break
Related to #172
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We somehow now know how to write effects.
No need to carry around some left overs from previous configurations.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Shouldn't change the behavior, but this allows adding the other effects
found in the documentation.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Currently we only support mice with 2 LEDs in the profile. No need
to have 32 placeholders.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We are using a uint in the end, so better have proper order in the
multiplications/divisions than using doubles.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
profile->dpi_modes[i].led[] is an array of boolean.
Given that the callers (hidpp10_fill_dpi_modes_*()) already are doing the
comparison against 0x02, I guess this is just copy/paste error.
Fixes#152
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
When using the G502 without RGB LEDs, the feature 8070 is not here.
And this segfaults :)
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Unsurprisingly, meson does not support the ratbag keyword argument. Though it
should, because we're great. But anyway, this lead to the argument being
ignored which means it didn't get an 'input' argument, which means that
libratbag-version.h.in was ignored. And since it all works anyway (Behold! The
magic! Ooooh! Aaaah!) we can just drop that file.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Now that we use meson exclusively and meson uses this for its config.h, you
wouldn't get around it anyway. Besides, the main compilers support it and
libratbag is too niche to worry about others.
This also *adds* the pragma to tools/shared.h where it was previously missing,
and changes it to be the top statement in hidpp-generic.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
If we don't change count, the value of count < MAX_RETRY is always true.
Coverity is a champ, isn't it?
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Rather than having a bunch of gotos just define a cleanup for this device and
let the magic do the rest.
Found by coverity
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
A semi false-positive from Coverity, because action.macro is unset. Doesn't
matter because we never use it, but having it zeroed is the nice thing to do
(and what we do in the other functions).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
pkgconfig.generate() does not (yet) have a parameter for setting custom
variables - we need that for pkgdatadir to point to the SVG files. Swap to
using configure_file with the old .pc.in file that was forgotten in the tree
anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
And thus drop the code to parse the top_srcdir from the arguments to the
symbols-leak-test, not the env.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
driver-gskill.c: In function ‘gskill_read_button’:
driver-gskill.c:791:3: warning: ‘event_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ratbag_button_macro_set_event(macro, event_idx, type,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
event_data);
~~~~~~~~~~~
driver-gskill.c:791:3: warning: ‘type’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ratbag_button_macro_set_event(macro, event_idx, type,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
event_data);
~~~~~~~~~~~
Add a default case which should never get reached.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Apparently the mouse can be configured to send scancodes
for buttons 6-9.
Note: there's no meaning attached to scancode 0x118 in the kernel,
which is sent by button 9, but xev does detect it.
I fixed resolution cycle up actually being resultion cycle down and added the missing cycle actions for resolutions and profiles.
Signed-off-by: Clément Vuchener <clement.vuchener@gmail.com>