1
0
forked from drath/libratbag
Commit Graph

280 Commits

Author SHA1 Message Date
Peter Hutterer
d620683e38 Add a helper function to init a resolution mode
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 12:21:49 +10:00
Peter Hutterer
ddfd408183 driver-hidpp10: return ENOTSUP for missing bits, not just -1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 12:06:17 +10:00
Peter Hutterer
aa27fbae8d Remove the get_active_profile driver hook
Long-term we should have probe() and read_profile(), the latter of which
should read each profile and fill in _all_ information.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 12:05:52 +10:00
Peter Hutterer
f5340d31e3 Remove the old resolution/report rate getters/setters
They already got removed from the library, only the declarations were left.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 11:57:58 +10:00
Peter Hutterer
57dffdcb26 Add documentation for the resolutions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 11:30:49 +10:00
Peter Hutterer
0d951724dc driver-hidpp10: hook up the active profile bits
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 11:16:48 +10:00
Peter Hutterer
49d70577c0 Replace get_active_profile with profile_is_active
And the same for set_active_profile -> set_active. This API is more reliable,
the previous incarnation required the client to compare pointer values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 11:04:58 +10:00
Peter Hutterer
7410939f88 Rename "ratbag" to "device" for ratbag_device structs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 10:29:25 +10:00
Peter Hutterer
d32abed1e9 driver-hidpp10: return the currently active profile
Data is bogus, but let's implement it anyway

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 10:22:02 +10:00
Peter Hutterer
eed48bd102 tools: resolutions with dpi 0 are disabled, print it as that
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 09:58:44 +10:00
Peter Hutterer
b427bd4a7b tools: print the right resolution index
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 09:57:09 +10:00
Peter Hutterer
e1836583a5 Add ratbag_resolution_set/get_default
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 09:49:03 +10:00
Peter Hutterer
19888ea492 Add to TODO
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 09:38:40 +10:00
Benjamin Tissoires
84b0195688 hidpp20: initialize the profiles when the device has been enumerated
When we read the profiles, we need to know the capabilities of the device.
If the device has not been enumerated, then we are screwed.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-27 18:11:38 -04:00
Benjamin Tissoires
28280240cb read only once from the mouse
given that we create all the buttons and profiles during probe(), there
is no need to re-probe for it every time we access it.
Right now, this works because only ratbag-command uses the library and
is a one shot program.

In the future, we should also read the events to detect changes in the
configuration if the user can use physical buttons to change the profile,
dpi or something else.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-27 18:10:44 -04:00
Benjamin Tissoires
88a2aea3c2 etekcity: retrieve and dump the macros
Still not hooked up in the library, but re-assigning back a different
hard-coded macro works.

This also re-introduce the dependency on libevdev for the lib.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-27 17:49:16 -04:00
Benjamin Tissoires
3da6fd0dd3 TODO: add light support
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-27 15:30:42 -04:00
Benjamin Tissoires
2309228dbe drivers: make .write_resolution_dpi() takes the resolution, not the profile
This allows to set whichever resolution we want within the profile.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-27 15:27:08 -04:00
Benjamin Tissoires
4251042a0d etekcity: implement switch-dpi functionality
the current driver API is not good enough. We should be able to say
which DPI setting we want to change. Thus, the external API is not
correct either.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-27 15:15:36 -04:00
Benjamin Tissoires
17a384de82 etekcity: retrieve the dpi settings in the mouse
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-27 15:14:19 -04:00
Benjamin Tissoires
07e231d705 etekcity: reduce the latency between each profile retrieval
Looks like 10 ms is enough to not have the mouse getting lost.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-27 14:54:18 -04:00
Benjamin Tissoires
07a0b0961b tools: profiles are 0-index based
It felt weird reading:
  Profile 2
    Resolutions:
      3: 1000dpi @ 500Hz (active)
      3: 1600dpi @ 500Hz
      3: 2400dpi @ 500Hz
      3: 3200dpi @ 500Hz
      3: 4000dpi @ 500Hz
      3: 8000dpi @ 500Hz

