Commit Graph

43 Commits

Author SHA1 Message Date
Thomas Hindoe Paaboel Andersen
790c5e90bd add RATBAG_LED_TYPE_SCROLL_WHEEL 2017-10-18 00:19:12 +02:00
Peter Hutterer
ec7bb2f63a Add list of report rates to the resolutions
Same blueprint as the list of DPI values

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +02:00
Benjamin Tissoires
17380baae9 tools: ratbag-command.py: lazy evaluation of the devices
We do not need to parse all the devices, but only the one given in the
command line. Make ratbagc.py handle this case properly.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 19:06:57 +02:00
Benjamin Tissoires
314c3e2f78 ratbag-command.py: allow valgrind to show something useful
sudo valgrind --suppressions=./tools/valgrind-ratbag-command.supp \
              --leak-check=full \
              python3 ./build/ratbag-command.py

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-10-16 19:06:57 +02:00
Peter Hutterer
b951d83a64 Add ratbagd_led_has_mode() and the required dbus additions
To be able to query which modes are available.

Exposed via ratbagctl as
./build/ratbagctl.devel led 0 capabilities event4

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-16 08:47:32 +10:00
Peter Hutterer
f592cabcd7 Replace the resolutions min/max with an explicit list of dpi values
Previously, we could get a min/max value but there was no guarantee that it
any value in between would actually work on the device. Some devices have a
discrete number of resolutions (e.g. 500, 1000, 2000, 2500), most others have
at least a minimum step size (so 1234 isn't a valid dpi value).

Change the min/max to a discrete list of which resolutions are supported. This
allows a UI to adjust its interface dynamically - e.g. a combobox if there are
only 3 resolutions or a slider if there are a million of them.

This is a DBus API break

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 17:46:05 +02:00
Peter Hutterer
186d626c40 Remove RATBAG_LED_TYPE_UNKNOWN from the enum list
A driver is supposed to know what type an LED is, unknown doesn't help anyone
here. So replace this with a private #define and abort when a driver doesn't
set the type. This also adds a requirement that any driver initializing a LED
must have the read_led() function, otherwise we can't fill it in correctly.

And bump the enum up by one, the first valid value should start at 1 (or some
other non-boolean value).

Related #365
Fixes #364

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-09 19:12:17 +02:00
Peter Hutterer
c401414310 tools: update ratbagd.py for the new logo types
Added in 835a694c4b

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-04 10:13:53 +10:00
Peter Hutterer
186a1deda8 led: change RGB to RGB888 and add 1-bit RGB
1-bit RGB is needed for the Logitech G300, let's rename the main RGB to
indicate how many bits we actually have.

See #335

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-03 08:58:34 +02:00
Jente Hidskes
6827f5ed81 tools/ratbagd.py: sync with Piper 2017-09-30 08:51:50 +10:00
Peter Hutterer
b1c4bba3b2 led: add support for color depth
The initial value of 400 in the enum is chosen so it looks weird when someone
tries to interpret the value as integer. Values of 1, 2, 4, etc. could be
confused with something realistic.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-22 09:18:28 +02:00
Jente Hidskes
33966989db ratbagd: add ACTION_SPECIAL_INVALID to the table
So we at least don't crash, see #383.
2017-09-14 16:02:56 +02:00
Jente Hidskes
77847f570c tools/ratbagd: remove KeyMapping methods
Cleanup after afaf3fa83d.
2017-09-07 10:24:38 +02:00
Peter Hutterer
afaf3fa83d ratbagd: Drop KeyMapping from the DBus interface
Plan is to remove the key mapping altogether and make it transparent from the
Macro mappings (in libratbag/the drivers). Meanwhile, remove the DBus API so
nothing can actually start using it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-07 08:25:59 +02:00
Jente Hidskes
d06cdcc53c tools/ratbagd.py: sync with Piper 2017-08-31 15:25:38 +02:00
Jente Hidskes
39762718b9 tools/ratbagd.py: sync with Piper 2017-08-31 14:34:03 +02:00
Benjamin Tissoires
c647d6df99 profiles: add name get/set capability
Some devices can have a custom name, so let's export that capability.

In ratbagd, libratbag/ratbag_profile_set_name() returns an error, we
put it under silence, the client has to check for the capabilities
before asking ratbagd to change the profile name.

Fixes: #266

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-08-31 10:22:51 +10:00
Benjamin Tissoires
97a927bb7d profiles: add a per profile capabilities field
Doesn't do much now without the next commit

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-08-31 10:22:51 +10:00
Jente Hidskes
6ddba76c93 RatbagdButton: make mapping properties writable
This brings RatbagdButton in line with the other Ratbagd* objects, and
more importantly solves https://github.com/libratbag/piper/issues/140.
2017-08-22 10:22:51 +10:00
Jente Hidskes
d8e132f550 tools/ratbagd.py: sync with Piper 2017-07-27 09:37:31 +02:00
Benjamin Tissoires
7c313a31fd tools: ratbagctl: fixes for specials
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>
2017-07-26 18:08:39 +02:00
Jente Hidskes
0a6b4b3778 ratbagd: change the led type to the enum 2017-07-26 18:07:19 +02:00
Jente Hidskes
b4f451285e ratbagd: change the special mapping to the enum 2017-07-26 18:07:19 +02:00
Jente Hidskes
5f0ebdead7 tools/ratbagd.py: sync with Piper 2017-07-26 10:16:55 +02:00
Benjamin Tissoires
de3bb0e579 implement resolution active set (#249)
Fixes #80

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-26 08:32:16 +02:00
Benjamin Tissoires
9dcd2c6c05 trivial flake8 fixes
whitespaces, missing RatbagdButton and more whitespaces

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 18:44:04 +02:00
Benjamin Tissoires
34196c9960 tools: ratbagd.py: add readwrite=False when we are using explicit setters
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>
2017-07-25 18:24:10 +02:00
Peter Hutterer
10903e2434 ratbagd: change the button type to the enum value
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 18:24:10 +02:00
Peter Hutterer
b7f53effa1 ratbagd: add macro support
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 18:24:03 +02:00
Peter Hutterer
96067f18ca ratbagd: change the key action types to enums
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 17:16:54 +02:00
Peter Hutterer
e95bb9601c tools: ratbagd: skip superfluous is None check
We'll throw an exception before this happens

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 12:17:15 +02:00
Benjamin Tissoires
c0c77100ad ratbagd: implement enable/disable profile
We also maps the commands to ratbag-command.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-25 11:06:59 +10:00
Peter Hutterer
c6bc6b2576 tools: ratbagd: don't silence UnknownProperty errors
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>
2017-07-24 11:36:09 +02:00
Peter Hutterer
f53bf7d4ad ratbagd: make the LED properties writable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
40bd189cc0 ratbagd: make the resolution properties writable
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>
2017-07-24 11:36:09 +02:00
Peter Hutterer
7097f1dea6 ratbagd: remove GetResolutionByIndex
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>
2017-07-24 11:36:09 +02:00
Peter Hutterer
70f3da98db ratbagd: add IsActive/IsDefault to Resolution
This replaces the calls in the profile.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 11:36:09 +02:00
Peter Hutterer
f281bd751e ratbagd: drop 'GetProfileByIndex'
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>
2017-07-24 11:36:09 +02:00
Peter Hutterer
04b54d26e2 ratbagd: add 'IsActive' property to the profile
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>
2017-07-24 11:36:09 +02:00
Peter Hutterer
0018431f31 ratbagd: remove DeviceNew/DeviceRemoved signals
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>
2017-07-24 11:36:09 +02:00
Peter Hutterer
a4dd9bcdf3 ratbagd: change the remote property value when writing a property
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>
2017-07-24 11:36:09 +02:00
Peter Hutterer
98fa9c168a tools: ratbagd: throw an error if the system bus is unavailable
When running in a container (CircleCI), dbus may not be available. Throw one
of our errors to be consistent with our behavior when the name owner isn't
available.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-24 10:32:41 +02:00
Benjamin Tissoires
fa1799eef3 tools: copy ratbagd.py from piper and integrate it in ratbagctl
We are using a custom python script to generate the final ratbagctl
so we can strip out the headers.

Now merging and testing ratbagd.py in piper will be easier than ever.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-19 08:39:29 +02:00