1
0
forked from drath/libratbag
Commit Graph

55 Commits

Author SHA1 Message Date
Peter Hutterer
2fad2e3ccd resolution: mark the dpi/rate as changable
And make sure we actually save the new value too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-22 13:29:02 +10:00
Peter Hutterer
124385fc31 ratbagctl: print all properties
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
5fe39f94ab ratbagctl: fix show-profile to handle the resolution objects
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
e8d1645150 ratbagctl: Switch ActiveProfile parsing to an integer
Fallout from c04f1b57aa

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
d1ea517f9a ratbagctl: drop DefaultProfile parsing
Dropped in d049c13062

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
c6627d6266 device: if we can't fetch the description or svg, return an empty string
Less exception handling needed on the client side.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
2138ab05e5 Replace fprintfs with a new log_error helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
ce3038fd8e Use streq over strcmp
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
555d00c9a8 ratbagd: if --verbose is specified, set libratbag to verbose too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-19 15:32:33 +10:00
Peter Hutterer
12f013681a Add rudimentary for buttons
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>
2016-02-19 15:32:03 +10:00
Peter Hutterer
7a498310e2 resolution: remove unused variables
Copy/paste leftover from the profile.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 15:14:15 +10:00
Peter Hutterer
9af58224fa resolution: export capabilities as dbus properties
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 11:14:13 +10:00
Peter Hutterer
61abdb57a7 device: export all capabilities as dbus properties
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-18 11:12:00 +10:00
Peter Hutterer
262dd532e6 Add a log_verbose logging function for debug output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-17 10:33:20 +10:00
Peter Hutterer
80ed6d1399 resolution: switch to an index for ActiveResolution/DefaultResolution
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-16 17:00:27 +10:00
Peter Hutterer
c04f1b57aa device: switch active profile over to return an index only
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>
2016-02-16 17:00:27 +10:00
Peter Hutterer
7aca92f2b3 resolution: add support for setting resolutions and report rate
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-16 09:56:12 +10:00
Peter Hutterer
e199278d6f profile: switch DefaultResolution/ActiveResolution over to an object path
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:36 +10:00
Peter Hutterer
f2a55bca55 profile: add GetResolutionByIndex
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:35 +10:00
Peter Hutterer
bcd62aec6b resolutions: switch to using objects for resolutions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:23 +10:00
Peter Hutterer
c4e4330bd1 profile: prefix the profile object path with a 'p'
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>
2016-02-15 15:17:12 +10:00
Peter Hutterer
c70b53a162 profile: add support for setting the active profile
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:11 +10:00
Peter Hutterer
3262def07c device: add support for get-svg
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:11 +10:00
Peter Hutterer
d049c13062 device: drop default profile fetching, removed from libratbag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 15:17:01 +10:00
Peter Hutterer
5ffed21e0e Remove cleanup func define for sd_bus_message_unref
Added to systemd in 4afd3348c7506dd1d36305b7bcb9feb8952b9d6b
2016-02-11 17:16:58 +10:00
David Herrmann
958e86f67e ratbagctl: pick default device if none given for show-device
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>
2015-09-29 19:02:12 +02:00
David Herrmann
acb0118897 ratbagctl: split get_profile_path()
Split get_profile_path() and provide an helper for get_device_path() on
its own.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 19:00:27 +02:00
David Herrmann
85a045c538 ratbagctl: move get_profile_path()
Move get_profile_path() up to make it available to other verbs as well.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 18:57:42 +02:00
David Herrmann
fbffe241e6 ratbagctl: add show-profile verb
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>
2015-09-29 18:56:25 +02:00
David Herrmann
765fd1565a ratbagd: expose resolutions on the bus
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>
2015-09-29 18:55:03 +02:00
David Herrmann
1a677c0b1d ratbagd: add DBus methods to retrieve object paths
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>
2015-09-29 18:53:54 +02:00
David Herrmann
eeb8788413 ratbagctl: print the default profile
Include the default profile in 'show-device' output.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:35:00 +02:00
David Herrmann
c24ca68d63 ratbagd: expose 'DefaultProfile'
Add a new property that exposes the default profile.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:34:32 +02:00
David Herrmann
e189dc3b1f ratbagd: never return ENODATA for Get()
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>
2015-09-29 16:33:30 +02:00
David Herrmann
ff8f391e91 ratbagctl: implement list-devices and show-device
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>
2015-09-29 16:23:51 +02:00
David Herrmann
0a9c2824ba ratbagd: expose profile information
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>
2015-09-29 16:23:51 +02:00
David Herrmann
dc37d3bf62 ratbagd: ignore NULL profiles
Never return information about non-existant profiles. Just skip NULL
profiles silently, when iterating.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 16:23:51 +02:00
David Herrmann
2780e6f3d7 ratbagd: simplify profile DBus paths
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>
2015-09-29 16:23:51 +02:00
David Herrmann
260df58856 ratbagd: profile profile accessors
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>
2015-09-29 16:23:51 +02:00
David Herrmann
cba28a97a0 ratbagd: add ratbagd_device_get_name()
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>
2015-09-29 16:23:51 +02:00
David Herrmann
eca2203603 ratbagd: add manager interface
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>
2015-09-29 14:09:23 +02:00
David Herrmann
e926212554 ratbagd: remove ratbagd_device_list()
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>
2015-09-29 13:25:05 +02:00
David Herrmann
65463b6efb ratbagd: add device iterator
Add iterators for ratbagd_device objects.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 13:22:13 +02:00
David Herrmann
9ac799bc95 ratbagd: add ratbagd_device_get_path()
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>
2015-09-29 13:21:27 +02:00
David Herrmann
7e4d757bdf ratbagd: cache device path
Cache device path in device->path and avoid re-calculating it all the
time.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
2015-09-29 13:09:45 +02:00
David Herrmann
1a8037cd6c ratbagd: expose profiles on the bus
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>
2015-09-26 18:53:55 +02:00
David Herrmann
dbc8a37b56 ratbagd: move dbus device management
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>
2015-09-26 18:07:18 +02:00
David Herrmann
b1851ada93 ratbagd: split dbus handling from object handling
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>
2015-09-26 18:02:00 +02:00
David Herrmann
c0799b0c1d ratbagd: drop UNPRIVILEGED from properties
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>
2015-09-26 17:59:58 +02:00
David Herrmann
e461710811 ratbagd: add basic device properties
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>
2015-09-25 16:27:45 +02:00