Peter Hutterer
2894ece95a
tools: use dash, not underscore in commands
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-20 08:17:37 +10:00
Peter Hutterer
b1ae0682bd
tools: print an error if no supported devices are found
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-20 08:07:37 +10:00
Benjamin Tissoires
0a683e3cc6
tools: add a "list" command to easily know which event nodes are supported
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 17:13:30 -04:00
Benjamin Tissoires
75e7f0ced1
etekcity: remove debug message marked as info
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 17:13:00 -04:00
Benjamin Tissoires
85df22d360
tools: actually install ratbag-command
...
looks like this tool is going to be interesting after all.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 16:34:40 -04:00
Benjamin Tissoires
8f723d084d
Do not require libevdev to compile it
...
we don't use it for now, so drop the requirement.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 14:35:03 -04:00
Benjamin Tissoires
25faa1c174
tools: add a very specific command for etekcity devices
...
Etekcity mice have volume up/down mapped on the 2 buttons on the right
side of the mouse. They get easily pressed by the hand and can annoy the
user. This command switches on and off these buttons.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 14:30:56 -04:00
Benjamin Tissoires
e6a7259c40
tools: do not update the profile if we are currently on this one
...
there is no specific gain besides not writing to the flash of the device.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 14:29:17 -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
Benjamin Tissoires
0c8bcce63d
etekcity: actually write the profile to the device
...
implement both .write_profile() and .write_button()
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 14:11:30 -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
ace830eb91
tools: add switch_profile command
...
This allows to test ratbag_device_set_active_profile() and the
.write_profile() callback from the drivers.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 13:49:29 -04:00
Benjamin Tissoires
a357766dbb
tools: factor out the opening of the dev node
...
And fixes on a fly a missing unref to udev when udev_device_from_path()
fails.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 13:42:02 -04:00
Benjamin Tissoires
5bd973a1f1
tools: Dynamically create the usage help for the commands
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 13:40:49 -04:00
Benjamin Tissoires
c33e1b1a7e
etekcity: use an array of mapping for the buttons
...
This will allow to do a reverse mapping from the type to the raw value.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 12:02:25 -04:00
Benjamin Tissoires
74ad5dbff5
etekcity: profiles are 0-indexed
...
so the number of profiles is actually ETEKCITY_PROFILE_MAX + 1.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 11:35:43 -04:00
Benjamin Tissoires
52e477dd07
Make INFO as the default log level
...
Now that we are actually using a verbose option, it does not make sense
to output the debug messages by default.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 11:34:09 -04:00
Benjamin Tissoires
abc7ac1029
tools: fix 2 valgrind complains
...
When accessing the buttons of a profile, we should not unref it until
we are done (or there will be some illegal access to a free-ed pointer).
The last profile_unref should be called against the active_profile, not
the last profile.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 11:31:58 -04:00
Benjamin Tissoires
fe839b2a90
etekcity: fill in the button type/action
...
The macros are currently not supported.
2 buttons are not supported too: double left click and "fire" (autorepeat
on left clic).
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 10:53:32 -04:00
Benjamin Tissoires
70df100e49
Fix ratbag_button_get_type
...
we should return the actual type.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 10:52:16 -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
Benjamin Tissoires
ab959c7761
Add some documentation to the ratbag driver.
...
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com >
2015-08-19 10:27:01 -04:00
Peter Hutterer
aea8de91ff
Add test logs to gitignore
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 14:11:43 +10:00
Peter Hutterer
2c2ac08a3b
Improve a couple of log messages
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 14:10:51 +10:00
Peter Hutterer
e3a25ccd91
tools: implement ratbag-command info
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 14:03:07 +10: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
993bc54aff
Fix a comment
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 12:48:52 +10:00
Peter Hutterer
3327cbad7c
tools: rename "rb" to "device"
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 12:25:04 +10:00
Peter Hutterer
ec321bb43e
tools: handle --verbose
...
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 12:23:36 +10:00
Peter Hutterer
5d609de747
tools: use a custom error function
...
Wrap the fprintf calls into something consistent.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net >
2015-08-19 12:22:01 +10:00
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