The new version is called "G502 Proteus Spectrum", so the older version comment is changed to "G502 Proteus Core" (its complete name) to avoid confusion.
Signed-off-by: Clément Vuchener <clement.vuchener@gmail.com>
Was off by one, the message content only includes one byte of extra information
before the serial number. And add a BE 32-bit helper while we're at it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The onboard profile do not store the current value but the default.
To retrieve the current value, we need to access the switchable resolution
feature.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The G900 advertises 5 profiles, which do not fit in only 16 bytes.
We need to read at least 32 bytes, so be it.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The device can report how much rom it has through profile_count_oob.
Make sure we have something in ROM before accessing it.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
If the macro has not been retrieved, it's more likely that the button
is not bound to anything.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
A negative error means a communication error, while a positive one means
a HID++ one. Make sure we abort early enough.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
rc is set to 0 by ratbag_open_hidraw_node(), and if matched failed, we
close the hidraw node and end the loop.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Once we start probing devices for multiple drivers we shouldn't just print
error messages for every failed driver. In the hidpp20 case an error would be
printed for any hidpp10 logitech device.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
If a device is not specifically assigned a driver, try hidpp20 and then
hidpp10 hoping that one of them will work.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Prep work for being able to probe multiple drivers on a device. The function
that tests the actual driver simply takes a const char * with the driver name,
so in the future we can loop through multiple driver names easily.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
No need for two separate cleanup blocks, they're doing the same thing anyway.
Just make the function more robust to uninitalized fields and we're good to
go.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
hidpp10 devices have their own driver, let's not initialize them here and just
fail. If a hidpp10 device is assigned the hidpp20 driver this is a bug.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
No reason for the drivers to have their own printf each, just return the
negative errno and let the common code print it.
This now also means that we only return -ENODEV on something that's not really
an error, for anything else we print the strerror.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We now get an error message for all devices that have duplicate event nodes
because we use -ENODEV for 'device not found', 'device is a duplicates' and
'device doesn't have the hidraw report'.
The original commit was triggered by a misunderstanding of the error message,
will be fixed in a follow-up.
This reverts commit 855a6bd831.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit b3237fd0 ("lur: change new_from_hidraw to return an errno") broke
the API, so we need to bump the version too.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>