1
0
forked from drath/libratbag
Commit Graph

40 Commits

Author SHA1 Message Date
Peter Hutterer
b4009669b9 ratbagd: Add an APIVersion property to make version checks easier
While the DBus API is still in flux, things can break at any time.

Keeping piper and libratbag in version-step works terribly, doubly so where
piper is flatpaked but ratbagd comes from some repo somewhere. We can't check
at build-time, we can't run ratbagd --version at runtime.

so let's add a version field for now and drop it if we ever get to stable.
Meanwhile, ratbagd.py will throw an exception if the expected version doesn't
match exactly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-31 09:08:06 +10:00
FFY00
bbeaef749e meson: add 'sphinx-build' to sphinx executable name list 2019-05-24 07:16:19 +10:00
Peter Hutterer
11db35edba Fix flake8 warnings (#678)
The only notable one here is the regex that had an escape sequence

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-12 06:49:54 +01:00
Peter Hutterer
396b8bee87 doc: tab -> whitespace in the dbus docs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-28 09:56:59 +10:00
Peter Hutterer
c8c1c63531 doc: drop the libratbag-enums.h from the documentation
The various enums are now documented separately for the DBus API

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-28 09:56:59 +10:00
Peter Hutterer
704710814e doc: specify the values for the button actions
Don't rely on the libratbag enums here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-28 09:56:59 +10:00
Peter Hutterer
d17868303e Make the button mapping DBus API a single entry point
Instead of multiple entry points for different values, make the button mapping
a single entry point that takes the mapping type and a variant for the value.

The ratbagd.py bindings are basically left as-is.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-27 12:07:25 +10:00
Peter Hutterer
30c482aab2 Drop the Resolution.Capabilities field
No longer needed now that the ReportRate is in the profile
(bf127d4c68) and the separate
x/y resolution capability is implied by the Resolution value
(8e9dd6f392)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-27 11:44:05 +10:00
Peter Hutterer
bf127d4c68 Move the ReportRate into the profile
We don't have mice that can do report rates per resolutions, so let's not
commit to that.

This is a DBus API break but also a break in ratbagd, piper will need to
update to fetch the rate/rates from the profile object now.

It's a ratbagctl break as well, ratbagctl info changes slightly and the
resolution is not argument anymore for the rate.

Fixes #645

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-27 11:31:59 +10:00
Peter Hutterer
9f9f6294c3 doc: document the LED colors a bit better
And bump the enum down to 0 so we have normal values in the DBus API

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-27 10:58:42 +10:00
Peter Hutterer
3bba3d9bcb doc: styling fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-27 10:58:42 +10:00
Peter Hutterer
8e9dd6f392 ratbagd: change the Resolution property to a variant
Instead of a fixed (uu) with an extra capability flag, let's just make this a
variant defined to be a u or a (uu), depending on whether we have a single or
a separate resolution.

In the ratbagd.py bindings we return a tuple for both, but a simple len()
check will tell us which one it is.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-26 09:19:50 +01:00
Peter Hutterer
8c32036e03 doc: remove the LED Type property
dropped in 367aa29dfe

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-26 08:51:32 +10:00
Peter Hutterer
ba10000feb doc: drop the device capabilities
These were removed in 5328c20a58

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-26 08:51:32 +10:00
Peter Hutterer
f07007b6e6 doc: typo and styling fixes for the dbus API docs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-26 08:51:32 +10:00
Peter Hutterer
391a0e923e Drop the Device.Id from the DBus interface
The Device is an object on DBus, there is no need for another opaque ID, we
can just emulate this in the client. In our case by using the object
path and generating a sha1 from it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-25 10:48:50 +01:00
Peter Hutterer
734977f176 Drop the SVG handling from libratbag
The SVGs must not be part of any stable API, there is too much behavior
implied that we cannot/do not specify. So it's perfectly likely that a future
change in the SVGs or rendering libraries breaks things in some detail. But
then we cannot update the SVGs without risking breaking other clients that
rely on the current behavior.

Besides: we only have one theme, called "gnome" because a push
towards having SVGs for other themes never happened.

And that theme isn't gnome-specific, it merely looks GNOMEy. The theme is very
much piper-specific in that it requires certain elements that piper cares
about. Currently anyway, if we make this part of our API, piper cannot change
that behavior ever without breaking others.

So let's drop SVG handling completely and rely on the clients to sort it out
for themselves.

For now the SVGs are left in the tree to make it easier to copy to Piper. Once
that's done, we will remove those too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 11:17:09 +01:00
Peter Hutterer
10a1cc9bbc ratbagd: export the Model property for the device
When the SVGs need to be maintained elsewhere, we need something reliable to
match devices with SVGs. The easiest is to provide a unique model string,
usually composed from the usb/bluetooth information.

A string format was chosen to make it more flexible for the glorious future
where we have something other than usb or bluetooth devices. Meanwhile, the
format is the well-known "usb:1234:56ef:0" string (bus, vid, pid, version).

The version in this string is a future-proof safeguard for libratbag. It will
be used where libratbag supports two devices with the same VID/PID and where
this is not otherwise differentiable. We don't have any such devices yet, so
libratbag just returns a hardcoded 0.

The format is currently defined for usb and bluetooth, in the future we may
have other strings.

The base guarantee is that this is a reliable identifier for the model that
will never change for that model. IOW this is what piper can use to map
devices to their SVGs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 11:17:09 +01:00
Peter Hutterer
79711dfdad Drop the Button.Type property
The button type was the physical button type, not the logically assigned
button number.

This property is basically unused and of questionable use anyway. GUI
applications would need to rely on drawings of the mouse anyway. Scripts don't
really care because ratbagctl uses the button index anyway. The only time this
matters is when we're looking at (human) device discovery. But often clicking
around is enough to figure out the index.

So let's drop this API on the assumption that it's not really needed and
maintaining and extending that enum forever is not necessary.

This is not a full purge, merely the DBus API that gets dropped.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 10:09:17 +01:00
Peter Hutterer
32a5ad377e Drop the writable-name capability
Make this implict - if the profile has a name, it's writable. Otherwise it's
not and you'll have to rely on the index or make up your own naming.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-22 16:21:00 +10:00
Benjamin Tissoires
8a3eb946fe Add the logo in the DBus documentation
so we can reuse it in the README with animations :)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-02-21 21:47:28 +10:00
Peter Hutterer
7778da715e doc: some more updates/cleanups
Noteworthy: "Description" has been renamed to "Name" ages ago in ratbagd, this
just corrects the documentation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 13:23:42 +10:00
Peter Hutterer
107a649e08 ratbag: drop Device.Svg and Device.GetSvg()
This isn't used by anything in the tree and Piper doesn't use it either.
(`ratbagctl` queries it from the sodipodi name in the SVG).

