Commit Graph

109 Commits

Author SHA1 Message Date
Benjamin Tissoires
64cfad665d Implement reading the resolution of the sensor
Should work with adjustable DPI and fixed DPI for Logitech devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:26:43 -04:00
Benjamin Tissoires
1ad8b49be0 hidpp20: avoid writing of uninitialized value
The function does not take any argument, so the device ignores it,
but valgrind complains.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:26:43 -04:00
Benjamin Tissoires
6bac6b9eb3 driver-hidpp20: fix formatting and renaming
And remove the spurious comments that have been introduced in
f759cbdcef ("drivers: do not declare defines that are used only once").

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:26:43 -04:00
Peter Hutterer
529a69e120 Split HID++ 1.0 into a separate driver
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 15:11:57 +10:00
Peter Hutterer
472b394858 hidpp20: Implement support for battery level
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 15:11:57 +10:00
Peter Hutterer
b15923d620 Rename the unifying driver to hidpp20
This driver is really a driver for HID++ 2.0 devices, not just for devices on
the unifying receiver.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 11:11:47 +10:00
Peter Hutterer
03c39c1120 driver-unifying: reword a log message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 11:02:49 +10:00
Peter Hutterer
d361bcb09f hidpp22: add a helper to not log some HID++ errors
The 2.0 GetProtocolVersion request will fail on 1.0 devices but there is no
equivalent for 1.0. The doc even suggests to detect this error to determine
whether a device is a 1.0 device. Thus, make it conditional on whether we
print the error or not (log it as debug message if turned off).

This should be reconsidered when we have everything in place and can think
about refacturing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 11:01:17 +10:00
Peter Hutterer
25036f6e3b hidpp20: automatically add the sw ID to the hid requests
0x8 was a random SW number picked, add that consistently and automatically so
it doesn't look like the command names require this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:46:53 +10:00
Peter Hutterer
75f4badbbb hidpp20: Fix copy/paste-o hidpp20_mousepointer_get_mousepointer_info
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:28:39 +10:00
Peter Hutterer
5e19d4e536 Print feature names as we're initializing them
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:10:18 +10:00
Peter Hutterer
30698f8ee2 driver-unifying: Add the Logitech T650 touchpad
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:10:14 +10:00
Peter Hutterer
b1666a77fb driver-unifying: make a debug message a bit clearer
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Peter Hutterer
174ac03597 Use "device", not "ratbag", for struct ratbag_device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Peter Hutterer
f4358cbf3a Fix doxygen for libratbag-hidraw
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Peter Hutterer
35b5fa975e hidpp: Log the errno including strerror
Signed-off-by:Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Peter Hutterer
7f2d060ff9 Make libratbag-hidraw return negative errnos on error
Be consistent here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Peter Hutterer
7ddbadffbb Add the G500s to the unifying driver
Doesn't work yet, but should, eventually.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-21 10:01:52 +10:00
Benjamin Tissoires
f759cbdcef drivers: do not declare defines that are used only once
There is no gain at declaring the PID of the mice we support in
libratbag-private.h
Make it per driver, and remove the extra declarations.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 19:57:41 -04:00
Benjamin Tissoires
a0f76f18f8 hidpp20: make the hidpp20_root_get_protocol_version compatible with bluetooth and corded
Lokks like the G500 needs a device_idx of 0x00, and the MX Master while on
Bluetooth only answers to report longs

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 19:56:38 -04:00
Benjamin Tissoires
eeccaa023c hidpp20: properly handle errors
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 17:19:46 -04:00
Benjamin Tissoires
81a77adf2d hidpp20: Implement feature 0x1b04: Special keys and mouse buttons
Still not writable.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 17:05:49 -04:00
Benjamin Tissoires
168473d6e3 hidpp20: export the defines for the page numbers
so the drivers could use them.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 15:38:00 -04:00
Benjamin Tissoires
0426f85163 hidpp20: use hidpp20_get_unaligned_u16
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 15:35:00 -04:00
Benjamin Tissoires
fdd47609cf hidpp20: implement 0x2201, adjustable dpi
only the getter right now.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 15:32:21 -04:00
Benjamin Tissoires
88a54e7acf hidpp20: add mouse pointer basic optical sensors
untested right now.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 14:38:31 -04:00
Benjamin Tissoires
9754810c38 unifying: retrieve the list of features available on HID++ 2.0 devices
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-20 14:12:56 -04:00
Benjamin Tissoires
b8637f0bc3 Add first hid++ 2.0 protocol support
The Logitech devices talk HID++, and we need a lib to handle that.
The first implemented command is the get protocol version which allows
to know if the device is using hid++ 1.0 or 2.0.

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