We could index the profiles to 1 too, but that would introduce slightly
more code change.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-27 14:31:58 -04:00
Benjamin Tissoires
2f69a70acc hidpp20: restore the dpi functionality
We need to store the profile in each ratbag_resolution or we will not be
able to get back to the driver.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-27 14:30:50 -04:00
Peter Hutterer
24e186f579 Add a TODO list
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 17:33:41 +10:00
Peter Hutterer
7da10cc074 Add resolution modes
The devices we're dealing with all have multiple DPIs to configure. This API
will replace the current ratbag_profile_set_resolution_dpi() and friends.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 17:02:15 +10:00
Peter Hutterer
6a2b4afa7b Sort libratbag.sym
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 16:51:21 +10:00
Peter Hutterer
cf834018c5 Split the doxygen up into device, profile, button
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 13:06:24 +10:00
Peter Hutterer
e5f5cdca17 Add an API to check if an action type can be configured for a device
This is just a placeholder for now, not yet implemented.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 13:00:58 +10:00
Peter Hutterer
be58d91c63 Fix compiler warnings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 12:27:48 +10:00
Peter Hutterer
ba3330894f Add the various set/get_user_data() functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 12:17:58 +10:00
Peter Hutterer
87e17ff951 Fix a doxygen reference
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 12:11:02 +10:00
Peter Hutterer
2fbf156403 hidpp10: use 0x00 to talk to all devices, skip receiver handling
The kernel overwrites the device ID with the correct one for our device, so we
can just use 0x00 for all devices and skip the search for the unifying
receiver hidraw device.

Since we're not talking to the receiver anymore, we can/have to drop the
pairing information queries and the related info. Since we weren't using this
anyway it's not a big loss.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 11:42:48 +10:00
Peter Hutterer
25aeaa68d6 Add a 1s timeout to libratbag_hidraw_read_input_report
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 11:16:06 +10:00
Peter Hutterer
3bf35ce282 Drop an incorrrect FIXME comment
The mouse supports profiles and we can read them already, it's the mac
software that appears crippled here. And each profile has up to 5 dpi modes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 08:06:23 +10:00
Benjamin Tissoires
d82ee06bfd Call only once per button per profile .read_button
ratbag_profile_init_buttons() already loops over the given number of
buttons.
Remove the extra for loop and save some CPU (and possibly USB depending on
the driver) cycles.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 16:59:39 -04:00
Benjamin Tissoires
6bc44f4d5f Factor out ratbag_button_action_match
This will be used often in drivers, so let's have a helper for it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 16:55:29 -04:00
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
Benjamin Tissoires
7ba2c7cee7 etekcity: check for return values before using them
If action is NULL, that's a problem.
If etekcity_button_action_to_raw() returns 0, we should not try to write
0x00 in the profile. The proper command for "none" is 0x06. 0x00 is thus
an error.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 13:13:11 -04:00
Benjamin Tissoires
14c29322fd tools: fix switch-etekcity command
The purpose is to disable the buttons, not having them reporting BTN_LEFT.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 13:13:11 -04:00
Benjamin Tissoires
1b5eb84ac4 Export a button_disable function
This sets a button to RATBAG_BUTTON_ACTION_TYPE_NONE when we want
to disable a button completely.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 13:13:11 -04:00
Benjamin Tissoires
cc5c539fdb etekcity: fix the retrieval of the raw code given the action
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 13:13:11 -04:00
Benjamin Tissoires
11d1a111a0 tools: dump the action mapped to the buttons
The buttons are given as plain numbers, not sure if we should
use BTN_LEFT, BTN_RIGHT, etc instead.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 13:12:27 -04:00
Benjamin Tissoires
52683a866c Fix copy/paste-o in ratbag_button_get_special
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 12:15:14 -04:00
Benjamin Tissoires
34d1550676 etekcity: register that 0x10 is a macro
Still not able to express this to user space

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 11:59:44 -04:00
Benjamin Tissoires
3ad0cacd0d Cleanup the profiles and buttons on exit
Now that the profiles and buttons have to be created once by the probe()
function, we need to clean them up when the device is unref-ed.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 11:54:56 -04:00
Benjamin Tissoires
d58ef45cfb etekcity: fill the type field of the buttons
This adds two button types: pinkie and pinkie2 when there are buttons
on the right side of the mouse.

OK, I could have called them left-handed-thumb.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 11:40:24 -04:00
Benjamin Tissoires
b11c1f30f3 etekcity: rename local variable index into raw_index
this index is the position of the button in the report, so it's misleading
to keep it as "index". The actual index is the button->index.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 11:32:43 -04:00
Benjamin Tissoires
701c1b7d36 etekcity: the mouse has ten buttons, not nine
the button index starts at 0, so we need to add 1 to the max button number.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 11:31:41 -04:00
Benjamin Tissoires
c28edd2411 Add the ratchet mode switch button type and action type
Found on the Logitech MX Master. Most of other Logitech device with
physical ratchet disable capability do not show this button to the host
however.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-26 11:01:25 -04:00
Peter Hutterer
b1fc95ee74 tools: fix/implement ratbag-command change-button
New command syntax is:
  ratbag-command change-button 1 button 2 /dev/input/event0
  ... sets button 1 to logical button 2
  ratbag-command change-button 1 key KEY_UP /dev/input/event0
  ... sets button 1 to KEY_UP
  ratbag-command change-button 1 special "wheel up" /dev/input/event0
  ... sets button 1 to send wheel up

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 17:13:58 +10:00