1
0
forked from drath/libratbag
Commit Graph

170 Commits

Author SHA1 Message Date
Peter Hutterer
f5df7f0ec9 hidpp10: split the commands into helper functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 14:41:46 +10:00
Peter Hutterer
038c50077c driver-hidpp10: force the index to 0x00 for wired devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:38:14 +10:00
Peter Hutterer
ecca960bd9 hidpp10: __u8 -> uint8_t
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:38:14 +10:00
Peter Hutterer
1b799d2d84 hidpp10: only run the pairing information commands if the first one succeeds
Still try to run the other commands though, they're not receiver-related and
may work on a device that's not on a unifying receiver.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:38:14 +10:00
Peter Hutterer
e5df589c84 hidpp10: fix up coding style a bit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:38:14 +10:00
Peter Hutterer
1563efd988 hidpp10: request individual features
Not doing anything with it, this is just playing around.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:38:08 +10:00
Peter Hutterer
4c7fb6f803 hidpp10: Add support for the HID++1.0 Notifications request
They're off by default, but I have to start testing somewhere...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:37:43 +10:00
Peter Hutterer
5179f56a80 Revert "driver-unifying: remove the hidpp 1.0 commands and behavior"
Now that we have a separate HID++ 1.0 driver, we can restore this. Except the
fake button mapping.

This reverts commit 874fc3386f.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:37:41 +10:00
Peter Hutterer
0d97c99306 driver-hidpp10: override the hidraw device for unifying receivers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:37:41 +10:00
Peter Hutterer
6ab11a0585 Don't check for the HID info when opening a hidraw node
This screws with the HID++1.0 unifying receivers. Let's punt the
responsibility for opening the right hidraw node to the caller and only error
out if we fail the ioctl.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 11:55:54 +10:00
Peter Hutterer
3782b37853 Drop the 'device' argument from libratbag_device_set_active_profile
The profile is bound to a device anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 11:55:35 +10:00
Peter Hutterer
cea9bc6290 Drop some unneeded parameters where we have a way to get it anyway
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 11:55:35 +10:00
Peter Hutterer
82338aadcd Use strneq instead of strncmp
Less error-prone

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 11:55:35 +10:00
Peter Hutterer
d73d9f6023 Rename ratbag_device structs to "device"
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 11:55:35 +10:00
Peter Hutterer
bbc4af6419 hidpp20: add support for 0x1b00 reprogrammable keys
As seen on the T650.

Reusing most of 0x1b04 here, except this one only gives us control id, task id
and flags.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-22 18:04:02 +10:00
Peter Hutterer
5e61dc4800 hidpp20: add control/task ID mappings from 0x1b00
Let's hope that the range is the same here and 0x1b04 doesn't redefine some of
them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-22 17:42:29 +10:00
Peter Hutterer
25580e1060 Drop device handle from the button, the profile has it
...and buttons must be part of a profile.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-22 16:15:21 +10:00
Benjamin Tissoires
cc7c85ffdf hidpp20: fix reading of button mapping
When the button is not redirected, we need to rely on the control_id,
not the task_id to get the logical action of the button.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 16:59:36 -04:00
Benjamin Tissoires
88154c2438 hidpp20drv: implement button remapping
Problem: when a button is diverted, it stops sending its original button,
which is good, but then reports only on the HID++ long report collection.

