1
0
forked from drath/libratbag
Commit Graph

76 Commits

Author SHA1 Message Date
Benjamin Tissoires
c32c1471cb hidpp10: switch to libratbag debug system
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 12:13:45 -04:00
Benjamin Tissoires
f2bec4d8f7 add log buffer functionality
Useful to debug the incoming and outgoing data.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 11:40:11 -04:00
Benjamin Tissoires
793df27e90 Add the MX Master in the list of supported devices
There is not much available now, but the mouse should provide configurable
DPI and buttons, which is a perfect test for libratbag.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 10:50:31 -04:00
Benjamin Tissoires
29b72c1a94 hidpp10: use ratbag_hidraw* commands, not plain access to the fd
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 10:46:21 -04:00
Benjamin Tissoires
51f939d29f hidraw: Implement ratbag_hidraw_read_input_report and ratbag_hidraw_output_report
Logitech devices are using raw input/output reports, so we need this.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 10:45:40 -04:00
Benjamin Tissoires
01738398a5 Fix F23 compilation
add missing headers for fstat and struct stat

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-08-20 09:47:57 -04:00
Peter Hutterer
f92674df1c hidraw: make sure we're comparing products of the same int type
hidraw_devinfo.product is 16-bit signed, input_id.product is 16 bit unsigned.
Move the hidraw info over to a input_id, then compare.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 16:09:36 +10:00
Peter Hutterer
95c8baa043 Move the m705 driver to libratbag proper
Note that this doesn't do anything yet, it's stubbed out everywhere except for
the button mapping bit where we already had some testing code from uLogitech.

This also adds the ID for the m570 trackball - a device I have available here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 16:08:57 +10:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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