1
0
forked from drath/libratbag
Commit Graph

34 Commits

Author SHA1 Message Date
Peter Hutterer
a3aacd3a99 Drop the _by_index suffix
This is the default, if we need a _by_name or so later we can add it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-16 00:55:12 +10:00
Benjamin Tissoires
6910eabacc Add an additional macro API to commit the macro
Not very glorious

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-09 11:26:15 -04:00
Benjamin Tissoires
cdf710d807 add support for getting/setting the macro name
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-09 11:26:15 -04:00
Benjamin Tissoires
ce10bb1e84 macro: add first implementation
The doctext needs fixes and the API might not be final.
This however works and allow to read the macro.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-09 11:26:15 -04:00
Peter Hutterer
28a94d0974 Add a test suite
Two components are added here: a test driver that takes a struct
ratbag_test_device and sets that device up as a ratbag device.
That device is returned to the tests and then checked for sanity.

The ratbag_device_new_test_device() requires the environment variable
RATBAG_TEST set, otherwise we abort. It's also 'hidden' in a separate source
file, so it won't show up in doxygen. And if the test are disabled, this
function does nothing and the test driver never gets registered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-03 16:28:43 -04:00
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
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
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
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
6a2b4afa7b Sort libratbag.sym
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 16:51:21 +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
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
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
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
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
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
Peter Hutterer
34dcd2aec1 Add some more function stubs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-19 13:59:36 +10:00
Peter Hutterer
d48fecf550 Add ratbag_device_ref
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-19 12:15:20 +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
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
bc9a992d51 Add missing symbols
Those were forgotten when the buttons were introduced

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-17 17:19:46 -04:00
Benjamin Tissoires
7b17fbd1cc add implemention of ratbag_set_active_profile
It's a 2 callback combo in the driver.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-15 12:16:40 -04:00
Benjamin Tissoires
b7ed03d688 add implementation of ratbag_has_capability
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-15 12:16:40 -04:00
Benjamin Tissoires
e49ef039d7 add implementation of ratbag_get_num_profiles and ratbag_get_num_buttons
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-15 12:16:35 -04:00
Benjamin Tissoires
30718c2495 Add profile implementation
Still not populated with buttons, but it's a good start.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-15 12:14:22 -04: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
3188b97f9c Add implementation of ratbag_new_from_fd and ratbag_unref
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-14 17:39:09 -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
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