That is a little bit embarrassing.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 15:50:01 -04:00
Benjamin Tissoires
bc05440477 hidpp20: do not shout one more time the recieved data
well, there is no fine grain while outputing the raw events, so that
means that we have always shown the actual answer just before.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 15:24:33 -04:00
Benjamin Tissoires
7fb5c2f81d hidpp20: handle new errors reporting
Looks like HID++2.0 devices report errors with 0xff also.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 15:24:33 -04:00
Benjamin Tissoires
8b0221554e hidpp20: invert logical/physical in function 1b04
I misread the documentation. The task_id corresponds to what the button
has been physically designed to, and the control_id is the logical
remapping.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 15:24:33 -04:00
Benjamin Tissoires
0eb6bd3948 hidpp: fill the ratbag_button info
We still need to differentiate logical from physical in button types.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 15:23:14 -04:00
Benjamin Tissoires
d6186c0c5a hidpp20: re-order the features by numeric order
no functional changes, just moving code.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:44:36 -04:00
Benjamin Tissoires
14279b26cd hidpp*drv: update copyrights and header
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:39:11 -04:00
Benjamin Tissoires
5b8b2319e5 Add LOGITECH_DEVICE macro for declaring Logitech devices in drivers
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:34:19 -04:00
Benjamin Tissoires
7b984b86ef M705 is a HID++ 1.0 device
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:27:59 -04:00
Benjamin Tissoires
4075929f40 hidpp20drv: retrieve the number of buttons from the device
Looks like the MX Master does not count the wheels as buttons.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:26:43 -04:00
Benjamin Tissoires
40bbd7bde8 hidppdrv: store the controls list in drv_data to avoid re-retrieving it
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:26:43 -04:00
Benjamin Tissoires
6b3c7d48fe hidppdrv: store the sensors list in drv_data to avoid re-retrieving it
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:26:43 -04:00
Benjamin Tissoires
cf4a932d34 Implement set profile resolution dpi
Works only in Logitech with adjustable DPI for now (MX Master).

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:26:43 -04:00
Benjamin Tissoires
64cfad665d Implement reading the resolution of the sensor
Should work with adjustable DPI and fixed DPI for Logitech devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:26:43 -04:00
Benjamin Tissoires
1ad8b49be0 hidpp20: avoid writing of uninitialized value
The function does not take any argument, so the device ignores it,
but valgrind complains.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:26:43 -04:00
Benjamin Tissoires
6bac6b9eb3 driver-hidpp20: fix formatting and renaming
And remove the spurious comments that have been introduced in
f759cbdcef ("drivers: do not declare defines that are used only once").

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:26:43 -04:00
Peter Hutterer
529a69e120 Split HID++ 1.0 into a separate driver
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 15:11:57 +10:00
Peter Hutterer
472b394858 hidpp20: Implement support for battery level
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 15:11:57 +10:00
Peter Hutterer
b15923d620 Rename the unifying driver to hidpp20
This driver is really a driver for HID++ 2.0 devices, not just for devices on
the unifying receiver.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 11:11:47 +10:00
Peter Hutterer
03c39c1120 driver-unifying: reword a log message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 11:02:49 +10:00
Peter Hutterer
d361bcb09f hidpp22: add a helper to not log some HID++ errors
The 2.0 GetProtocolVersion request will fail on 1.0 devices but there is no
equivalent for 1.0. The doc even suggests to detect this error to determine
whether a device is a 1.0 device. Thus, make it conditional on whether we
print the error or not (log it as debug message if turned off).

This should be reconsidered when we have everything in place and can think
about refacturing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 11:01:17 +10:00
Peter Hutterer
25036f6e3b hidpp20: automatically add the sw ID to the hid requests
0x8 was a random SW number picked, add that consistently and automatically so
it doesn't look like the command names require this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:46:53 +10:00
Peter Hutterer
75f4badbbb hidpp20: Fix copy/paste-o hidpp20_mousepointer_get_mousepointer_info
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:28:39 +10:00
Peter Hutterer
5e19d4e536 Print feature names as we're initializing them
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:10:18 +10:00
Peter Hutterer
30698f8ee2 driver-unifying: Add the Logitech T650 touchpad
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:10:14 +10:00
Peter Hutterer
b1666a77fb driver-unifying: make a debug message a bit clearer
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Peter Hutterer
174ac03597 Use "device", not "ratbag", for struct ratbag_device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Peter Hutterer
f4358cbf3a Fix doxygen for libratbag-hidraw
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Peter Hutterer
35b5fa975e hidpp: Log the errno including strerror
Signed-off-by:Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Peter Hutterer
7f2d060ff9 Make libratbag-hidraw return negative errnos on error
Be consistent here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Peter Hutterer
7ddbadffbb Add the G500s to the unifying driver
Doesn't work yet, but should, eventually.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Benjamin Tissoires
f759cbdcef drivers: do not declare defines that are used only once
There is no gain at declaring the PID of the mice we support in
libratbag-private.h
Make it per driver, and remove the extra declarations.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 19:57:41 -04:00