1
0
forked from drath/libratbag
Commit Graph

197 Commits

Author SHA1 Message Date
Peter Hutterer
e5ebebe4a4 driver-hidpp10: read resolution/refresh rate on demand
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 11:24:14 +10:00
Peter Hutterer
f944f2410a hidpp10: convert the optical sensor bits into a function sensor
And it looks like the first byte is the surface quality

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 11:21:32 +10:00
Peter Hutterer
ad899506a7 hidpp10: convert get_usb_refresh_rate to a proper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 11:21:32 +10:00
Peter Hutterer
24c23a3f13 hidpp10: convert get_hidpp_notifications to a proper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 11:21:32 +10:00
Peter Hutterer
aadfefe752 hidpp10: convert enable_specific_feature into proper functions
This also changes from the "toggle" to a plain "set". If a caller needs to
toggle a specific function, it can run get + set instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 11:21:32 +10:00
Peter Hutterer
18f4e13b59 hidpp10: add set_led_status
Only enabled for 4 leds and I'm not even sure they're the same on all
devices. Still, works on the G500s so that's a good enough start.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 11:21:32 +10:00
Peter Hutterer
0891510d32 hidpp10: convert get_led_status to a proper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 11:21:32 +10:00
Peter Hutterer
d1aec43c18 hidpp10: switch get current resolution to a proper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 11:21:32 +10:00
Peter Hutterer
40ea55729c hidpp10: split pairing information into a proper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 11:21:32 +10:00
Peter Hutterer
4f6d63ce05 Add a strncpy_safe() utility function
Does strncpy, but guarantees that the string is null-terminated.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 11:21:32 +10:00
Peter Hutterer
268fbbbf40 hidpp10: convert fw information fetching into a proper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 11:21:32 +10:00
Peter Hutterer
1923ff6035 driver-hidpp10: set the report rate
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 17:10:23 +10:00
Peter Hutterer
c022d542b1 driver-hidpp10: fill in the current DPI
Should be read on-the-fly here, but until hidpp10 is refactored, this will do.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 17:08:00 +10:00
Peter Hutterer
49e30e4020 driver-hidpp10: actually initialize the drvdata
Missing return statement caused everything to be freed again. And the device
we initialized was discarded too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 17:07:12 +10:00
Peter Hutterer
33455a3245 hidpp10: store the resolution/refresh rate in the hidpp device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 17:00:33 +10:00
Peter Hutterer
aa6ded5d03 hidpp10: fix device type table
looks like a copy/paste-o

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 16:22:07 +10:00
Peter Hutterer
f5e62bd80c hidpp10: use helper function to extract wpid/build information
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 16:21:11 +10:00
Peter Hutterer
50d97bb33e hidpp10: mark the message struct as __attribute__((packed))
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 16:13:55 +10:00
Peter Hutterer
8aefa83b81 hidpp10: remove outdated comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 16:13:16 +10:00
Peter Hutterer
1b696397c7 hidpp10: shuffle things around to tidy up a bit
Looks a bit more like the hidpp20 driver now, and easier to get a handle on
everything. Command-specific functions/defines are grouped together and sorted
by command index.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 15:22:08 +10:00
Peter Hutterer
61377554ef hidpp10: move the various defines into the c file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 15:04:30 +10:00
Peter Hutterer
872d522364 hidpp: move the shared defines into a generic header
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 15:03:29 +10:00
Peter Hutterer
bbec568055 hidpp10: use quotes for local includes, not lt/gt
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 15:01:31 +10:00
Peter Hutterer
a0d882d2e5 hidpp10: implement refresh rate
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 14:41:46 +10:00
Peter Hutterer
adf1b9a99d hidpp10: add Optical sensor settings command
From:
https://github.com/cvuchener/g500/blob/master/doc/report.md
but we don't know what the return value is...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 14:41:46 +10:00
Peter Hutterer
ed320bcdea hidpp10: add resolution and LED status
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 14:41:46 +10:00
Peter Hutterer
58585bfb19 hidpp10: switch the idx base to 1, not 0
Only two receiver-specific requests have a 0-based index, everything else
wants 1-indexed devices. This currently makes it impossible to address wired
devices with a device index of 0. Switch it around, so that we use a 1-based
index.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 14:41:46 +10:00
Peter Hutterer
f5df7f0ec9 hidpp10: split the commands into helper functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 14:41:46 +10:00
Peter Hutterer
038c50077c driver-hidpp10: force the index to 0x00 for wired devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:38:14 +10:00
Peter Hutterer
ecca960bd9 hidpp10: __u8 -> uint8_t
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:38:14 +10:00
Peter Hutterer
1b799d2d84 hidpp10: only run the pairing information commands if the first one succeeds
Still try to run the other commands though, they're not receiver-related and
may work on a device that's not on a unifying receiver.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:38:14 +10:00
Peter Hutterer
e5df589c84 hidpp10: fix up coding style a bit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:38:14 +10:00
Peter Hutterer
1563efd988 hidpp10: request individual features
Not doing anything with it, this is just playing around.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:38:08 +10:00
Peter Hutterer
4c7fb6f803 hidpp10: Add support for the HID++1.0 Notifications request
They're off by default, but I have to start testing somewhere...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:37:43 +10:00
Peter Hutterer
5179f56a80 Revert "driver-unifying: remove the hidpp 1.0 commands and behavior"
Now that we have a separate HID++ 1.0 driver, we can restore this. Except the
fake button mapping.

