1
0
forked from drath/libratbag
Commit Graph

598 Commits

Author SHA1 Message Date
Peter Hutterer
5ce5e8afec hidraw: add a workaround for the logitech receivers
The vid/pid combo for the hidraw device is that of the receiver, not that of
the device (which we get from the event node).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
2268bad104 hidraw: Definitely return EINVAL when the device ids don't match
Don't return an undefined errno.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
589f249c95 Add a hack to find the hidraw device for the logitech recievers
Their device is two parents up from the event node.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
2cbba23010 Skip over devices that don't have a hid-subsystem parent
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
9e37ce059b Rename etekcity.c to driver-etekcity.c
Better namespacing for drivers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
279bceb2d7 Drop unifying src files, use hidpp10 instead
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
e9230aef5f Fix an unsigned vs signed compiler warning
In file included from hidpp10.c:43:0:
hidpp10.c: In function 'hidpp10_get_device_info':
./libratbag-util.h:76:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define min(a, b) (((a) < (b)) ? (a) : (b))
                         ^
hidpp10.c:251:12: note: in expansion of macro 'min'
  dev->name[min(name_size, sizeof(dev->name) - 1)] = '\0';

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
724d59ba57 Fix a compiler warning
hidpp10.c:71:11: warning: initialized field overwritten [-Woverride-init]
  [0x06] = "ERR_ALREADY_EXISTS",

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
4f77454bcc Add missing include to libratbag-util.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
f36f4d22a7 Start moving uLogitech files into libratbag proper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
93ca4e24d4 Relicense the uLogitech bits to MIT
With permission from Benjamin Tissoires and Olivier Gay

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
29a6886362 Merge the uLogitech project
We'll use this to access Logitech unifying devices

Permission from Benjamin Tissoires and Olivier Gay to relicense this under the
MIT license.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
9f518bed0c Drop device/profile arguments from driver read_button/write_button
The button struct contains references to both.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
Peter Hutterer
e8d13057f9 Fix driver struct documentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 14:59:46 +10:00
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