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

Conversation

Projects
None yet
2 participants
@harryhaaren
Contributor

harryhaaren commented Sep 17, 2017

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.

harryhaaren added some commits Sep 1, 2017

usb: move usb info prints to CTLRA_INFO macro
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
simple: fix grid pressed X or blank prints
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
mikromk2: initial poc velocity sensing
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
mikromk2: rework velocity mapping to be flatter
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
virt_dev: add new example for virutal devices
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>
virt_dev: rework to add widget types
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
avtka: virtual device using avtka initial commit
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>
virtualize: initial implementation
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>
ctlra: accept dev impl refactored for flexibility
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>
virtualize: implemented connect / accept
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>
virtual: device probe working, ui clickable
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>
avtka: fix bugin avtka_t naming, working on events
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
avtka: events from ui being sent to app
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
avtka: rework callback to include float value
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
avtka: fix device background painting
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
virt dev: cleanup avtka code, comments prints
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
z1: expose get_name() function to static info
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>
cltra: conditional compile of AVTKA virtual dev
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>
meson: rework avtka library tracking and depends
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>
avtka: update to include gl
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
avtka: fix slider interact directions
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
mikro mk2: add static device layout info
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>
ctlra: update API for grid event to have item info
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>

harryhaaren added some commits Sep 24, 2017

ctlra: add api to retrieve vendor names
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>
ctlra: add device by vendor api to show devices
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>
ctlra: refactor based on @foolswood 's feedback
Thanks for reviewing PR #41!

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

This comment has been minimized.

Show comment
Hide comment
@harryhaaren

harryhaaren Sep 24, 2017

Contributor

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.

Contributor

harryhaaren commented Sep 24, 2017

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.

ctlra: add strerror functionality, rework virtualization errors
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
@foolswood

Looking much tidier now, nice.

@@ -6,16 +6,27 @@ conf_data.set('jack', jack.found())
subdir('devices')
cargs = ['-Wno-unused-variable']

This comment has been minimized.

@foolswood

foolswood Sep 25, 2017

Contributor

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.

@foolswood

foolswood Sep 25, 2017

Contributor

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.

This comment has been minimized.

@harryhaaren

harryhaaren Sep 25, 2017

Contributor

Good point, yes will update that.

@harryhaaren

harryhaaren Sep 25, 2017

Contributor

Good point, yes will update that.

Show outdated Hide outdated meson.build

harryhaaren added some commits Sep 29, 2017

vegas: add fluidsynth additions to demo music making
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>
vegas: print patch number when switching
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
vegas: upgrade mikro mappings for demo mode
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
jam: fix grid event sending handling
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>
vegas: upgrade jam grid handling to play piano
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
meson: use avtka as a subproject if not installed
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>
meson: fix compilation with avtka=false option
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>
jam: implement encoder events
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>
cleanup
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
jam: cleanup and improve control exposing
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
jam: add device layout info
Feedback IDs remain todo, but inputs from UI seem to be working fine

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
jam: initial feedback ids added device layout info
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>
jam: fix button sizes, and update grid fb ids to invalid
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>
device_test: only update modified lights
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>
jam: fix button sizes in top left
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
vegas mode: improve jam mapping, minor cleanups
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
avtka: add blue colour to generated AVTKA ui
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
f1: implement encoder support
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>
meson: add avtka.wrap file to git, fixing build
This commit should fix the build, if the AVTKA library is not
available.

Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>
meson: clenaup comments
Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>

@harryhaaren harryhaaren merged commit d8357c2 into master Oct 2, 2017

3 checks passed

codacy/pr Good work! A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@harryhaaren harryhaaren deleted the virtual_device branch Oct 2, 2017

@harryhaaren

This comment has been minimized.

Show comment
Hide comment
@harryhaaren

harryhaaren Oct 2, 2017

Contributor

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

Contributor

harryhaaren commented Oct 2, 2017

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