This reverts commit 874fc3386f.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:37:41 +10:00
Peter Hutterer
0d97c99306 driver-hidpp10: override the hidraw device for unifying receivers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 13:37:41 +10:00
Peter Hutterer
6ab11a0585 Don't check for the HID info when opening a hidraw node
This screws with the HID++1.0 unifying receivers. Let's punt the
responsibility for opening the right hidraw node to the caller and only error
out if we fail the ioctl.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 11:55:54 +10:00
Peter Hutterer
3782b37853 Drop the 'device' argument from libratbag_device_set_active_profile
The profile is bound to a device anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 11:55:35 +10:00
Peter Hutterer
cea9bc6290 Drop some unneeded parameters where we have a way to get it anyway
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 11:55:35 +10:00
Peter Hutterer
82338aadcd Use strneq instead of strncmp
Less error-prone

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 11:55:35 +10:00
Peter Hutterer
d73d9f6023 Rename ratbag_device structs to "device"
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-24 11:55:35 +10:00
Peter Hutterer
bbc4af6419 hidpp20: add support for 0x1b00 reprogrammable keys
As seen on the T650.

Reusing most of 0x1b04 here, except this one only gives us control id, task id
and flags.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-22 18:04:02 +10:00
Peter Hutterer
5e61dc4800 hidpp20: add control/task ID mappings from 0x1b00
Let's hope that the range is the same here and 0x1b04 doesn't redefine some of
them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-22 17:42:29 +10:00
Peter Hutterer
25580e1060 Drop device handle from the button, the profile has it
...and buttons must be part of a profile.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-22 16:15:21 +10:00
Benjamin Tissoires
cc7c85ffdf hidpp20: fix reading of button mapping
When the button is not redirected, we need to rely on the control_id,
not the task_id to get the logical action of the button.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 16:59:36 -04:00
Benjamin Tissoires
88154c2438 hidpp20drv: implement button remapping
Problem: when a button is diverted, it stops sending its original button,
which is good, but then reports only on the HID++ long report collection.

That is a little bit embarrassing.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 15:50:01 -04:00
Benjamin Tissoires
bc05440477 hidpp20: do not shout one more time the recieved data
well, there is no fine grain while outputing the raw events, so that
means that we have always shown the actual answer just before.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 15:24:33 -04:00
Benjamin Tissoires
7fb5c2f81d hidpp20: handle new errors reporting
Looks like HID++2.0 devices report errors with 0xff also.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 15:24:33 -04:00
Benjamin Tissoires
8b0221554e hidpp20: invert logical/physical in function 1b04
I misread the documentation. The task_id corresponds to what the button
has been physically designed to, and the control_id is the logical
remapping.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 15:24:33 -04:00
Benjamin Tissoires
0eb6bd3948 hidpp: fill the ratbag_button info
We still need to differentiate logical from physical in button types.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 15:23:14 -04:00