Plus, assuming we run sandboxed the filename is useless anyway, `GetSvgFd()`
takes care of this bit though.

So let's drop this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 12:36:39 +10:00
Peter Hutterer
13656b60f7 doc: ref the LED enums correctly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-18 14:26:23 +10:00
Peter Hutterer
c2f93dc672 doc: reformat the DBus API docs a bit better
Use the default Python class, it's not perfect but still makes more sense than
the javascript class.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-18 14:21:39 +10:00
Peter Hutterer
468e6108ca doc: some documentation improvements
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-18 11:35:11 +10:00
Peter Hutterer
6000688c30 ratbagd: add GetSvgFd() to return an fd to the SVG
If we're sandboxing the client we don't have access to the SVG files directly.
So pass a read-only file descriptor to the client over DBus and let them deal
with the SVG that way.

In ratbagd.py we pull the fd off but we convert the quirky dbus error into a
normal FileNotFoundError(), much easier to catch in the caller.

On the ratbagctl side we now have to search the SVG for it's name - stored in
the 'sodipodi:docname' attribute by Inkspace. This isn't guaranteed to exist
or be always correct, but meh, it's close enough. We could continue to use the
GetSvg() call here but I want to deprecate that and remove it in the near
future.

Fixes #521

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-05 08:31:35 +10:00
Jente Hidskes
9b3c33a2fe Convert LED effect rate in Hz to effect duration in ms
As discussed in https://github.com/libratbag/piper/issues/175
2017-11-15 08:53:56 +01:00
Joshua Strobl
be6c381751 docs: Ensure we also check for python3 sphinx build exec suffixed without a hyphen. 2017-10-20 07:46:12 +10: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
Peter Hutterer
74a5551a8d Allow for zero number of dpi values to be set
At least in the DBus API we can't just say "doesn't exist", so let's allow for
a zero-sized list.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-17 10:55:14 +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
a535897ae7 Use Sphinx for the DBus interface documentation
Better than the markdown we were using before, even though we're currently
(ab)using the js/c++ domains for the structure. There is no DBus domain in
sphinx yet.

The main motivation was to get the enums into the documentation since they are
exported ABI.

Generating the documentation is quirky - we use doxygen to extract the
comments from the C header file and then use XSLT to convert to .rst which
sphinx can use. Still better than having to maintain even more copies of the
enums.

Since this is only of interest for maintainers that need to upload the
documentation, it is turned off by default.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-10-13 08:59:33 +02:00
Peter Hutterer
13419dcbb8 doc: drop documentation
Our DBus interface is the only API now and libratbag is just the internal
library. Let's not build doxygen for it, there's no need.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-02 10:14:23 +01:00
Peter Hutterer
7d784a1a91 doc: use USE_MDFILE_AS_MAINPAGE to include the README.md as mainpage
Supported as of doxygen 1.8.3 (Dec 2012), see
http://www.stack.nl/~dimitri/doxygen/manual/changelog.html#log_1_8_3

Fixes #145

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-20 11:28:05 +02:00
Peter Hutterer
a664042f64 meson: add doxygen input files to source list
To rebuild the documentation when either changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-20 11:28:05 +02:00
Peter Hutterer
b8ed1ea3a4 Remove autotools build system
And thus drop the code to parse the top_srcdir from the arguments to the
symbols-leak-test, not the env.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-19 14:40:57 +02:00
Peter Hutterer
1ce59bcc1f doc: drop the custom INPUT to doxygen
Not necessary, we have it in the doxygen.in
2017-04-03 09:55:53 +02:00
Peter Hutterer
3fefe97451 Scaffolding for a libratbag, a mouse configuration library
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-13 11:55:07 +10:00