This just exports the button index so far and makes sure we can write clients
that deal with button objects instead of making stuff up to test for buttons.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Returning the object path makes it harder for the client to identify which
object is the active one. A simple index into the devices array is easier to
handle.
Note: another approach was to have an IsActive property on the profile
directly. This would require updating all properties when the active profile
is changed, it's simpler to just have one index.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
sd_bus_encode_many() escaps elements starting with a digit so our 0 profile
has an object path of /.../_30. This is quite confusing during debugging.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>
Profiles are static children of devices. Expose them as 2nd-level objects
underneath their parent devices on the bus.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Make sure the device management (lookup and enumeration and registration)
is done from the parent, not the child. Hence, move it into ratbagd.c over
ratbagd-device.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Make sure our dbus callbacks to not contain any logic themselves. They
should be simple wrappers around our internal object handling.
This also makes use of the new sd-bus pat helpers, to-be-released with
systemd-v227 next week.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
This does not work, we cannot flag properties as UNPRIVILEGED. Drop it.
Lets figure out later what exactly we want as privilege level to
enumerate and query device properties.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Add two device properties:
- Id: Returns the string ID to identify the device
- Description: Returns the ratbag-device name
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>