This patch adds nothing but some debug outputs and prepares the code
to support the recent gaming mice from Logitech.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The G502 uses the version 0 of the adjustable DPI feature. This version
does not echo the given parameters which raised a -EIO in libratbag.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
github is happy with the current README but doxygen is not.
Use the same formatting than the architecture.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The MX Master is using BLE to connect, and so the system sees it as a uhid
device. The current rule ignores it because uhid devices do not have the
ID_BUS set.
Fix that by detecting uhid devices and put the bus in the hwdb accordingly.
For completeness, also add usb through uhid so we can also replay devices
and test their drivers.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This test driver is already twisting a little bit the API, so twist it
a little bit more.
An other solution would be to just add a (void* data) parameter to .probe()
but there is no point in it because only test_driver would be used.
Create a new probe callback only used when using the test driver, so make
check is happy.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This adds udev rules/hwdb that sets RATBAG_DRIVER and RATBAG_SVG
properties to the event devices. We then use this property to select
the correct driver instead of checking the hardcoded list in the
drivers. Having this in a hwdb makes it easier for users to test
if drivers match their mouse with a system installed libratbag.
Each driver now has an "id" which is used to match the driver set
in RATBAG_DRIVER. A SVG can optionally be set as well.
All entries in the hwdb are currently without a name as that
information was not available in the hardcoded lists.
Note that this patch breaks the test-driver.
This reverts commit d5a20efd8b.
The API is horrible. Better having 2 additional functions to get
the usage and usage pageof the report.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
When using uhid devices, we might want to check for siblings too. This is
a corner case so that's why it might not work in 100% of the cases.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Add a match against the usage page and the usage.
If we are not interested in this new match, we can just use 0.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We might need to check against them too, so parse them and store them.
It is a little bit tricky when there is no report ID. In this case, assume
that the Collection(Application) is a match.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We will be interested in the type of reports, so prepare the storage
by using an external struct to store the reports.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
ratbag_open_hidraw is a special case of ratbag_find_hidraw() when
we do not check for the parent and we do not have a match.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
When using the same context, we do not want to open twice the same
hidraw node if two input node match it.
Store the sysname in the ratbag_device so we can check if it has been
opened previously.
Note that ratbag-command list still shows all input node as working
because we just close them as soon as we opened them.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
If we want to remove the duplicate nodes opened when using
ratbag_find_hidraw(), we need to somehow keep track of all opened
ratbag_device.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Some mice have a separate hid interface for configuring the advanced
features. It occurs that this is a common enough use case to be handled
directly by libratbag-hidraw instead of having a per-device quirk.
The idea is to allow opening the sibling hidraw devices during .probe()
and to give a matching callback. If the callback succeeds, then the
hidraw node will be used.
With this, one device might be opened several times, this has to be fixed
in a separate commit.
Fixes issue #19
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We want to be able to find sibling hidraw nodes. For that, we need to
open and test several different hidraw nodes. Makes the opening of a
specific hidraw node in its own function.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We were retrieving the hidraw information but did not use them.
Now the debug output "foo is device 'bar'" is only shown when there is
a match.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
libratbag.c does not need to initialize anything hidraw related, so
move out everything to libratbag-hidraw.c.
That means that calling ratbag_close_hidraw() is not a requirement
whithin the drivers to exit properly.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We are touching hidraw internals here, better having the function in
libratbag-hidraw.c.
No functional changes.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Lets use the new get_device_path() helper to allow calling show-device
without any argument. This follows what show-profile does already.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
New verb: show-profile
This simply prints a profile of a given device by querying ratbagd for
all information on the selected profile.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Add a new property to profiles that exposes resolutions on the bus. We
simply expose a dictionary entry for each resolution, hence, we can
easily extend it in the future. However, we avoid the full overhead of
real dbus objects, as there is no real need for it.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Add two new helpers to query ratbagd for the object-paths of a specific
object:
GetDeviceByName: Return device given a device name
GetProfileByIndex: Return a profile given a profile index
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
We should always provide valid data if requested via Get().
Unfortunately, DBus still does not include 'maybe' types, so we just
return something that is clearly invalid data.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Two new verbs for ratbagctl:
- list-devices: list all available devices
- show-device: show detailed information about a single device
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Expose a list of profiles, including a tag for the active profile, from
within each ratbagd device via DBus.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Never return information about non-existant profiles. Just skip NULL
profiles silently, when iterating.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Refrain from hierarchical paths and instead use object prefixes with
unique paths each. This avoids several nasty DBus-enforced behaviors
regarding deep hierarchies. Furthermore, it keeps the names shorter,
which is always a nice side-effect.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Provide two new profile accessors that return the path and index of a
profile. This also requires us to cache the dbus path in the profile
itself.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
New helper to return the name of a device. This will be required to build
hierarchical paths in the sub-classes, like profiles.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Instead of relying on the cricket ObjectManager interface, use our own
manager interface. This gets rid of ridiculous recursive behavior of the
ObjectManager interface and instead allows us to control the behavior.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
This is no longer needed. Use the device-iterator in ratbagd.c directly
and then drop ratbagd_device_list().
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Add helper to retrieve the device path from outside of ratbagd-device.c.
This will be needed for the non-object-manager based enumerators and
signals introduced to org.freedesktop.ratbag1.Manager.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>