Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual device #41

Merged
merged 122 commits into from Oct 2, 2017
Merged

Virtual device #41

merged 122 commits into from Oct 2, 2017

Conversation

harryhaaren
Copy link
Member

This PR merges the virtual device branch into Ctlra master. In it, there is a range of commits, enabling virtualization of the devices, as well as adding new examples to test the virtualized devices info. It compiles without warnings, and clang's static analysis finds no serious issues.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit adds a new sample application that demonstrates
how an application can use the Ctlra APIs to "virtualize" a
controller. Given the description of the hardware, it can create
a virtual version of it.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit adds a virtual device which presents an
AVTKA interface. The AVTKA virtual device aims to emulate
any other device that exposes its info statically, to enable
developers easily develop mappings for devices they don't
physically have access to.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit introduces a new API to virtualize a device,
which will allow Ctlra to create "dummy" devices of any
other properly supported controller by using the static
data provided. Relates to #6.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This allows virtual devices to pass in thier connect function
without explicitly registering as a controller device, since
the lookup of the .connect() function is now done earlier.
Relates to #6.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
For #6, the device accept callback in the application is now
called, allowing the app to decide if it supports the device
or not, and accept/decline.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
For #6, but events are not yet propgated from the UI
back into the application. This requires callbacks in the
avtka code to be implemented, and events to be sent via
the callback, utilizing the info of the PMD to identify
what type of event.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit adds the get_name function to the static
info struct as required to virtualize a device. As a result,
the virtualized device can retrieve names of each control.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit detects at build time if the AVTKA library is available
for providing virtualized device support. If not the
ctlra_dev_virtualize function returns -ENOTSUP.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This removes -lavtka from the link command when it was not
found, just a correctness cleanup.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit allows the maschine mikro mk2 to be virtualized,
using the static data as exposed to build up a virtual
representation of the device itself.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit updates the grid info struct definition to
include the physical layout of the grid itself on the
device. Doing so allows the virtualization of grids to
use the co-ordinates otherwise supplied per "item".

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This allows any application to gather info on the supported devices,
in particular showing human-readable names to the user.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit adds an API to get a list of devices supported by a
vendor. The vendor and device APIs can be easily used to build a
simple user-interface for selecting or showing users what devices
are supported by Ctlra.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Thanks for reviewing PR #41!

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
@harryhaaren
Copy link
Member Author

Just a heads up to anybody using this branch - there are currently some compile system changes in progress, making static builds not include any of the drivers. The solution is to use the shared object to link against (shared build is now the default). This will be fixed in a future commit, where we will statically link in device drivers to the libctlra.a archive.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Copy link
Contributor

@foolswood foolswood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking much tidier now, nice.

@@ -6,16 +6,27 @@ conf_data.set('jack', jack.found())

subdir('devices')

cargs = ['-Wno-unused-variable']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do something like: add_global_arguments('-Wno-unused-variable', language: 'c') if you want it for everything and don't want to have to remember to add it to any new targets.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, yes will update that.

meson.build Outdated
@@ -16,6 +16,8 @@ endif

subdir('ctlra')

#['-Wl,--whole-archive'] + devices_lib + ['-Wl,--no-whole-archive']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.. the new build options allows us to build shared / static libraries. That's good - except that with the refactoring of the registration of devices, the GCC attribute(constructor) trick doesn't work unless the static library .a is linked in.

In terms of the build system, it needs to act differently based on shared vs static builds. Shared works fine - on opening the .so the constructor registers the device, done. With static builds, it needs to statically link in "whole archive", and "no-as-needed", because the functions aren't actually called from the libctlra.so, so unless explicitly told to include the .a libs for each device, it'll just leave them out... and leaving them out means no devices are supported.

All in all, I played with it for a while to try make it work, but I didn't get it working yet..

This commit introduces the fluidsynth component into the
vegas-mode example, and has basic mappings from the mikro
mk2 machine devices to play notes and choose sounds.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit fixes the grid input handling, which previously would
send an event for every pressed button (when holding down items, there
can be many pressed at the same time).

With this commit, we check that the value is different to the previous
verion of the grid-button state, which allows identifying when the state
of the grid-square changes, and only emitting a single event when it's
state changes.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit enables grabbing avtka from git when the library
is not installed globally. If the option avtka = false, the
library is not required.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
The deps object needs to be declared even when its not
found - otherwise meson complains about unknown variable.

Use the get_option() == true method to avoid the avtka
related build targets instead.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
All inputs from the Jam now handled, but the device info still
needs to be exposed.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Feedback IDs remain todo, but inputs from UI seem to be working fine

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit adds the feedback ids of the surrounding buttons
of the JAM device.

The internal buttons (1,2,3,4 etc) and the named buttons
(A,B,C,D etc) are on different USB ids, and not yet supported,
neither is the grid of 8x8 buttons. Touch-strip LEDs are similarly
not yet supported.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
The grid fb id invalidation ensure that the existing (valid) ids
are not over-written, which the device_test app was doing.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This minimizes function calls to update LEDs states, and
makes it easier to debug which light calls are made.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit enables the F1 encoder to send events, completing
the input section of the device to 100%.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
This commit should fix the build, if the AVTKA library is not
available.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
@harryhaaren harryhaaren merged commit d8357c2 into master Oct 2, 2017
@harryhaaren harryhaaren deleted the virtual_device branch October 2, 2017 20:17
@harryhaaren
Copy link
Member Author

Thanks for your reviews on this PR @foolswood - too late if you had more comments ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants