Commit Graph

22 Commits

Author SHA1 Message Date
Benjamin Tissoires
08a568aed2 hidpp20: fix after button type revamp
the logical and physical bits were inverted:
- logical is the action of the button
- physical corresponds to the actual button on the mouse (so the 'type')
- there is a duplicate from driver-etekcity to match 2 actions, this should
  be factorized in a helper somewhere in a later commit

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 16:48:03 -04:00
Peter Hutterer
7db22756b7 Revamp button action handling
One giant commit, but I didn't know how to split this up easier. The problem
is a misunderstanding in what the button type is and the code that built on
that misunderstanding, requiring a lot of interdependent parts to be updated
at once.

The button _type_ is the physical description of the button.
The button _action type_ is what will happen when you hit the buttons.

The type is read-only, since we're not dealing with mr potato head here.
The action is adjustible and we now support buttons, keys and special
in-hardware actions (e.g. dpi changes). A few FIXMEs still in place, e.g. we
don't handle modifiers with keys.

For buttons we just take numerical button numbers. i.e. we can map a button to
button 4, which will result in BTN_SIDE, and eventually logical button 8 in X.
For keys we take KEY_FOO, since eventually we want this to come out as that
(could do this for button as well I guess). Modifiers are currently ignored.
For special actions we have a enum of actions we support.

The button type enum is thus reduced a lot, and everything needs to be
switched.

This breaks ratbag-command change-button, will be fixed later since it's
misdesigned as it is anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 16:46:01 +10:00
Peter Hutterer
5a6c687c96 Create buttons during profile init
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 14:51:59 +10:00
Peter Hutterer
442eb6391c Initialize the profiles during driver startup
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 14:51:30 +10:00
Benjamin Tissoires
270b089674 Add the M325 to the hidpp20 driver
Not that we can configure much, but 0x1b00 sends 5 buttons, which is
the reality, so trying to include it too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-25 11:37:12 -04: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
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
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
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
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