1
0
forked from drath/libratbag
Commit Graph

153 Commits

Author SHA1 Message Date
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
Benjamin Tissoires
a0f76f18f8 hidpp20: make the hidpp20_root_get_protocol_version compatible with bluetooth and corded
Lokks like the G500 needs a device_idx of 0x00, and the MX Master while on
Bluetooth only answers to report longs

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 19:56:38 -04:00
Benjamin Tissoires
eeccaa023c hidpp20: properly handle errors
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 17:19:46 -04:00
Benjamin Tissoires
81a77adf2d hidpp20: Implement feature 0x1b04: Special keys and mouse buttons
Still not writable.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 17:05:49 -04:00
Benjamin Tissoires
168473d6e3 hidpp20: export the defines for the page numbers
so the drivers could use them.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 15:38:00 -04:00
Benjamin Tissoires
0426f85163 hidpp20: use hidpp20_get_unaligned_u16
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 15:35:00 -04:00
Benjamin Tissoires
fdd47609cf hidpp20: implement 0x2201, adjustable dpi
only the getter right now.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 15:32:21 -04:00
Benjamin Tissoires
88a54e7acf hidpp20: add mouse pointer basic optical sensors
untested right now.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 14:38:31 -04:00
Benjamin Tissoires
9754810c38 unifying: retrieve the list of features available on HID++ 2.0 devices
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 14:12:56 -04:00
Benjamin Tissoires
b8637f0bc3 Add first hid++ 2.0 protocol support
The Logitech devices talk HID++, and we need a lib to handle that.
The first implemented command is the get protocol version which allows
to know if the device is using hid++ 1.0 or 2.0.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 14:12:08 -04:00
Benjamin Tissoires
874fc3386f driver-unifying: remove the hidpp 1.0 commands and behavior
The M705 talks HID++ 1.0 but the actual button toggle is not persistent.
So there is no real need to support this in libratbag for now.

This will allow to properly address the other devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 13:13:27 -04:00
Benjamin Tissoires
1112a46d87 hidpp10: remove the hard dependency on struct hidpp10_device for hidpp10_toggle_individual_feature
Starting with kernel v3.19, the hidraw node associated to the input node
talks the the actual device, no matter which device index is given.

There is no need to really know which device has which index thus.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 13:08:39 -04:00
Benjamin Tissoires
06e17daff6 Revert "Add a hack to find the hidraw device for the logitech recievers"
This reverts commit 589f249c95.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 12:17:41 -04:00
Benjamin Tissoires
7818a0c08b Revert "hidraw: add a workaround for the logitech receivers"
This reverts commit 5ce5e8afec.

fixed due to f92674df1c "hidraw: make sure we're comparing products
of the same int type"

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 12:17:15 -04:00
Benjamin Tissoires
9df3cd4128 hidpp10: various __u8 __u16 hunt
replaced by uint8_t and uint16_t

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 12:14:17 -04:00
Benjamin Tissoires
c32c1471cb hidpp10: switch to libratbag debug system
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 12:13:45 -04:00
Benjamin Tissoires
f2bec4d8f7 add log buffer functionality
Useful to debug the incoming and outgoing data.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 11:40:11 -04:00
Benjamin Tissoires
793df27e90 Add the MX Master in the list of supported devices
There is not much available now, but the mouse should provide configurable
DPI and buttons, which is a perfect test for libratbag.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 10:50:31 -04:00