Commit Graph

208 Commits

Author SHA1 Message Date
Benjamin Tissoires
bfd6dc42a4 Add a MACRO button type
and relocate the raw value 0 of RATBAG_BUTTON_TYPE_NONE to be below 0x06.
The windows application sets 0x06 when disabling a button.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-25 13:19:30 -04:00
Benjamin Tissoires
57cb37fa62 hidpp20: found 2 physical descriptions from the m325
These 2 buttons are on each side of the wheel. They send back/forward by
default.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-25 11:38:21 -04:00
Benjamin Tissoires
270b089674 Add the M325 to the hidpp20 driver
Not that we can configure much, but 0x1b00 sends 5 buttons, which is
the reality, so trying to include it too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-25 11:37:12 -04:00
Peter Hutterer
98165fec0e hidpp10: add code to read the profile
Profiles are... interesting
https://github.com/cvuchener/g500/blob/master/doc/profile.md is pretty
detailed on the information, but there's some oddities.

The profile configured on my mouse is on page 5, not sure if that's the OS X
logitech tool though (which doesn't do profile configuration btw). Pages 3 and
3 are valid too, the rest looks to be garbage.

There's probably some magic string to detect a profile (cvuchener says maybe
FF 00 00 80), so more profiles may be lying around elsewhere in memory...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 16:58:00 +10:00
Peter Hutterer
e8b15ba7ee hidpp10: fix a comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 14:14:19 +10:00
Peter Hutterer
89728733bf hidpp: use a #define for the wired device index
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 14:13:17 +10:00
Peter Hutterer
4fca750977 hidpp10: make the device init API slightly more sane
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 14:13:17 +10:00
Peter Hutterer
a3368a4a93 hidpp10: fix typo, reporing -> reporting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 14:13:17 +10:00
Peter Hutterer
7d53adb3c3 hidpp10: revamp to only pass a hidpp10 device around
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 12:41:03 +10:00
Peter Hutterer
eba5a2b387 hidpp10: store the ratbag device ref in the struct
Saves us passing two args around everywhere.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 12:28:48 +10:00
Peter Hutterer
3f6e94dfc6 Move driver checks into ratbag_register_driver
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-25 12:10:40 +10:00
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