Commit Graph

50 Commits

Author SHA1 Message Date
Peter Hutterer
5d992faf1f Merge pull request #20 from cvuchener/small_fixes
hidpp10: add G5 2007
2015-09-18 00:19:13 +10:00
Clément Vuchener
249ad1e639 hidpp10: add G5 2007 2015-09-17 16:11:07 +02:00
NoXPhasma
c5ad1a0e42 hidpp10: add G9x 2015-09-17 03:48:18 +02:00
Clément Vuchener
cedab5cacc Added G500 id 2015-09-16 18:42:59 +02:00
Thomas Hindoe Paaboel Andersen
a85a40b713 hidpp10: add G9 2015-09-15 20:24:56 +02:00
Peter Hutterer
a3aacd3a99 Drop the _by_index suffix
This is the default, if we need a _by_name or so later we can add it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-16 00:55:12 +10:00
Thomas Hindoe Paaboel Andersen
0a8642a6b0 hidpp10: make the fallback profile active and default 2015-09-13 23:01:26 +02:00
Benjamin Tissoires
90fa2251fa drv-hidpp**: check if the device accepts the HID++ reports
Removes the broken pipe on invalid nodes

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-12 10:17:34 -04:00
Thomas Hindoe Paaboel Andersen
56effdfba9 Add G5 to the hidpp10 driver 2015-09-11 22:48:39 +02:00
Peter Hutterer
69bb5d2f48 Add a default profile capability
Not all devices allow setting a default profile, make it a capability

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-11 03:42:44 +10:00
Benjamin Tissoires
a8e592e1bc hidraw: add ratbag_close_hidraw
Better to clean up the hidraw node too.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
2015-09-07 16:12:00 -04:00
Peter Hutterer
6c3a8aa90e Abort if zalloc fails
Let's not pretend we will handle out-of-memory errors correctly, and really,
it's not something we really need to be worried about.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-03 12:52:50 +10:00
Benjamin Tissoires
1e1dfd02fd Add a ratbag_device_get_svg_name() function
To retrieve which SVG file is associated to which device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-02 11:02:03 -04:00
Benjamin Tissoires
4644614da5 hidppdrvs: remove terminating comma in LOGITECH_DEVICE() macro
Or it leads to interesting errors when adding fields to the table
of supported devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-02 10:48:49 -04:00
Peter Hutterer
6ec078d43b Add hooks for getting/setting the default profile
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-02 17:03:34 +10:00
Peter Hutterer
c01c37fcbf Implement ratbag_button_has_action_type
etekcity suppports macros already, the other two don't. hidpp10 doesn't
support any write stuff but let's claim we do anyway.

The driver hook for this isn't ideal, read_button is called during init but
we should set all this up during probe and then use read_button exclusively to
update the button, not set the capabilities as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-02 17:03:34 +10:00
Thomas Hindoe Paaboel Andersen
89559b3720 fix error path in hidpp10drv_probe
If we goto err early then both dev and drv_data will contain
garbage values. We free one and dereference the other. Let's
null them and add proper checks.

Signed-off-by: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
2015-09-01 22:34:34 +02:00
Benjamin Tissoires
f476f03762 make ratbag_resolution_init() return the struct resolution pointer
It is a common pattern to have:
ratbag_resolution_init(...)
profile->resolution.modes[i].xxx = yyy;
ratbag_resolution_set_cap(&profile->resolution.modes[i], zzz)

So instead of dealing with the internal fields of profile/resolution/modes,
just return the resolution that has been initialized.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-09-01 09:49:18 -04:00
Peter Hutterer
99a9752104 Add per-resolution capabilities
Currently only the hooks for x/y resolution, the rest is unimplemented. Also
the etekcity driver needs an update here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-01 17:30:47 +10:00
Peter Hutterer
9383097fd2 Namespace the ratbag capabilities to the ratbag device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-01 17:25:55 +10:00
Peter Hutterer
d620683e38 Add a helper function to init a resolution mode
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 12:21:49 +10:00
Peter Hutterer
ddfd408183 driver-hidpp10: return ENOTSUP for missing bits, not just -1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 12:06:17 +10:00
Peter Hutterer
aa27fbae8d Remove the get_active_profile driver hook
Long-term we should have probe() and read_profile(), the latter of which
should read each profile and fill in _all_ information.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 12:05:52 +10:00
Peter Hutterer
0d951724dc driver-hidpp10: hook up the active profile bits
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 11:16:48 +10:00
Peter Hutterer
d32abed1e9 driver-hidpp10: return the currently active profile
Data is bogus, but let's implement it anyway

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 10:22:02 +10:00
Peter Hutterer
e1836583a5 Add ratbag_resolution_set/get_default
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-28 09:49:03 +10:00
Peter Hutterer
7da10cc074 Add resolution modes
The devices we're dealing with all have multiple DPIs to configure. This API
will replace the current ratbag_profile_set_resolution_dpi() and friends.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 17:02:15 +10:00
Peter Hutterer
2fbf156403 hidpp10: use 0x00 to talk to all devices, skip receiver handling
The kernel overwrites the device ID with the correct one for our device, so we
can just use 0x00 for all devices and skip the search for the unifying
receiver hidraw device.

Since we're not talking to the receiver anymore, we can/have to drop the
pairing information queries and the related info. Since we weren't using this
anyway it's not a big loss.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 11:42:48 +10:00
Peter Hutterer
7db22756b7 Revamp button action handling
One giant commit, but I didn't know how to split this up easier. The problem
is a misunderstanding in what the button type is and the code that built on
that misunderstanding, requiring a lot of interdependent parts to be updated
at once.

The button _type_ is the physical description of the button.
The button _action type_ is what will happen when you hit the buttons.

The type is read-only, since we're not dealing with mr potato head here.
The action is adjustible and we now support buttons, keys and special
in-hardware actions (e.g. dpi changes). A few FIXMEs still in place, e.g. we
don't handle modifiers with keys.

For buttons we just take numerical button numbers. i.e. we can map a button to
button 4, which will result in BTN_SIDE, and eventually logical button 8 in X.
For keys we take KEY_FOO, since eventually we want this to come out as that
(could do this for button as well I guess). Modifiers are currently ignored.
For special actions we have a enum of actions we support.

The button type enum is thus reduced a lot, and everything needs to be
switched.

This breaks ratbag-command change-button, will be fixed later since it's
misdesigned as it is anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 16:46:01 +10:00
Peter Hutterer
5a6c687c96 Create buttons during profile init
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-26 14:51:59 +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
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
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
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
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
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
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
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
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
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
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
Benjamin Tissoires
14279b26cd hidpp*drv: update copyrights and header
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:39:11 -04:00
Benjamin Tissoires
5b8b2319e5 Add LOGITECH_DEVICE macro for declaring Logitech devices in drivers
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:34:19 -04:00
Benjamin Tissoires
7b984b86ef M705 is a HID++ 1.0 device
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-08-21 13:27:59 -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