Commit Graph

1114 Commits

Author SHA1 Message Date
Benjamin Tissoires
7b1e7dc4e7 tools: add a test suite for ratbagctl
Using unittest to be fancy

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
019d020535 tools: ratbagctl: output device information like ratbag-command
Better having a consistent device information across tools.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
89d071bb80 Fix flake-8 complains
Piper already uses this, we might as well.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
499ebc7d18 tools: ratbagctl: sync ratbagd bindings with piper
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
e522e0bb07 drivers: add a fallback for fetching the SVG name
In case the udev property is not present, we might want to query
the driver for the SVG name.
This is useful for driver-test as there is no udev device attached to
it, and for hidpp20 as we have auto-detection. We should then be able
to implement this in hidpp20 also so that the name gets automatically
created.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
f55a314666 ratbagd: add a test device while in developer mode
This allows to run tests against a device without having a proper device
plugged in.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Benjamin Tissoires
97ac0f81f2 hidpp20: shut one ratbagd warning
If the profile is not active, we do not know which resolution is currently
used. Instead of having ratbagd complaining, just set the default as
active.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-12 08:16:39 +02:00
Peter Hutterer
8cfcab3363 circle.yml: add ninja scan-build to the jobs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
6f72accbee circle.yml: split fedora install out and make ninja more flexible
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
e021937867 Change device name to use a stack buffer
This shuts up a scan-build warning about a memleak that looked like a false
positive but I couldn't get rid of.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
82d197462f hidpp20: fix NULL-pointer dereference warning
rc may be a negative errno or a positive hidpp error code. If the latter we
used to continue with a NULL macro pointer, eventually crashing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
78bdfe7a59 Don't allocate zero-sized memory
Triggered by the tests with 0 resolutions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
586fc7a97d hidpp20: squash memory leak on profile initialization error
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
2faa94920e hidpp20: drop unused argument from the profile destroy function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
01163d8f77 ratbagd: fix a false-positive unused variable warning
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
04990e4ea2 hidpp10: error out if we deal with unsupported profiles
Just logging and error and continuing is not enough, we'll eventually
dereference garbage values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
37c8dec45c Fix the various scan-build warnings for dead assignments
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Peter Hutterer
df2a06690d Fix device capability check
We now have a lot more bits to cater for, so let's use an array.

