We need hidpp20 to handle the list of available features. So we need to be
sure in hidpp20 that we are talking to a hidpp20 device.
Move the version retrieval in hidpp20 where it makes sense.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This struct will be used to store the table features/index and probably
others. It also allows a single entry point to set the device index.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Etekcity and Roccat are using raw HID code to send the macros. The Logitech
hid++ 2.0 are too so let's centralize the code in hidraw and simplify
the code per-driver.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
RATBAG_BUTTON_ACTION_SPECIAL_RESOLUTION_ALTERNATE (for the "sniper switch")
RATBAG_BUTTON_ACTION_SPECIAL_RESOLUTION_DEFAULT -> means what it means
And fix one missing entry in str_to_special_action.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
'base' was wrongly inherited from the hidpp10 implementation, but actually
it makes no sense in this context.
Also, we want to reserve the keyword 'base' for when we introduce
hidpp20_device.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The current API takes offset in 2-byte values. Taking a byte value
is more natural. We need to upgrade the type of offset to uint16_t
to handle values > 256.
For protocol debugging, it's a lot easier to go have a simple helper than
having to go through the whole of libratbag.
And remove the page-dump helper from the main code.
Note that this tool needs a /dev/hidraw device directly, not an event node. It
is a debugging tool after all.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We now only use libratbag for logging. Abstract that away so we can use
hidpp10 separate from libratbag where needed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Part 2 of disentangling libratbag from the hidpp10 library. Copy the hidraw_fd
into the hidpp_device struct and use that during read/write.
This temporarily disables logging, will be re-enabled with an upcoming commit.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
HID++ 1.0 doesn't need hidraw other than the fd itself, and this is the first
step to disentangling the hidpp10 code from libratbag.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Requires a ratbag_device argument (with the hidraw fd open) but then tries to
list them - that doesn't quite work.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We have documentation for that, it does what it's already doing. It's called
sector + entry in the doc, but leave it at page + offset since we've been
using this in other comments.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The caller doesn't need to worry about registers or something here, let's just
expose one single bitmask, provided by an enum.
This also adds s couple of missing bits from the previous implementation.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The caller doesn't need to worry about registers or something here, let's just
expose one single bitmask, provided by an enum.
This also adds s couple of missing bits from the previous implementation.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The request length doesn't tell us what the expected response length is, e.g.
0x63 (current resolution) is set with a long request but replies with a short
ack.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
First: there are 6 LEDs, not just 4. If the LEDs don't exist, the value is
UNCHANGED on the read request.
The value is more than a simple on/off, though at least the G500s only looks
at the lower two bits, so heartbeat and slow off both translate into "on" and
blink and slow on both translate to "off".
There doesn't seem to be a detection mechanism for what a device really
supports.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
There's no good reason to return the object from the unref() call other than
for testing purposes, and we can work around this by using valgrind instead.
The API is a lot more consistent when we always return NULL.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Seen on the second input node of the Roccat Kone XTD:
"ratbag error: ROCCAT Kone XTD: driver specified in hwdb not found: roccat
With the new hwdb matching, we should not try any other driver not having
the right id, so simplify the for loop to find the driver only.
Fixes#32
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Blows up when sprintf encounters an error, the result string is empty or the
result string is truncated.
Note: sprintf_safe only works on static buffers, it uses ARRAY_LENGTH.
Fixes#14
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This patch adds nothing but some debug outputs and prepares the code
to support the recent gaming mice from Logitech.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The G502 uses the version 0 of the adjustable DPI feature. This version
does not echo the given parameters which raised a -EIO in libratbag.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>