1
0
forked from drath/libratbag
Commit Graph

47 Commits

Author SHA1 Message Date
Benjamin Tissoires
1e1dfd02fd Add a ratbag_device_get_svg_name() function
To retrieve which SVG file is associated to which device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-02 11:02:03 -04:00
Peter Hutterer
6ec078d43b Add hooks for getting/setting the default profile
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-02 17:03:34 +10:00
Peter Hutterer
c01c37fcbf Implement ratbag_button_has_action_type
etekcity suppports macros already, the other two don't. hidpp10 doesn't
support any write stuff but let's claim we do anyway.

The driver hook for this isn't ideal, read_button is called during init but
we should set all this up during probe and then use read_button exclusively to
update the button, not set the capabilities as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-02 17:03:34 +10:00
Peter Hutterer
0d4a7486de Add some more documentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-02 09:05:53 +10:00
Peter Hutterer
2bc1ca0dce Remove a documentation FIXME, a wheel click is different to a middle click
This is the physical description of the button, so there's a distinct
difference between the two, even when the logical action is the same.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-02 09:05:53 +10:00
Peter Hutterer
0a6dd96185 Shuffle things around in the public header
Move the struct declarations together (and move ratbag_device to the ratbag
device page), have the defgroup tags at the top of the file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-02 09:05:53 +10:00
Peter Hutterer
99a9752104 Add per-resolution capabilities
Currently only the hooks for x/y resolution, the rest is unimplemented. Also
the etekcity driver needs an update here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-01 17:30:47 +10:00
Peter Hutterer
9383097fd2 Namespace the ratbag capabilities to the ratbag device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-01 17:25:55 +10:00
Peter Hutterer
63e0ddc550 Add a LOG_LEVEL_RAW log level
Lower than debug, for spitting out all the protocol codes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 15:08:51 +10:00
Peter Hutterer
499ba42b16 doc: more documentation comments
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 12:27:46 +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
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
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
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
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
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
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
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
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
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
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
ec9456c940 Make a note that button_get_type is the physical type
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 14:52:00 +10:00
Peter Hutterer
6abf0733c4 Drop ratbag_button_get_identifier
This is something better handled by mapping the various button types into a
specific string on the client-side.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 14:48:15 +10:00
Peter Hutterer
7f508bdb77 Add two more thumb button types
The G500s has 3 thumb buttons, 4 is realistic too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:46:41 +10:00
Peter Hutterer
2801ec070b Drop libratbag_get_button_by_index
Use libratbag_profile_get_button_by_index instead

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:20:10 +10:00
Peter Hutterer
1eacc78397 Drop RATBAG_CAP_BUTTON_PROFILES, unnessary
The OS X tool for Logitech's gaming mouse did not allow button-profiles on the
G500s, but DPI modes could be configured. This is an issue with the software,
not the device itself since the device supports muliple profiles. So the
original assumption that there are devices that have profiles for DPIs but not
buttons is likely wrong, the devices we looked at so far all have profiles
with a set of DPI modes in it, one of which is currently active.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:19:00 +10:00
Benjamin Tissoires
bfd6dc42a4 Add a MACRO button type
and relocate the raw value 0 of RATBAG_BUTTON_TYPE_NONE to be below 0x06.
The windows application sets 0x06 when disabling a button.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-25 13:19:30 -04: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
Benjamin Tissoires
d7cd776faf Add a ratbag_button_set_type
This might not be part of the final API, but it is rather convenient
to use right now.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-19 14:14:01 -04:00
Benjamin Tissoires
e3f9e0ffc0 Add a "none" button type for disabled buttons
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-19 14:10:32 -04:00
Benjamin Tissoires
f7ecf67cd3 Add a bunch of buttons used by the Etekcity mice
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-19 10:51:55 -04:00
Peter Hutterer
993bc54aff Fix a comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-19 12:48:52 +10:00
Peter Hutterer
44a675534e Rename "libratbag" to just "ratbag"
Naming scheme is now:
* ratbag - the context
* ratbag_device - the device
* ratbag_profile
* ratbag_button
...

Only leftovers of "libratbag" are the header file name, #defines that are
exported through that header file and anything that has to do with the actual
library iself (e.g. the symbol export file).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-19 12:15:20 +10:00
Peter Hutterer
b8be026032 Rename "struct ratbag" to "struct ratbag_device"
Less ambiguous naming this way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-19 12:15:20 +10:00
Peter Hutterer
388ded0067 Add the log handlers
And drop the duplicate log handler declarations.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-19 11:29:00 +10:00
Peter Hutterer
0259e69241 Add an open_restricted/close_restricted interface
Same as libinput. Since we need to open device files we need something that's
authorized to open them. So we punt that to the caller.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-19 08:33:49 +10:00
Peter Hutterer
fcda14df61 Drop from_fd, replace with from_udev_device
We don't need the evdev fd, it's more flexible to start with a udev device.
This changes ratbag-command to take a /sys path as well, but for not it'll
do.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-19 08:33:49 +10:00
Benjamin Tissoires
67fd06c6bf Add ratbag_get_name to retrieve the name of the device
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>

# Conflicts:
#	src/libratbag-private.h
#	src/libratbag.c
2015-08-14 17:39:16 -04:00
Benjamin Tissoires
0ed0e7a18d Add logging mechanism
Copied from libinput

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-14 17:38:59 -04:00
Benjamin Tissoires
5c206ff205 Add a context for libratbag
This is useful to have some udev helpers, or the list of drivers.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-14 17:38:35 -04:00
Peter Hutterer
4e232834b3 Add the outline of an actual API
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-13 16:22:26 +10:00
Peter Hutterer
87e18f3170 Add the generic API handles that any library needs these days
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-13 13:37:28 +10:00
Peter Hutterer
3fefe97451 Scaffolding for a libratbag, a mouse configuration library
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-13 11:55:07 +10:00