Commit Graph

1475 Commits

Author SHA1 Message Date
Peter Hutterer
abe3244f6b ratbag_create_button doesn't need a device argument
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 14:51:31 +10:00
Peter Hutterer
442eb6391c Initialize the profiles during driver startup
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 14:51:30 +10:00
Peter Hutterer
73c2966d5c Don't create profiles when trying to read it from the client
Make the driver responsible for creating them on startup, then just return the
one we already have.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 14:48:15 +10:00
Peter Hutterer
6abf0733c4 Drop ratbag_button_get_identifier
This is something better handled by mapping the various button types into a
specific string on the client-side.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 14:48:15 +10:00
Peter Hutterer
d444e2e1e8 hidpp10: use log_debug for HID++ errors
HID++ 1.0  doesn't have an index of functions available, so we pretty much
have to bang every request against the device, full of hope and optimism.
Reality demands that some of them fail and we handle that, but we don't need
to worry the user by screaming errors.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:57:43 +10:00
Peter Hutterer
008ab6a9d7 driver-hidpp10: hardcode button types for the G500s
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:49:49 +10:00
Peter Hutterer
7f508bdb77 Add two more thumb button types
The G500s has 3 thumb buttons, 4 is realistic too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:46:41 +10:00
Peter Hutterer
66d4d33857 hidpp10: rename hidpp10_buttons to hidpp10_button
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:38:14 +10:00
Peter Hutterer
6bb25bc824 driver-hidpp10: implement has_capability
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:22:45 +10:00
Peter Hutterer
2801ec070b Drop libratbag_get_button_by_index
Use libratbag_profile_get_button_by_index instead

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:20:10 +10:00
Peter Hutterer
1eacc78397 Drop RATBAG_CAP_BUTTON_PROFILES, unnessary
The OS X tool for Logitech's gaming mouse did not allow button-profiles on the
G500s, but DPI modes could be configured. This is an issue with the software,
not the device itself since the device supports muliple profiles. So the
original assumption that there are devices that have profiles for DPIs but not
buttons is likely wrong, the devices we looked at so far all have profiles
with a set of DPI modes in it, one of which is currently active.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:19:00 +10:00
Peter Hutterer
93aaa3bba9 tools: add missing indentation for the button list
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:13:27 +10:00
Peter Hutterer
6d55dae48d driver-hidpp10: fill the number of buttons from the first profile
We don't know the HID++ 1.0 request to check for the number of buttons or
profiles, this is the next-best thing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 09:11:04 +10:00
Peter Hutterer
1d80ea4898 hidpp10: store the number of dpi_modes/buttons in the profile
Makes it easier to iterate through the profile without relying on global
variables.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 08:55:25 +10:00
Peter Hutterer
cab9169e6f hidpp10: actually return the profile when we're fetching it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 08:52:49 +10:00
Peter Hutterer
a147d4c545 driver-hidpp10: don't set the resolution when the request fails
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 08:13:56 +10:00
Peter Hutterer
a4356f21ba hidpp10: add more debugging information
To make it easier to find what failed in the wall of hexcodes

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