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>
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>
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.
It's a mix of tabs and spaces. Let's use spaces to keep the formatting.
And move "switch-etekcity" back to the end, it's a special case.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Or we will take the defaults that are not intuitive (like white color
when setting to on).
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Allows to follow the usage message: we do not need to provide the
currently active profile.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Rename "breath" in the help text and reporting for the led mode to
"breathing". The actual command to set the mode was already called
that way.
Signed-off-by: Christian Kellner <christian@kellner.me>
Because, well, that's what we're supposed to do. Unless you want to think
outside the (array) box, but that has never helped anyone, has it?
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Now that we use meson exclusively and meson uses this for its config.h, you
wouldn't get around it anyway. Besides, the main compilers support it and
libratbag is too niche to worry about others.
This also *adds* the pragma to tools/shared.h where it was previously missing,
and changes it to be the top statement in hidpp-generic.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>
For a builddir called 'builddir', the following commands are sufficient now:
meson builddir
ninja -C builddir
sudo ninja -C builddir install
Meson only needs to be run once after checkout or after the removal of the
builddir.
Fixes https://github.com/libratbag/libratbag/issues/142
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
And use this to start using C99 variable style, for pure loop variables it's
better to have them declared in the loop itself.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
../tools/shared.c:132:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This is especially important for the mx780, so we can get rid of the
rude workaround we currently have in the driver for it.
Signed-off-by: Lyude <lyude@redhat.com>
Changes since v1:
- Just have profile enable/disable in ratbag-command
- Use bool instead of int
Changes since v2:
- Remove leftover function, whoops
- Fix leftover ints to bools
- Lots of style fixes
Almost all of the devices we've worked with here are the same: they have
some sort of profile on them, and if they don't (which is quite rare)
it's rather easy to simulate one in the driver. In fact basically all of
the device drivers in ratbag just update the profile and rewrite it on
calls to the write_resolution_dpi() and write_button() calls. This is
annoying since profile writes can take a good bit of time, and we're
wasting a lot of time with redundant profile writes that way.
During XDC this year, we came up with an idea that makes more sense: a
profile oriented API. Instead of having multiple entrypoints in the API
to writing and updating the profile we just cache all of the profile
changes until ratbag_device_commit_profiles() is called, at which point
we do a single set of writes for each profile and button that changed.
This has a lot of advantages:
- Where the profile is and is not written out to the device is now
explicit.
- Changing attributes of each profile won't result in any sort of delay
up until the library user commits the profiles, allowing us to avoid
hanging the application every time a simple attribute is changed.
- We can cut down on workarounds in drivers to cater to the previous
API.
Since this commit doesn't handle converting all of the device drivers
over to the new API, we also add a temporary wrapper for devices that
haven't yet been converted to this new API so that they're still usable.
Once all of the drivers have been converted to the new API, the wrapper
will be removed along with the internal driver API calls.
Signed-off-by: Lyude <thatslyude@gmail.com>
Changes since v1:
- has_changed→dirty
- Change namespace to LIBRATBAG_0.5.0
Changes since v2:
- Remove unneeded note about not setting dirty bit
- commit_profiles->commit
- Make FIXMEs more obvious
- Minor styling nitpicks
- Split up capability check fixes into seperate patch
The previous API was inconsistent and different to the rest of libratbag's
API. Replace with one where a macro is a separate struct, can be initialized
and then written to the device with a set_macro() call. The device copies the
contents, the macro is otherwise unmodified and can be re-used by the client
if need be.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Whenever we do something that may fail, return an enum of possible errors.
This also changes the API for ratbag_device_new_from_udev_device() to return
an error code now too instead of just NULL on failure.
Error numbers start at -1000 to avoid overlap with errnos, error_code() should
be used internally to avoid returning an errno.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>