No need to have two copies here, simply have the dict and then flip it so it
works with the strings as keys too.
The slightly odd list comprehension is because we can't add to a dictionary
while iterating through it, so we need to get everything out first.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
few minor issues which were unseen because driver-test was missing to set
the special key mappings
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Assigning an action on a button has some side effects, and this is why we
do not have writable properties on those.
Mark the _set_dbus_property() as read only so we do not get a bunch of
PropertyReadOnly exceptions.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
libratbag is now a static library only and the only exposed interface is the
DBus interface. We have ratbagctl for that interface.
ratbag-command shouldn't be installed, it becomes a pure developer tool now.
We still keep it around for that reason, but let's not install it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Now that ratbagd is part of libratbag, the DBus interface is the preferred way
to interact with a device. Shipping libratbag as a .so file means we have to
worry about two ABIs when it's unlikely that anyone ever uses the libratbag.so
directly.
Make it a static library internally instead.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
ratbag-command uses parentheses, not chevrons, and it also reports
which profile is currently active.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We need to read the directory and the profiles only once.
Nothing tells us how many profiles are supported, so use the specifications
from Logitech website, and add a hwdb entry for those.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Bunch of errors while processing the dictionary of enabled profiles.
Got everything working out quite well on the G900 and G403, so I guess
others should behave properly.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
The usage help is wrong, it's not how it works.
It'll be too much pain to fix it the other way around, and I prefer
using "ratbag* profile N enable" than "ratbag* profile enable N".
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Now that we've moved all properties to read-write where required, unleash the
exception again - any UnknownProperty error is now a bug.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This also drops the separate x/y properties and instead just returns a tuple
for "Resolution".
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This is superfluous, it's trivial enough to get the Resolutions property and then
work with that. We're not talking about a huge amount of data anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This is superfluous, it's trivial enough to get the Profiles property and then
work with that. We're not talking about a huge amount of data anyway.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Instead of a GetActiveProfile in the device, make this a property of the
profile. The SetActive method stays around, it's less prone to mis-use than
the property since we cannot allow a caller to go "profile.is_active = False"
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Our device list is so small that having separate signals is a bit pointless,
updating the property should be sufficient.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We have DeviceAdded and DeviceRemoved signals but given the expected number
of devices (less than 2 in most cases) it's easier to just update the Devices
property. The DeviceAdded/Removed signals stick around for now, they will be
removed later.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
set_cached_property merely updates the proxy's own copy, it doesn't do
anything to the remote. Manually call the DBus.Properties.Set interface
to do that.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>