This is the physical description of the button, so there's a distinct
difference between the two, even when the logical action is the same.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Move the struct declarations together (and move ratbag_device to the ratbag
device page), have the defgroup tags at the top of the file.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
profile was already dereferenced earlier in the function and cannot
be null anyway from the current callers of the function.
Signed-off-by: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
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>
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>
In the end, we just ignore the sensitivity setting.
On the Etekcity, it looks like it is ignored by the mouse, or
maybe the Windows software just messes things up and should
not update the per-axis dpi when playing with sensitivity.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
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>
No functional changes, this is in preparation for the future to make
replacing bits a bit easier - hopefully we only have to change the macro and
not every element then.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The one mode may be disabled and not configurable, but it's still more
predictable to have one that none.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>
And the same for set_active_profile -> set_active. This API is more reliable,
the previous incarnation required the client to compare pointer values.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
When we read the profiles, we need to know the capabilities of the device.
If the device has not been enumerated, then we are screwed.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
given that we create all the buttons and profiles during probe(), there
is no need to re-probe for it every time we access it.
Right now, this works because only ratbag-command uses the library and
is a one shot program.
In the future, we should also read the events to detect changes in the
configuration if the user can use physical buttons to change the profile,
dpi or something else.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Still not hooked up in the library, but re-assigning back a different
hard-coded macro works.
This also re-introduce the dependency on libevdev for the lib.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
the current driver API is not good enough. We should be able to say
which DPI setting we want to change. Thus, the external API is not
correct either.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We need to store the profile in each ratbag_resolution or we will not be
able to get back to the driver.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
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>
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>
The mouse supports profiles and we can read them already, it's the mac
software that appears crippled here. And each profile has up to 5 dpi modes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
ratbag_profile_init_buttons() already loops over the given number of
buttons.
Remove the extra for loop and save some CPU (and possibly USB depending on
the driver) cycles.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
the logical and physical bits were inverted:
- logical is the action of the button
- physical corresponds to the actual button on the mouse (so the 'type')
- there is a duplicate from driver-etekcity to match 2 actions, this should
be factorized in a helper somewhere in a later commit
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
If action is NULL, that's a problem.
If etekcity_button_action_to_raw() returns 0, we should not try to write
0x00 in the profile. The proper command for "none" is 0x06. 0x00 is thus
an error.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>