New devices define a profile field in the button configuration. This
allows us to map a button to set the target profile as active. Even
though we don't support configuring this right now, some devices, such
as the G915/G815, come pre-configured with this action on th M-Keys.
This patch makes us able to read and write those settings, this way they
don't get lost when we write a profile to the device.
Signed-off-by: Filipe Laíns <lains@archlinux.org>
gcc 10 complains about multiple definitions of these when linking.
/usr/bin/ld: libhidpp.a(src_hidpp-generic.c.o):/builddir/build/BUILD/libratbag-0.12/x86_64-redhat-linux-gnu/../src/libratbag-private.h:588:
multiple definition of `etekcity_driver';
libutil.a(src_libratbag-util.c.o):/builddir/build/BUILD/libratbag-0.12/x86_64-redhat-linux-gnu/../src/libratbag-private.h:588:
first defined here
Special case here is the test_driver struct, without the extern gcc seems to
think it's a new struct with all zeros, causing a segfault when we then try to
strcmp the test driver name.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Removes useless setting of the dpi index when updating resolutions.
Removes weird empty line.
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
- File "./build/ratbag-command", line 2289, in open_ratbagd
r = Ratbagd(1)
TypeError: __init__() takes 1 positional argument but 2 were given
- AttributeError: module 'libratbag' has no attribute
'ratbag_device_get_bus'
- File "./build/ratbag-command", line 267, in model
return "{}:{04x}:{04x}:{d}".format(bus, vid, pid, version)
KeyError: '04x'
- swig/python detected a memory leak of type 'uint32_t *', no destructor
found.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This patch moves the 0x8100 initialization routine out of
hidpp20drv_init_feature because it needs the capabilities to be
processed first.
Signed-off-by: Filipe Laíns <lains@archlinux.org>
These are two fields of a union and should have the same value. What the
code doing here is trying to free a pointer twice.
Signed-off-by: Qiu Wenbo <qiuwenbo@phytium.com.cn>
This was copied from libinput and made sense while libratbag was a library -
we want "unhandled" messages to end up somewhere and stderr is the most likely
candidate here.
Now that we always run within ratbagd and it's all effectively inseperable,
just log to stdout for anything below error.
The switch statement was reformatted for consistency, only the ERROR case has
changed code.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
When the windows driver puts a device in host mode it will mark all 8100
profiles as disabled. If no 8100 profile is enabled no libratbag profile
will get enabled. This patch prevents this by marking the first profile
as enabled if no profile is already enabled.
Signed-off-by: Filipe Laíns <lains@archlinux.org>
TBH I don't know why I wrote the original code in the first place, it
clearly doesn't follow the spec.
Signed-off-by: Filipe Laíns <lains@archlinux.org>
Right now we initialize any hidpp10 device with one profile and then go and
fetch the data. But we never check for return codes, so it always succeeds
even when we can't get anything out of the device at all. Eventually we fail
the sanity checks with "invalid dpi list" which is confusing at best.
Let's avoid this by requiring at least the current profile to work. This will
break devices that have a single emulated profile, i.e. those that don't have
profiles but rely on libratbag to emulate one based on the
current-resolution/current-... calls. Not sure we actually support any of
those, so let's see.
Closes#738 though it doesn't fix it, it just bails out better.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This is confusing because we do have a test driver and we have an optional
test_device argument here too.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Rather than bail out completely, let's pretend the factory profile is profile
0 and keep going. This gives us a pretend-function mouse, though whether this
actually works is questionable.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>