1
0
forked from drath/libratbag
Commit Graph

2411 Commits

Author SHA1 Message Date
Benjamin Tissoires
874fc3386f driver-unifying: remove the hidpp 1.0 commands and behavior
The M705 talks HID++ 1.0 but the actual button toggle is not persistent.
So there is no real need to support this in libratbag for now.

This will allow to properly address the other devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 13:13:27 -04:00
Benjamin Tissoires
1112a46d87 hidpp10: remove the hard dependency on struct hidpp10_device for hidpp10_toggle_individual_feature
Starting with kernel v3.19, the hidraw node associated to the input node
talks the the actual device, no matter which device index is given.

There is no need to really know which device has which index thus.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 13:08:39 -04:00
Benjamin Tissoires
06e17daff6 Revert "Add a hack to find the hidraw device for the logitech recievers"
This reverts commit 589f249c95.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 12:17:41 -04:00
Benjamin Tissoires
7818a0c08b Revert "hidraw: add a workaround for the logitech receivers"
This reverts commit 5ce5e8afec.

fixed due to f92674df1c "hidraw: make sure we're comparing products
of the same int type"

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 12:17:15 -04:00
Benjamin Tissoires
9df3cd4128 hidpp10: various __u8 __u16 hunt
replaced by uint8_t and uint16_t

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 12:14:17 -04:00
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
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