Peter Hutterer
f9a6b5ff3c
tools: print an error if the command is unknown
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 12:18:50 +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
e6788c4905
Rename some 'device' args to 'udev_device'
...
For better namespacing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 11:50:32 +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
c51b7a9653
tools: exit early if we fail to find a udev device
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 10:39:05 +10:00
Peter Hutterer
5e9e408ce0
tools: re-add support for opening /dev/input/event nodes
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 10:38:00 +10:00
Peter Hutterer
d64b9eeb22
tools: rename list_ratbags_usage() to just usage()
...
Looks like a command name before the current ratbag-command one, and since
this is a static method anyway just usage() will do.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 10:22:44 +10:00
Peter Hutterer
0b833aa195
tools: revamp the ratbag-command option handling
...
Put the code in place for a multi-command tool, first command is
ratbag-command info /path/to/device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 10:22:30 +10:00
Peter Hutterer
2c64eacd61
Drop an excess udev_device_unref
...
Since fcda14df61 the device is owned by the caller, so we mustn't touch the
device.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 10:07:37 +10:00
Peter Hutterer
45777d9a96
Fix a typo
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 09:23:34 +10:00
Peter Hutterer
04c0ff49cc
test: add basic context init tests
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 08:33:49 +10:00
Peter Hutterer
c7ac176c58
test: run symbol leak test as part of make check
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 08:33:49 +10:00
Peter Hutterer
f4f8955596
test: add missing valgrind suppressions file
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 08:33:49 +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
fd211ba552
Print the device name, not just "the device"
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 08:33:49 +10:00
Peter Hutterer
6ca2de81dd
tools: use getopt parsing for the ratbag-command
...
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
Peter Hutterer
5dad2e258d
tools: fix a typo
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-18 15:25:23 +10:00
Benjamin Tissoires
2baca1ae9e
Implement a correct button mapping in the profiles
...
Problem is the current implementation requires to actually get the profile
before accessing the buttons. But it may be the simplest and safest way.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-17 17:21:27 -04: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
7b8c360c94
Add a placeholder for the driver data in struct ratbag
...
So each driver can allocate/destroy memory
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-17 16:21:44 -04:00
Benjamin Tissoires
eea6b65458
add a remove callback for the drivers
...
useful to cleanup any allocated memory.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-17 16:19:56 -04:00
Peter Hutterer
b7438d2ed2
Couple of minor indentation/code style changes
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-17 17:19:13 +10:00
Peter Hutterer
6c6df9409f
Add test-suite.log to gitignore
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-17 17:00:23 +10:00
Peter Hutterer
8ad6cdc144
Use uint8_t and uint16_t instead of the kernels __u8/__u16
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-17 16:58:48 +10:00
Benjamin Tissoires
8cab7fd7a6
Implement the buttons, sort of
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-16 21:18:11 -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
33aecfc14f
etekcity: sleep after updating the profile
...
The mouse really does not liked to be polled too much for its features,
so we need to wait till it is ready again.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-15 12:14:22 -04:00
Benjamin Tissoires
c60e31c2d9
etekcity: remove some magical numbers
...
etekcity_set_config_profile() gets a changed from (> 5) to (> 4),
but this was a mistake in the first place.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-15 12:14:22 -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
f4c0d88a1b
etekcity: read current button mapping
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-15 12:13:55 -04:00
Benjamin Tissoires
edce2cee19
Add ratbag_hidraw_output_report to send an output report
...
Still not fully implemented (should be just a write, but I have nothing
to test right now).
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-15 12:13:50 -04:00
Benjamin Tissoires
99f7936cc4
Add ratbag_hidraw_raw_request to get/set feature reports
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-15 12:13:44 -04:00
Benjamin Tissoires
8d5088b9c6
Add ratbag-hidraw to deal with low level hidraw communication
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-14 23:12:25 -04:00
Benjamin Tissoires
c6cf35a5fc
Store the input_id in ratbag directly
...
This should be cleaned up eventually when we will be actually using
libevdev.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-14 22:16:17 -04:00
Benjamin Tissoires
f626958758
fix memory leak when no driver is present
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-14 22:05:31 -04:00
Benjamin Tissoires
32392ab630
Add a ref to libratbag in ratbag
...
Or the underlying driver can not access libratbag
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-14 21:32:30 -04:00
Benjamin Tissoires
3733fee438
Add mandatory .probe() callback in ratbag_driver
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-14 17:39:29 -04:00
Benjamin Tissoires
b98477a7ec
Retrieve through udev the hidraw node associated to the given input device
...
Most gaming mice use a specific HID protocol to configure the device.
Allow to retrieve the hidraw node associated to the mouse so we can talk
to it.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-14 17:39:23 -04:00
Benjamin Tissoires
be3ec7317d
Add tool ratbag-command to test the library
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-14 17:39: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
f5474cf9ec
Add first implementation of etekcity
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-14 17:39:14 -04:00
Benjamin Tissoires
ca4af6f359
Add driver mechanism so we can have several distinct backends
...
Inspired from the kernel mechanism.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-14 17:39:11 -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
b7564682f4
Borrow libinput-util.c to handle lists, array and bitfields
...
Some valuable helpers from libinput.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-14 17:39:06 -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