Broken with 487e66e64d

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 10:50:22 +02:00
Jente Hidskes
2c4cdc6dc6 ratbagd-led: mark DBus properties as EMITS_CHANGE 2017-07-10 20:41:12 +10:00
Jente Hidskes
96c2f404d2 ratbagd-led: add error check for RGB 0-255 range 2017-07-10 20:41:12 +10:00
Clément Vuchener
e33a515fd6 data: add toned-down SVG for Logitech G500/G500s (#214)
* data/gnome: add SVG for Logitech G500/G500s

* data/gnome: add buttons 0 and 1 to the G700
2017-07-10 09:30:56 +02:00
Jente Hidskes
8fc58e259c Use toned-down device SVGs (#182)
* data/gnome: add GNOME theme requirements

* data/logitech-g403.svg: add G403 GNOME SVG

* data/logitech-g502.svg: add G502 GNOME SVG

* data/logitech-g700.svg: add G700 GNOME SVG

* meson: install GNOME SVG files
2017-07-07 16:05:36 +02:00
Christian Kellner
caadd86091 hwdb: add G403 entry
The G403 comes in a (optional) wireless version too; the dongle
that come with it has the product id c539, which is already
handled and also works (by the G900) entry.

Signed-off-by: Christian Kellner <christian@kellner.me>
2017-07-07 15:12:55 +02:00
Jente Hidskes
e16aafe86c data: move default SVGs under default/ subdirectory..
.. and install them in the appropriate directory after #209
2017-07-07 15:07:45 +02:00
Peter Hutterer
6a0ebe9e45 ratbagd: add support for svg theming
Two new DBus interfaces:
org.freedesktop.ratbagd1.Manager.Themes -> string array
org.freedesktop.ratbagd1.Device.GetSvg('theme') -> string

The Themes property is a static list of available themes. These are currently
hardcoded in ratbagd, but the theme 'default' is guaranteed to exist.

The GetSvg() method takes a theme name and returns the full file path to the
themed SVG.

Longer-term this will deprecate the Svg and SvgPath properties in the Device
but for now we leave them there.

https://github.com/libratbag/libratbag/issues/204

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-07 08:20:01 +02:00
Benjamin Tissoires
79f4b9c0d6 tools: add ratbagctl.devel to launch both ratbagd and ratbagctl
When developing with ratbagd, we need to test against master, not
the system-wide installed daemon.

Allow to name space ratbagd with the creation of a new (not installed)
rabtagd.devel daemon, that is tagged with the git sha of the ratbagd
folder.

Handle this namespace in ratbagctl by looking at an environment variable
RATBAGCTL_DEVEL.

Then provide a python script that launches both rabtagd.devel and
ratbagctl with the correct environment variable set so that they can
talk to each other.

Note that we blindly overwrite the dbus .conf file as nobody else than
developers should have one.

Note: the tagging of ratbagd.devel (like the meson bit) won't run unless
a rebuild is triggered. So we don't necessarily always get the right git
tag. However, touching ratbagctl.in triggers a rebuild, so we should be
OK-ish.

Fixes #206

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-07 16:02:46 +10:00
Benjamin Tissoires
e6433abd09 tools: import ratbagd.py from piper
We are updating it, let us keep it in sync

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-07 16:02:46 +10:00
Peter Hutterer
96f3b7858b tools: fix ratbagctl error when dbus isn't available (#210)
File "./build/ratbagctl", line 713, in main
    cmd.func(r, cmd)
UnboundLocalError: local variable 'r' referenced before assignment

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-06 08:39:27 +02:00
Peter Hutterer
f5abc191d8 ratbagd: drop the ActiveResolutionChanged signal generation (#208)
* ratbagd: drop the ActiveResolutionChanged signal generation

Leave the signal in the DBus API for now so we can hook it up later, but
stop the signal being generated. Changing the dpi does not change the active
resolution.

https://github.com/libratbag/libratbag/issues/205

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

* ratbagd: fix signal dbus interface name

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-06 08:20:43 +02:00
Benjamin Tissoires
251b602323 ratbagd: call the correct set_resolution based on the capabilities
ratbagd unconditionally called set_resolution_xy while libratbag expects
the caller to check on the capabilities. Instead of letting this burden
to the dbus user, have ratbagd handle this for us.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-05 11:33:21 +02:00
Peter Hutterer
fe3169182c meson: fix valgrind setup
The previous approach had no effect, it wasn't doing things correctly.
Add a proper valgrind setup, run with:

       mesontest --setup=valgrind

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
[fixed rebase conflict]
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-05 09:36:30 +02:00
Peter Hutterer
642a5339bc meson: drop invalid configuration: tag for install_data
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-05 09:35:51 +02:00
Benjamin Tissoires
c251053f03 circle.yml: add workaround for meson upstream bug
Meson currently doesn't clean up after itself on uninstall.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-05 08:37:18 +10:00
Benjamin Tissoires
4b97b00518 circle.yml: uninstall and checks if there are any leftovers
Check if $PREFIX is still there after uninstall, and if so show
which files are left.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-05 08:37:18 +10:00
Jente Hidskes
faa1a24c25 RatbagdDevice: add commit method
Fixes #198
2017-07-04 17:02:18 +02:00
Benjamin Tissoires
b78b5cd73e circle.yml: add install step
It doesn't cost much to actually install the files, so we can check
where they are installed.

Also add mesonconf before building so we can see in the logs
the various configure environment.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-03 19:14:10 +10:00
Peter Hutterer
4eb5411bf1 meson: fix svg data dir (#191)
It was missing the prefix

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-03 10:28:20 +02:00
Peter Hutterer
22af1176d3 meson: hack around Fedora's systemd libdir confusion
Fedora uses /usr/lib64 as libdir but systemd uses /usr/lib for its files. We
used libdir to install the unit files, which then end up in
/usr/lib64/systemd/systemd where it will be ignored. There's no good way to
avoid this beyond detecting this mismatch and hacking around it.

To keep custom prefixes intact, this patch detects a /usr prefix and checks
with systemd's pkconfig, if the libdir and the systemd unitdir mismatch, then
we adjust the path.

https://github.com/libratbag/libratbag/issues/188

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-03 09:57:20 +02:00
Benjamin Tissoires
bb6d8a6ea4 update circle CI link 2017-07-01 17:43:26 +02:00
Benjamin Tissoires
935f68ae8f enhance circle.yml with workflows
Circle CI uses docker, so nothing prevents us from running several
tests in parallel for different distributions. Ideally, we should also
be able to test the install and be sure we can talk to ratbagd
with the dbus activation on those various distributions.

This version runs both Fedora rawhide and Ubuntu 17.04 at the same
time.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-07-01 10:38:01 +10:00
Peter Hutterer
2fd939f514 resolution: add support for min/max resolutions
https://github.com/libratbag/libratbag/issues/180

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 09:07:24 +02:00
Peter Hutterer
dbc0672061 README: clarify the two developer-specific notes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 07:24:54 +02:00
Peter Hutterer
804f2eec76 README: clean up the Running ratbagd section
We install everything, so rather than having commands that aren't needed,
simply describe what we're doing and hope for the best.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 07:24:54 +02:00
Peter Hutterer
73c24319d1 README: move the dbus interface description out
No-one reads anything longer than 140 char anymore, so let's move the DBus
Interface description out. The average visitor to this site won't care.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 07:24:54 +02:00
Peter Hutterer
6b3fc6338e README: cleanup, de-duplication, etc.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 07:24:54 +02:00
Peter Hutterer
c6855df5fc Drop the semaphore status in the README and the build script
Semaphore only provides Ubuntu 14.04 which is too old for us. We now have
CircleCI integration which can run docker images, so let's leave that and drop
Semaphore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-30 07:24:54 +02:00
Benjamin Tissoires
9ed61fd072 Add circle.yml
Semaphore CI is still using Ubuntu 14.04, and the shipped systemd version
is just too old.
OTOH, Circle CI 2.0 (still beta as of today) allows to use any docker
image as a base for running the tests. Meaning that we can have a fedora
rawhide image as a base and we do not have to handle the update of systemd
meson and others.

Ship a basic circle.yml for Circle CI to run our tests and add the badge
in the README.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-06-30 07:53:22 +10:00
Benjamin Tissoires
1a764944e7 Merge pull request #184 from whot/wip/ratbagd-merge
This merges ratbagd into libratbag, keeping the histories of both projects intact (hence the rather large merge). The meson.build files are merged and a few things are shuffled around to look like one normal project directory. The build artifacts are still the same, i.e. we still build libratbag and ratbagd.
2017-06-29 17:19:30 +02:00
Peter Hutterer
e311f89357 Provide a min/max dpi for the resolutions
For a GUI application like Piper, it's required that we know the range to
present to the user.

This patch includes the code for HID++ 1.0 and 2.0, other drivers need to
follow.

https://github.com/libratbag/libratbag/issues/180

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 09:07:18 +02:00
Peter Hutterer
ecdba84977 hidpp20: use min/max macros over ternary condition
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-29 09:07:18 +02:00