aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alsa-Plugin/Alsa-Policy-Hook/CMakeLists.txt2
-rw-r--r--Alsa-Plugin/Alsa-Policy-Hook/PolicyHookCb.c126
-rw-r--r--Alsa-Plugin/Alsa-Policy-Hook/README.md12
-rw-r--r--Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlug.h4
-rw-r--r--Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlugCb.c6
-rw-r--r--Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlugCtl.c6
-rw-r--r--Alsa-Plugin/_Alsa-Hal-plugin/CMakeLists.txt4
-rw-r--r--Alsa-Plugin/_Alsa-Hal-plugin/README.md4
-rw-r--r--Alsa-afb/Alsa-AddCtl.c4
-rw-r--r--Alsa-afb/Alsa-ApiHat.h14
-rw-r--r--Alsa-afb/Alsa-RegEvt.c12
-rw-r--r--Alsa-afb/Alsa-SetGet.c8
-rw-r--r--Alsa-afb/Alsa-Ucm.c6
-rw-r--r--Alsa-afb/CMakeLists.txt4
-rw-r--r--Audio-Common/audio-common.c28
-rw-r--r--Audio-Common/audio-common.h40
-rw-r--r--HAL-afb/HAL-interface/CMakeLists.txt4
-rw-r--r--HAL-afb/HAL-interface/hal-interface.c10
-rw-r--r--HAL-afb/HAL-interface/hal-volramp.c12
-rw-r--r--HAL-afb/HAL-interface/hal-volume.c6
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/CMakeLists.txt2
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/README.md2
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c48
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/ucs2-vol/CMakeLists.txt2
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/ucs2-vol/inc/device_value.h2
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/ucs2-vol/inc/libmostvolume.h4
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/device_container.cpp2
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/device_value.cpp4
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/libmostvolume.cpp4
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/wrap_unicens.c140
-rw-r--r--HAL-afb/HAL_MOST_UNICENS/wrap_volume.c50
-rw-r--r--HAL-afb/HDA-intel/IntelHdaHAL.c12
-rw-r--r--HAL-afb/Jabra-Solemate/CMakeLists.txt2
-rw-r--r--HAL-afb/Jabra-Solemate/JabraUsbHAL.c24
-rw-r--r--HAL-afb/Scarlett-Focusrite/CMakeLists.txt2
-rw-r--r--HAL-afb/Scarlett-Focusrite/ScarlettUsbHAL.c26
-rw-r--r--conf.d/cmake/config.cmake2
-rw-r--r--conf.d/project/alsa.d/asoundrc.sample44
-rw-r--r--htdocs/AFB-websock.js6
-rw-r--r--htdocs/AudioBinding.js80
-rw-r--r--htdocs/README.md2
-rw-r--r--htdocs/alsa-core.html28
-rw-r--r--htdocs/alsa-hal.html16
-rw-r--r--htdocs/audio-control.html20
-rw-r--r--htdocs/audio-logic.html2
45 files changed, 419 insertions, 419 deletions
diff --git a/Alsa-Plugin/Alsa-Policy-Hook/CMakeLists.txt b/Alsa-Plugin/Alsa-Policy-Hook/CMakeLists.txt
index 6f4503e..329b2ef 100644
--- a/Alsa-Plugin/Alsa-Policy-Hook/CMakeLists.txt
+++ b/Alsa-Plugin/Alsa-Policy-Hook/CMakeLists.txt
@@ -21,7 +21,7 @@ add_compile_options(-DPIC)
PROJECT_TARGET_ADD(policy_hook_cb)
- # Define targets
+ # Define targets
ADD_LIBRARY(${TARGET_NAME} MODULE PolicyHookCb.c)
# Alsa Plugin properties
diff --git a/Alsa-Plugin/Alsa-Policy-Hook/PolicyHookCb.c b/Alsa-Plugin/Alsa-Policy-Hook/PolicyHookCb.c
index 80a9ceb..54fbe88 100644
--- a/Alsa-Plugin/Alsa-Policy-Hook/PolicyHookCb.c
+++ b/Alsa-Plugin/Alsa-Policy-Hook/PolicyHookCb.c
@@ -13,22 +13,22 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* AfbCallBack (snd_ctl_hal_t *handle, int numid, void **response);
* AlsaHookInit is mandatory and called with numid=0
- *
+ *
* Syntax in .asoundrc file
* CrlLabel { cb MyFunctionName name "My_Second_Control" }
- *
+ *
* Testing:
- * aplay -DAlsaHook /usr/share/sounds/alsa/test.wav
- *
+ * aplay -DAlsaHook /usr/share/sounds/alsa/test.wav
+ *
* References:
* https://www.spinics.net/lists/alsa-devel/msg54235.html
* https://github.com/shivdasgujare/utilities/blob/master/nexuss/alsa-scenario-hook/src/alsa-wrapper.c
*/
-#define _GNU_SOURCE
+#define _GNU_SOURCE
#include <stdio.h>
#include <alsa/asoundlib.h>
#include <alsa/conf.h>
@@ -51,8 +51,8 @@
// this should be more than enough
#define MAX_API_CALL 10
#define MAX_EVT_CALL 10
-
-// timeout in ms
+
+// timeout in ms
#define REQUEST_DEFAULT_TIMEOUT 500
#ifndef MAINLOOP_WATCHDOG
#define MAINLOOP_WATCHDOG 100000
@@ -60,9 +60,9 @@
// closing message is added to query when PCM is closed
#define CLOSING_MSG ",\"source\":-1}"
-
+
// Currently not implemented
-#define UNUSED_ARG(x) UNUSED_ ## x __attribute__((__unused__))
+#define UNUSED_ARG(x) UNUSED_ ## x __attribute__((__unused__))
void OnRequestCB(void* UNUSED_ARG(handle) , const char* UNUSED_ARG(api), const char* UNUSED_ARG(verb), struct afb_wsj1_msg*UNUSED_ARG(msg)) {}
typedef struct {
@@ -71,7 +71,7 @@ typedef struct {
long timeout;
char *query;
size_t length;
-
+
sd_event_source *evtSource;
char *callIdTag;
void *afbClient;
@@ -104,7 +104,7 @@ static void *LoopInThread(void *handle) {
/* loop until end */
for (;;) {
-
+
if (afbClient->verbose) printf("ON-MAINLOOP ping=%d\n", count++);
sd_event_run(afbClient->sdLoop, watchdog);
}
@@ -117,7 +117,7 @@ static void OnHangupCB(void *handle, struct afb_wsj1 *wsj1) {
afbClientT *afbClient = (afbClientT*) handle;
SNDERR("(Hoops) Lost Connection to %s", afbClient->uri);
-
+
// try to close PCM when impossible terminate client
int err = snd_pcm_close (afbClient->pcm);
if (err) exit(1);
@@ -135,35 +135,35 @@ void OnEventCB(void *handle, const char *event, struct afb_wsj1_msg *msg) {
json_object *eventJ, *tmpJ, *dataJ;
const char *label;
int value, done, index;
-
+
eventJ = afb_wsj1_msg_object_j(msg);
done= json_object_object_get_ex(eventJ,"data", &dataJ);
if (!done) {
- SNDERR ("PCM_HOOK: uri=%s empty event label", afbClient->uri);
+ SNDERR ("PCM_HOOK: uri=%s empty event label", afbClient->uri);
goto OnErrorExit;
- }
+ }
json_object_object_get_ex(dataJ,"signal", &tmpJ);
label=json_object_get_string(tmpJ);
-
+
json_object_object_get_ex(dataJ,"value", &tmpJ);
value=json_object_get_int(tmpJ);
-
+
for (index=0; afbEvent[index]!= NULL; index++) {
if (!strcmp(afbEvent[index]->name, label)) break;
}
-
+
if (!afbEvent[index] || !afbEvent[index]->signal) {
- SNDERR ("PCM_HOOK: Unsupported uri=%s label=%s", afbClient->uri, label);
+ SNDERR ("PCM_HOOK: Unsupported uri=%s label=%s", afbClient->uri, label);
return;
}
// send signal to self process
kill (getpid(), afbEvent[index]->signal);
-
+
if (afbClient->verbose) printf("ON-EVENT label=%s signal=%d\n", label, value);
return;
-
+
OnErrorExit:
SNDERR("ON-EVENT %s(%s)\n", event, afb_wsj1_msg_object_s(msg));
return;
@@ -181,12 +181,12 @@ void OnResponseCB(void *handle, struct afb_wsj1_msg *msg) {
afbClientT *afbClient=(afbClientT*)afbRequest->afbClient;
if (afbClient->verbose) printf("ON-RESPONSE call=%s response=%s\n", afbRequest->callIdTag, afb_wsj1_msg_object_s(msg));
-
+
// Cancel timeout for this request
sd_event_source_unref(afbRequest->evtSource);
-
+
if (! afb_wsj1_msg_is_reply_ok(msg)) goto OnErrorExit;
-
+
// When not more waiting call release semaphore
afbClient->count--;
if (afbClient->count == 0) {
@@ -196,7 +196,7 @@ void OnResponseCB(void *handle, struct afb_wsj1_msg *msg) {
}
return;
-OnErrorExit:
+OnErrorExit:
fprintf(stderr, "ON-RESPONSE ERROR call=%s response=%s\n", afbRequest->callIdTag, afb_wsj1_msg_object_s(msg));
afbClient->error=1;
sem_post (&afbClient->semaphore);
@@ -206,11 +206,11 @@ int OnTimeoutCB (sd_event_source* source, uint64_t timer, void* handle) {
afbClientT *afbClient= (afbClientT*)handle;
SNDERR("\nON-TIMEOUT Call Request Fail URI=%s\n", afbClient->uri);
-
+
// Close PCM and release waiting client
afbClient->error=1;
- sem_post (&afbClient->semaphore);
-
+ sem_post (&afbClient->semaphore);
+
return 0;
}
@@ -221,14 +221,14 @@ static int CallWithTimeout(afbClientT *afbClient, afbRequestT *afbRequest, int c
// create a unique tag for request
(void) asprintf(&afbRequest->callIdTag, "%d:%s/%s", count, afbRequest->api, afbRequest->verb);
-
+
// create a timer with ~250us accuracy
sd_event_now(afbClient->sdLoop, CLOCK_MONOTONIC, &usec);
sd_event_add_time(afbClient->sdLoop, &afbRequest->evtSource, CLOCK_MONOTONIC, usec+afbRequest->timeout*1000, 250, OnTimeoutCB, afbClient);
if (afbClient->verbose) printf("CALL-REQUEST api=%s/%s tag=%s\n", afbRequest->api, afbRequest->verb, afbRequest->callIdTag);
-
- // on PCM close replace last '}' by CLOSING_MSG
+
+ // on PCM close replace last '}' by CLOSING_MSG
if (action == HOOK_CLOSE) {
for (size_t index=afbRequest->length; index >0; index--) {
if (afbRequest->query[index] == '}') {
@@ -238,15 +238,15 @@ static int CallWithTimeout(afbClientT *afbClient, afbRequestT *afbRequest, int c
}
}
- err = afb_wsj1_call_s(afbClient->wsj1, afbRequest->api, afbRequest->verb, afbRequest->query, OnResponseCB, afbRequest);
+ err = afb_wsj1_call_s(afbClient->wsj1, afbRequest->api, afbRequest->verb, afbRequest->query, OnResponseCB, afbRequest);
if (err) goto OnErrorExit;
-
+
// save client handle in request
afbRequest->afbClient = afbClient;
afbClient->count ++;
-
+
return 0;
-
+
OnErrorExit:
return -1;
}
@@ -256,11 +256,11 @@ static int LaunchCallRequest(afbClientT *afbClient, hookActionT action) {
pthread_t tid;
int err, idx;
afbRequestT **afbRequest= afbClient->request;
-
+
if (action == HOOK_INSTALL) {
// init waiting counting semaphore
if (sem_init(&afbClient->semaphore, 1, 0) == -1) {
- fprintf(stderr, "LaunchCallRequest: Fail Semaphore Init: %s\n", afbClient->uri);
+ fprintf(stderr, "LaunchCallRequest: Fail Semaphore Init: %s\n", afbClient->uri);
}
// Create a main loop
@@ -274,23 +274,23 @@ static int LaunchCallRequest(afbClientT *afbClient, hookActionT action) {
err = pthread_create(&tid, NULL, &LoopInThread, afbClient);
if (err) goto OnErrorExit;
- // connect the websocket wsj1 to the uri given by the first argument
+ // connect the websocket wsj1 to the uri given by the first argument
afbClient->wsj1 = afb_ws_client_connect_wsj1(afbClient->sdLoop, afbClient->uri, &itf, afbClient);
if (afbClient->wsj1 == NULL) {
fprintf(stderr, "LaunchCallRequest: Connection to %s failed\n", afbClient->uri);
goto OnErrorExit;
}
}
-
+
// send call request to audio-agent asynchronously (respond with thread mainloop context)
for (idx = 0; afbRequest[idx] != NULL; idx++) {
err = CallWithTimeout(afbClient, afbRequest[idx], idx, action);
if (err) {
fprintf(stderr, "LaunchCallRequest: Fail call %s//%s/%s&%s", afbClient->uri, afbRequest[idx]->api, afbRequest[idx]->verb, afbRequest[idx]->query);
goto OnErrorExit;
- }
+ }
}
-
+
// launch counter to keep track of waiting request call
afbClient->count=idx;
@@ -303,19 +303,19 @@ OnErrorExit:
static int AlsaCloseHook(snd_pcm_hook_t *hook) {
afbClientT *afbClient = (afbClientT*) snd_pcm_hook_get_private (hook);
-
+
// launch call request and create a waiting mainloop thread
int err = LaunchCallRequest(afbClient, HOOK_CLOSE);
if (err < 0) {
fprintf (stderr, "PCM Fail to Enter Mainloop\n");
goto OnErrorExit;
}
-
+
// wait for all call request to return
sem_wait(&afbClient->semaphore);
if (afbClient->error) {
fprintf (stderr, "AlsaCloseHook: Audio Agent Fail to respond\n");
- goto OnErrorExit;
+ goto OnErrorExit;
}
if (afbClient->verbose) fprintf(stdout, "\nAlsaHook Close Success PCM=%s URI=%s\n", snd_pcm_name(afbClient->pcm), afbClient->uri);
@@ -339,7 +339,7 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
afbClient->pcm = pcm;
afbClient->verbose = 0;
afbClient->request = afbRequest;
-
+
// Get PCM arguments from asoundrc
snd_config_for_each(it, next, conf) {
snd_config_t *node = snd_config_iterator_entry(it);
@@ -383,10 +383,10 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
}
- // loop on each call
+ // loop on each call
snd_config_for_each(currentCall, follow, node) {
snd_config_t *ctlconfig = snd_config_iterator_entry(currentCall);
-
+
// ignore empty line
if (snd_config_get_id(ctlconfig, &callLabel) < 0) continue;
@@ -411,7 +411,7 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
}
afbRequest[callCount]->api=strdup(api);
}
-
+
err = snd_config_search(ctlconfig, "verb", &itemConf);
if (!err) {
const char *verb;
@@ -421,7 +421,7 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
}
afbRequest[callCount]->verb=strdup(verb);
}
-
+
err = snd_config_search(ctlconfig, "timeout", &itemConf);
if (!err) {
if (snd_config_get_integer(itemConf, &afbRequest[callCount]->timeout) < 0) {
@@ -429,7 +429,7 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
goto OnErrorExit;
}
}
-
+
err = snd_config_search(ctlconfig, "query", &itemConf);
if (!err) {
const char *query;
@@ -441,7 +441,7 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
afbRequest[callCount]->length= strlen(query);
afbRequest[callCount]->query = malloc (afbRequest[callCount]->length+strlen(CLOSING_MSG)+1);
strcpy (afbRequest[callCount]->query, query);
-
+
// cleanup string for json_tokener
for (int idx = 0; query[idx] != '\0'; idx++) {
if (query[idx] == '\'') afbRequest[callCount]->query[idx] = '"';
@@ -453,7 +453,7 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
goto OnErrorExit;
}
}
-
+
// Simple check on call request validity
if (!afbRequest[callCount]->query) afbRequest[callCount]->query= "";
if (!afbRequest[callCount]->timeout) afbRequest[callCount]->timeout=REQUEST_DEFAULT_TIMEOUT ;
@@ -466,11 +466,11 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
callCount ++;
if (callCount == MAX_API_CALL) {
SNDERR("Too Many call MAX_API_CALL=%d", MAX_API_CALL);
- goto OnErrorExit;
+ goto OnErrorExit;
}
afbRequest[callCount]=NULL; // afbRequest array is NULL terminated
- }
+ }
continue;
}
if (strcmp(id, "event") == 0) {
@@ -487,11 +487,11 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
}
- // loop on each call
+ // loop on each call
snd_config_for_each(currentCall, follow, node) {
snd_config_t *ctlconfig = snd_config_iterator_entry(currentCall);
long sigval;
-
+
// ignore empty line
if (snd_config_get_id(ctlconfig, &callLabel) < 0) continue;
@@ -502,7 +502,7 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
SNDERR("Invalid signal number for %s value=%s", callLabel, callConf);
goto OnErrorExit;
}
-
+
// allocate an empty call request
snd_config_get_integer(ctlconfig, &sigval);
afbEvent[callCount] = calloc(1, sizeof (afbEventT));
@@ -513,15 +513,15 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
callCount ++;
if (callCount == MAX_EVT_CALL) {
SNDERR("Too Many call MAX_EVT_CALL=%d", MAX_EVT_CALL);
- goto OnErrorExit;
+ goto OnErrorExit;
}
afbEvent[callCount]=NULL; // afbEvent array is NULL terminated
- }
+ }
continue;
}
}
-
+
if (afbClient->verbose) fprintf(stdout, "\nAlsaHook Install Start PCM=%s URI=%s\n", snd_pcm_name(afbClient->pcm), afbClient->uri);
err = snd_pcm_hook_add(&h_close, afbClient->pcm, SND_PCM_HOOK_TYPE_CLOSE, AlsaCloseHook, afbClient);
@@ -533,12 +533,12 @@ int PLUGIN_ENTRY_POINT (snd_pcm_t *pcm, snd_config_t *conf) {
fprintf (stderr, "PCM Fail to Enter Mainloop\n");
goto OnErrorExit;
}
-
+
// wait for all call request to return
sem_wait(&afbClient->semaphore);
if (afbClient->error) {
fprintf (stderr, "PCM Authorisation Deny from AAAA Controller (AGL Advanced Audio Agent)\n");
- goto OnErrorExit;
+ goto OnErrorExit;
}
if (afbClient->verbose) fprintf(stdout, "\nAlsaHook Install Success PCM=%s URI=%s\n", snd_pcm_name(afbClient->pcm), afbClient->uri);
diff --git a/Alsa-Plugin/Alsa-Policy-Hook/README.md b/Alsa-Plugin/Alsa-Policy-Hook/README.md
index 6a8e67e..20186db 100644
--- a/Alsa-Plugin/Alsa-Policy-Hook/README.md
+++ b/Alsa-Plugin/Alsa-Policy-Hook/README.md
@@ -7,7 +7,7 @@ Date : August-2017
Functionalities:
- Execute a set of websocket RPC request again AGL binders to allow/deny access
- - Keep websocket open in an idepandant thread on order to monitor event receive from AGL audio agent
+ - Keep websocket open in an idepandant thread on order to monitor event receive from AGL audio agent
Installation
- Alsaplugins are typically search in /usr/share/alsa-lib. Nevertheless a full path might be given
@@ -23,7 +23,7 @@ Config
# Define sharelib location and entry point
# -----------------------------------------
pcm_hook_type.MyHookPlugin {
- install "AlsaInstallHook"
+ install "AlsaInstallHook"
lib "/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Alsa-Plugin/Alsa-Hook-Callback/alsa_hook_cb.so"
}
@@ -42,12 +42,12 @@ pcm.MyNavigationHook {
# Every Call should return OK in order PCM to open (default timeout 100ms)
uri "ws://localhost:1234/api?token='audio-agent-token'"
request {
- # Request autorisation to write on navigation
+ # Request autorisation to write on navigation
navigation-ctl {
api "control"
verb "dispatch"
args "{'target':'navigation', 'args':{'device':'Jabra SOLEMATE v1.34.0'}}"
- }
+ }
# subscribe to Audio Agent Event map them to signal
subscribe-evt {
api "control"
@@ -66,11 +66,11 @@ pcm.MyNavigationHook {
```
-NOTE:
+NOTE:
* Hook plugin is loaded by Alsa libasound within player context. It inherits client process attributes, as UID/GID or
the SMACK label on AGL. This smack label is tested by AGL security framework when requested a call on the audio-agent binder.
-As a result the call will only succeed it the permission attached the application in Cynara matches.
+As a result the call will only succeed it the permission attached the application in Cynara matches.
* Hook plugin keep a connection with the Audio-Agent until PCM is closed by the application. This connection allow the
Audio-Agent to send events. eg: pause, quit, mute, ... \ No newline at end of file
diff --git a/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlug.h b/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlug.h
index bb2dd79..98850bf 100644
--- a/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlug.h
+++ b/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlug.h
@@ -13,10 +13,10 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* AfbCallBack (snd_ctl_hal_t *handle, int numid, void **response);
* AfbHalInit is mandatory and called with numid=0
- *
+ *
* Syntaxe in .asoundrc file
* CrlLabel { cb MyFunctionName name "My_Second_Control" }
*/
diff --git a/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlugCb.c b/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlugCb.c
index b96f3d9..9e55f0c 100644
--- a/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlugCb.c
+++ b/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlugCb.c
@@ -13,13 +13,13 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* AfbCallBack (snd_ctl_hal_t *handle, int numid, void **response);
* AfbHalInit is mandatory and called with numid=0
- *
+ *
* Syntax in .asoundrc file
* CrlLabel { cb MyFunctionName name "My_Second_Control" }
- *
+ *
* Testing:
* amixer -Dagl_hal controls
* amixer -Dagl_hal cget name=My_Sample_Callback
diff --git a/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlugCtl.c b/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlugCtl.c
index 5e92dd6..22c217b 100644
--- a/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlugCtl.c
+++ b/Alsa-Plugin/_Alsa-Hal-plugin/AlsaHalPlugCtl.c
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* Testing:
* 1) Copy generated plugin [libasound_module_pcm_afbhal.so] in alsa-lib/ dir visible from LD_LIBRARY_PATH (eg: /usr/lib64/alsa-lib)
* 2) Create a ~/.asounrc file base on following template
@@ -25,7 +25,7 @@
* # ctlLabel {numid integer name "Alsa Ctl Name"}
* MasterSwitch { numid 4 name "My_First_Control" }
* MasterVol { numid 5 name "My_Second_Control" }
- * CB_sample { ctlcb @AfbHalSampleCB name "My_Sample_Callback"}
+ * CB_sample { ctlcb @AfbHalSampleCB name "My_Sample_Callback"}
* }
* pcm.agl_hal {
* type copy # Copy PCM
@@ -109,7 +109,7 @@ static int AfbHalGetIntInfo(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *imi
if (elemInfo) {
- // Should be normalised to make everything 0-100%
+ // Should be normalised to make everything 0-100%
*imin = (long) snd_ctl_elem_info_get_min(elemInfo);
*imax = (long) snd_ctl_elem_info_get_min(elemInfo);
*istep = (long) snd_ctl_elem_info_get_min(elemInfo);
diff --git a/Alsa-Plugin/_Alsa-Hal-plugin/CMakeLists.txt b/Alsa-Plugin/_Alsa-Hal-plugin/CMakeLists.txt
index 93642b2..90ee5a3 100644
--- a/Alsa-Plugin/_Alsa-Hal-plugin/CMakeLists.txt
+++ b/Alsa-Plugin/_Alsa-Hal-plugin/CMakeLists.txt
@@ -22,7 +22,7 @@ add_compile_options(-DPIC)
# Add target to project dependency list
PROJECT_TARGET_ADD(ctl_afbhal)
- # Define targets
+ # Define targets
ADD_LIBRARY(${TARGET_NAME} MODULE HalPlugCtl.c)
# Alsa Plugin properties
@@ -39,7 +39,7 @@ PROJECT_TARGET_ADD(ctl_afbhal)
PROJECT_TARGET_ADD(cb_sample)
- # Define targets
+ # Define targets
ADD_LIBRARY(${TARGET_NAME} MODULE HalPlugCb.c)
# Alsa Plugin properties
diff --git a/Alsa-Plugin/_Alsa-Hal-plugin/README.md b/Alsa-Plugin/_Alsa-Hal-plugin/README.md
index a0d4350..a6fc90d 100644
--- a/Alsa-Plugin/_Alsa-Hal-plugin/README.md
+++ b/Alsa-Plugin/_Alsa-Hal-plugin/README.md
@@ -1,4 +1,4 @@
-Hal-Plugin
+Hal-Plugin
Object: Add virtual soft control to sound card
Status: Proof of concept and not a usable product
@@ -24,7 +24,7 @@ cat ~/.asoundrc
# ctlLabel {numid integer name "Alsa Ctl Name"}
MasterSwitch { numid 4 name "My_First_Control" }
MasterVol { numid 5 name "My_Second_Control" }
- CB_sample { ctlcb @AfbHalSampleCB name "My_Sample_Callback"}
+ CB_sample { ctlcb @AfbHalSampleCB name "My_Sample_Callback"}
}
pcm.agl_hal {
type copy # Copy PCM
diff --git a/Alsa-afb/Alsa-AddCtl.c b/Alsa-afb/Alsa-AddCtl.c
index f7ef92e..44de782 100644
--- a/Alsa-afb/Alsa-AddCtl.c
+++ b/Alsa-afb/Alsa-AddCtl.c
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* References:
* https://kernel.readthedocs.io/en/sphinx-samples/writing-an-alsa-driver.html#control-names
* https://01.org/linuxgraphics/gfx-docs/drm/sound/designs/control-names.html
@@ -287,7 +287,7 @@ UpdateDefaultVal:
goto DoNotUpdate;
}
- // write a default null TLV (if usefull should be implemented for every ctl type)
+ // write a default null TLV (if usefull should be implemented for every ctl type)
if (elemTlv) {
err = snd_ctl_elem_tlv_write(ctlDev, elemId, elemTlv);
if (err < 0) {
diff --git a/Alsa-afb/Alsa-ApiHat.h b/Alsa-afb/Alsa-ApiHat.h
index b05cfbe..bd70740 100644
--- a/Alsa-afb/Alsa-ApiHat.h
+++ b/Alsa-afb/Alsa-ApiHat.h
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-
+
#ifndef ALSALIBMAPPING_H
#define ALSALIBMAPPING_H
@@ -57,12 +57,12 @@ PUBLIC void alsaSetCtls(struct afb_req request);
// AlsaUseCase exports
-PUBLIC void alsaUseCaseQuery(struct afb_req request);
-PUBLIC void alsaUseCaseSet(struct afb_req request);
-PUBLIC void alsaUseCaseGet(struct afb_req request);
-PUBLIC void alsaUseCaseClose(struct afb_req request);
-PUBLIC void alsaUseCaseReset(struct afb_req request);
-PUBLIC void alsaAddCustomCtls(struct afb_req request);
+PUBLIC void alsaUseCaseQuery(struct afb_req request);
+PUBLIC void alsaUseCaseSet(struct afb_req request);
+PUBLIC void alsaUseCaseGet(struct afb_req request);
+PUBLIC void alsaUseCaseClose(struct afb_req request);
+PUBLIC void alsaUseCaseReset(struct afb_req request);
+PUBLIC void alsaAddCustomCtls(struct afb_req request);
// AlsaRegEvt
PUBLIC void alsaEvtSubcribe (struct afb_req request);
diff --git a/Alsa-afb/Alsa-RegEvt.c b/Alsa-afb/Alsa-RegEvt.c
index 080b6cc..41db207 100644
--- a/Alsa-afb/Alsa-RegEvt.c
+++ b/Alsa-afb/Alsa-RegEvt.c
@@ -92,7 +92,7 @@ STATIC int sndCtlEventCB(sd_event_source* src, int fd, uint32_t revents, void* u
if ((revents & EPOLLIN) != 0) {
- // initialise event structure on stack
+ // initialise event structure on stack
snd_ctl_event_alloca(&eventId);
snd_ctl_elem_id_alloca(&elemId);
@@ -222,11 +222,11 @@ PUBLIC void alsaEvtSubcribe(afb_req request) {
goto OnErrorExit;
}
- // everything looks OK let's move forward
+ // everything looks OK let's move forward
idx = idxFree;
}
- // subscribe to binder event
+ // subscribe to binder event
err = afb_req_subscribe(request, evtHandle->afbevt);
if (err != 0) {
afb_req_fail_f(request, "register-eventname", "Cannot subscribe binder event name=%s [invalid channel]", queryValues.devid);
@@ -277,7 +277,7 @@ STATIC json_object *alsaProbeCardId(afb_req request) {
shortname = snd_ctl_card_info_get_name(cardinfo);
longname = snd_ctl_card_info_get_longname(cardinfo);
- // check if short|long name match
+ // check if short|long name match
if (!strcmp(sndname, ctlName)) break;
if (!strcmp(sndname, shortname)) break;
if (!strcmp(sndname, longname)) break;
@@ -288,7 +288,7 @@ STATIC json_object *alsaProbeCardId(afb_req request) {
goto OnErrorExit;
}
- // proxy ctlevent as a binder event
+ // proxy ctlevent as a binder event
responseJ = json_object_new_object();
json_object_object_add(responseJ, "index", json_object_new_int(index));
json_object_object_add(responseJ, "devid", json_object_new_string(devid));
@@ -361,7 +361,7 @@ PUBLIC void alsaRegisterHal(afb_req request) {
goto OnErrorExit;
}
- // alsaGetCardId should be check to register only valid card
+ // alsaGetCardId should be check to register only valid card
responseJ = alsaProbeCardId(request);
if (responseJ) {
json_object *tmpJ;
diff --git a/Alsa-afb/Alsa-SetGet.c b/Alsa-afb/Alsa-SetGet.c
index 04f2929..7450944 100644
--- a/Alsa-afb/Alsa-SetGet.c
+++ b/Alsa-afb/Alsa-SetGet.c
@@ -36,7 +36,7 @@ PUBLIC void NumidsListParse(ActionSetGetT action, queryValuesT *queryValues, ctl
ctlRequest[idx].used = 0;
ctlRequest[idx].valuesJ = NULL;
- // when only one NUMID is provided it might not be encapsulated in a JSON array
+ // when only one NUMID is provided it might not be encapsulated in a JSON array
if (json_type_array == json_object_get_type(queryValues->numidsJ)) ctlRequest[idx].jToken = json_object_array_get_idx(queryValues->numidsJ, idx);
else ctlRequest[idx].jToken = queryValues->numidsJ;
@@ -438,7 +438,7 @@ PUBLIC int alsaSetSingleCtl(snd_ctl_t *ctlDev, snd_ctl_elem_id_t *elemId, ctlReq
snd_ctl_elem_info_t *elemInfo;
int count, length, err, valueIsArray = 0;
- // let's make sure we are processing the right control
+ // let's make sure we are processing the right control
if (ctlRequest->numId != snd_ctl_elem_id_get_numid(elemId)) goto OnErrorExit;
// set info event ID and get value
@@ -720,7 +720,7 @@ STATIC void alsaSetGetCtls(ActionSetGetT action, afb_req request) {
int jdx;
if (queryValues.count == 0 && action == ACTION_GET) {
- selected = 1; // check is this numid is selected within query
+ selected = 1; // check is this numid is selected within query
jdx = ctlIndex; // map all existing ctl as requested
} else {
int numid = snd_ctl_elem_list_get_numid(ctlList, ctlIndex);
@@ -737,7 +737,7 @@ STATIC void alsaSetGetCtls(ActionSetGetT action, afb_req request) {
}
}
- // control is selected open ctlid and get value
+ // control is selected open ctlid and get value
if (selected) {
snd_ctl_elem_id_t *elemId;
snd_ctl_elem_id_alloca(&elemId);
diff --git a/Alsa-afb/Alsa-Ucm.c b/Alsa-afb/Alsa-Ucm.c
index 016fe10..0bfffc9 100644
--- a/Alsa-afb/Alsa-Ucm.c
+++ b/Alsa-afb/Alsa-Ucm.c
@@ -19,8 +19,8 @@
https://www.alsa-project.org/main/index.php/DAPM
http://alsa-lib.sourcearchive.com/documentation/1.0.24.1-2/group__Use_ga4332c6bb50481bbdaf21be11551fb930.html
https://android.googlesource.com/platform/hardware/qcom/audio/+/jb-mr1-dev/libalsa-intf/alsa_ucm.h
-
- Sample alsaucm commands using /usr/share/alsa/ucm/PandaBoard
+
+ Sample alsaucm commands using /usr/share/alsa/ucm/PandaBoard
- alsaucm -c PandaBoard list _verbs
- alsaucm -c PandaBoard list _devices/HiFi
- alsaucm -c PandaBoard list _modifiers/HiFi #need to uncomment modifiers section
@@ -49,7 +49,7 @@ typedef struct {
static ucmHandleT ucmHandles[MAX_SND_CARD];
-// Cache opened UCM handles
+// Cache opened UCM handles
STATIC int alsaUseCaseOpen(struct afb_req request, queryValuesT *queryValues, int allowNewMgr) {
snd_ctl_t *ctlDev;
diff --git a/Alsa-afb/CMakeLists.txt b/Alsa-afb/CMakeLists.txt
index fab49ae..a608a80 100644
--- a/Alsa-afb/CMakeLists.txt
+++ b/Alsa-afb/CMakeLists.txt
@@ -31,8 +31,8 @@ PROJECT_TARGET_ADD(alsa-lowlevel)
)
# Library dependencies (include updates automatically)
- TARGET_LINK_LIBRARIES(${TARGET_NAME}
- audio-common
+ TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ audio-common
${link_libraries}
)
diff --git a/Audio-Common/audio-common.c b/Audio-Common/audio-common.c
index ae41dde..b75cd9b 100644
--- a/Audio-Common/audio-common.c
+++ b/Audio-Common/audio-common.c
@@ -13,13 +13,13 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
#define _GNU_SOURCE // needed for vasprintf
#include "audio-common.h"
PUBLIC const char *halCtlsLabels[] = {
-
+
[Master_Playback_Volume] = "Master_Playback_Volume",
[Master_OnOff_Switch] = "Master_OnOff_Switch",
[Master_Playback_Ramp]= "Master_Playback_Ramp",
@@ -27,30 +27,30 @@ PUBLIC const char *halCtlsLabels[] = {
[PCM_Playback_Switch] = "PCM_Playback_Switch",
[Capture_Volume] = "Capture_Volume",
- [Vol_Ramp_Set_Mode] = "Volume_Ramp_Mode",
- [Vol_Ramp_Set_Delay] = "Volume_Ramp_Delay",
- [Vol_Ramp_Set_Down] = "Volume_Ramp_Down",
- [Vol_Ramp_Set_Up] = "Volume_Ramp_Up",
- [Vol_Ramp_Set_Slave] = "Volume_Ramp_Slave",
-
+ [Vol_Ramp_Set_Mode] = "Volume_Ramp_Mode",
+ [Vol_Ramp_Set_Delay] = "Volume_Ramp_Delay",
+ [Vol_Ramp_Set_Down] = "Volume_Ramp_Down",
+ [Vol_Ramp_Set_Up] = "Volume_Ramp_Up",
+ [Vol_Ramp_Set_Slave] = "Volume_Ramp_Slave",
+
// Application Virtual Channels
- [Multimedia_Playback_Volume] = "Multimedia_Playback_Volume",
+ [Multimedia_Playback_Volume] = "Multimedia_Playback_Volume",
[Navigation_Playback_Volume] = "Navigation_Playback_Volume",
- [Emergency_Playback_Volume] = "Emergency_Playback_Volume",
+ [Emergency_Playback_Volume] = "Emergency_Playback_Volume",
- // Do not remove EndHalCrlTag
+ // Do not remove EndHalCrlTag
[EndHalCrlTag] = NULL
};
PUBLIC const char *halVolRampModes[] = {
-
+
[RAMP_VOL_NONE] = "None",
[RAMP_VOL_NORMAL] = "Normal",
[RAMP_VOL_SMOOTH] = "Smooth",
[RAMP_VOL_EMERGENCY] = "Emergency",
-
+
[EndHalVolMod] = NULL,
-
+
};
PUBLIC void pingtest(struct afb_req request) {
diff --git a/Audio-Common/audio-common.h b/Audio-Common/audio-common.h
index c61b07f..82ada36 100644
--- a/Audio-Common/audio-common.h
+++ b/Audio-Common/audio-common.h
@@ -13,10 +13,10 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- * reference:
+ *
+ * reference:
* amixer contents; amixer controls;
- * http://www.tldp.org/HOWTO/Alsa-sound-6.html
+ * http://www.tldp.org/HOWTO/Alsa-sound-6.html
*/
#ifndef AUDIO_INTERF_H
@@ -41,10 +41,10 @@
#define CTL_AUTO -1
typedef enum {
- QUERY_QUIET =0,
- QUERY_COMPACT =1,
- QUERY_VERBOSE =2,
- QUERY_FULL =3,
+ QUERY_QUIET =0,
+ QUERY_COMPACT =1,
+ QUERY_VERBOSE =2,
+ QUERY_FULL =3,
} halQueryMode;
// Most controls are MIXER but some vendor specific are possible
@@ -68,12 +68,12 @@ typedef enum {
StartHalCrlTag=0,
// volume RAMP
- Vol_Ramp_Set_Mode,
- Vol_Ramp_Set_Delay,
- Vol_Ramp_Set_Down,
- Vol_Ramp_Set_Up,
- Vol_Ramp_Set_Slave,
-
+ Vol_Ramp_Set_Mode,
+ Vol_Ramp_Set_Delay,
+ Vol_Ramp_Set_Down,
+ Vol_Ramp_Set_Up,
+ Vol_Ramp_Set_Slave,
+
// HighLevel Audio Control List,
Master_Playback_Volume,
Master_Playback_Ramp,
@@ -81,12 +81,12 @@ typedef enum {
PCM_Playback_Switch,
Capture_Volume,
Master_OnOff_Switch,
-
+
// Application Virtual Channels
- Multimedia_Playback_Volume,
- Navigation_Playback_Volume,
- Emergency_Playback_Volume,
-
+ Multimedia_Playback_Volume,
+ Navigation_Playback_Volume,
+ Emergency_Playback_Volume,
+
EndHalCrlTag // used to compute number of ctls
} halCtlsTagT;
@@ -96,9 +96,9 @@ typedef enum {
RAMP_VOL_NORMAL = 1,
RAMP_VOL_SMOOTH = 2,
RAMP_VOL_EMERGENCY = 3,
-
+
EndHalVolMod
-
+
} halRampEnumT;
PUBLIC void pingtest(struct afb_req request);
diff --git a/HAL-afb/HAL-interface/CMakeLists.txt b/HAL-afb/HAL-interface/CMakeLists.txt
index 37d82de..bbe2e94 100644
--- a/HAL-afb/HAL-interface/CMakeLists.txt
+++ b/HAL-afb/HAL-interface/CMakeLists.txt
@@ -20,7 +20,7 @@
# Add target to project dependency list
PROJECT_TARGET_ADD(hal-interface)
- # Define targets
+ # Define targets
ADD_LIBRARY(${TARGET_NAME} STATIC hal-volume.c hal-volramp.c hal-interface.c)
# Library properties
@@ -30,7 +30,7 @@ PROJECT_TARGET_ADD(hal-interface)
TARGET_LINK_LIBRARIES(${TARGET_NAME}
audio-common
)
-
+
# Define target includes
TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/HAL-afb/HAL-interface/hal-interface.c b/HAL-afb/HAL-interface/hal-interface.c
index 0abe67e..ad5eabb 100644
--- a/HAL-afb/HAL-interface/hal-interface.c
+++ b/HAL-afb/HAL-interface/hal-interface.c
@@ -13,10 +13,10 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- * reference:
+ *
+ * reference:
* amixer contents; amixer controls;
- * http://www.tldp.org/HOWTO/Alsa-sound-6.html
+ * http://www.tldp.org/HOWTO/Alsa-sound-6.html
*/
#define _GNU_SOURCE // needed for vasprintf
#include <string.h>
@@ -553,7 +553,7 @@ PUBLIC int halServiceInit(const char *apiPrefix, alsaHalSndCardT *alsaHalSndCard
}
}
- // Make sure response is valid
+ // Make sure response is valid
json_object_object_get_ex(responseJ, "response", &ctlsJ);
if (json_object_get_type(ctlsJ) != json_type_array) {
AFB_ERROR("Response Invalid JSON array ctls Response='%s'", json_object_get_string(responseJ));
@@ -587,7 +587,7 @@ OnErrorExit:
};
-// This receive all event this binding subscribe to
+// This receive all event this binding subscribe to
PUBLIC void halServiceEvent(const char *evtname, json_object *eventJ) {
int numid;
diff --git a/HAL-afb/HAL-interface/hal-volramp.c b/HAL-afb/HAL-interface/hal-volramp.c
index eb39aae..60e91d6 100644
--- a/HAL-afb/HAL-interface/hal-volramp.c
+++ b/HAL-afb/HAL-interface/hal-volramp.c
@@ -13,7 +13,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
#define _GNU_SOURCE // needed for vasprintf
@@ -36,14 +36,14 @@ STATIC int RampTimerCB(sd_event_source* source, uint64_t timer, void* handle) {
if (volRamp->current > volRamp->target) volRamp->current = volRamp->target;
}
- // request current Volume Level
+ // request current Volume Level
err = halSetCtlByTag(volRamp->slave, volRamp->current);
if (err) goto OnErrorExit;
// we reach target stop volram event
if (volRamp->current == volRamp->target) sd_event_source_unref(source);
else {
- // otherwise validate timer for a new run
+ // otherwise validate timer for a new run
sd_event_now(afb_daemon_get_event_loop(), CLOCK_MONOTONIC, &usec);
sd_event_source_set_enabled(source, SD_EVENT_ONESHOT);
err = sd_event_source_set_time(source, usec + volRamp->delay);
@@ -60,8 +60,8 @@ OnErrorExit:
STATIC void SetRampTimer(void *handle) {
halVolRampT *volRamp = (halVolRampT*) handle;
uint64_t usec;
-
- // set a timer with ~250us accuracy
+
+ // set a timer with ~250us accuracy
sd_event_now(afb_daemon_get_event_loop(), CLOCK_MONOTONIC, &usec);
sd_event_add_time(afb_daemon_get_event_loop(), &volRamp->evtsrc, CLOCK_MONOTONIC, usec, 250, RampTimerCB, volRamp);
}
@@ -69,7 +69,7 @@ STATIC void SetRampTimer(void *handle) {
STATIC int volumeDoRamp(halVolRampT *volRamp, int numid, json_object *volumeJ) {
json_object *responseJ;
- // request current Volume Level
+ // request current Volume Level
responseJ = halGetCtlByTag(volRamp->slave);
if (!responseJ) {
AFB_WARNING("volumeDoRamp Fail to get HAL ctl tag=%d", Master_Playback_Volume);
diff --git a/HAL-afb/HAL-interface/hal-volume.c b/HAL-afb/HAL-interface/hal-volume.c
index ad2b9a1..997ce98 100644
--- a/HAL-afb/HAL-interface/hal-volume.c
+++ b/HAL-afb/HAL-interface/hal-volume.c
@@ -13,8 +13,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- * references:
+ *
+ * references:
* alsa-util/amixer.c + alsa-lib/simple.c
* snd_tlv_convert_from_dB
* nt snd_tlv_convert_to_dB
@@ -80,7 +80,7 @@ PUBLIC json_object *volumeNormalise(ActionSetGetT action, const alsaHalCtlMapT *
} else { // db_scale looks OK let's use it
if ((halCtls->dbscale->max - halCtls->dbscale->min) <= MAX_LINEAR_DB_SCALE * 100) useNormalizeDB = NORMALIZE_DB_LINEAR;
- else useNormalizeDB = NORMALIZE_LINEAR; // Fulup not sure how to handle this useNormalizeDB=NORMALIZE_DB_MATH;
+ else useNormalizeDB = NORMALIZE_LINEAR; // Fulup not sure how to handle this useNormalizeDB=NORMALIZE_DB_MATH;
}
} else useNormalizeDB = NORMALIZE_NONE;
diff --git a/HAL-afb/HAL_MOST_UNICENS/CMakeLists.txt b/HAL-afb/HAL_MOST_UNICENS/CMakeLists.txt
index eb4d1d6..5935b72 100644
--- a/HAL-afb/HAL_MOST_UNICENS/CMakeLists.txt
+++ b/HAL-afb/HAL_MOST_UNICENS/CMakeLists.txt
@@ -33,7 +33,7 @@ PROJECT_TARGET_ADD(hal-most-unicens)
)
# Library dependencies (include updates automatically)
- TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ TARGET_LINK_LIBRARIES(${TARGET_NAME}
hal-interface
audio-common
ucs2-volume
diff --git a/HAL-afb/HAL_MOST_UNICENS/README.md b/HAL-afb/HAL_MOST_UNICENS/README.md
index a0cc190..4ce4261 100644
--- a/HAL-afb/HAL_MOST_UNICENS/README.md
+++ b/HAL-afb/HAL_MOST_UNICENS/README.md
@@ -42,7 +42,7 @@ card 2: ep022ch [Microchip MOST:2], device 0: ep02-2ch []
Subdevice #0: subdevice #0
```
-Choose the first sound card with 6 channels, e.g. if you see ```ep01-6ch``` just
+Choose the first sound card with 6 channels, e.g. if you see ```ep01-6ch``` just
take ```Microchip MOST:1```.
If you get messed up with card enumeration the following action may help:
diff --git a/HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c b/HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c
index 4405e61..2eb96b8 100644
--- a/HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c
+++ b/HAL-afb/HAL_MOST_UNICENS/hal_most_unicens.c
@@ -13,9 +13,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
-#define _GNU_SOURCE
+#define _GNU_SOURCE
#include <string.h>
#include "hal-interface.h"
#include "audio-common.h"
@@ -37,32 +37,32 @@ static int pcm_volume[PCM_MAX_CHANNELS];
void unicens_master_vol_cb(halCtlsTagT tag, alsaHalCtlMapT *control, void* handle, json_object *j_obj) {
const char *j_str = json_object_to_json_string(j_obj);
-
+
if (wrap_json_unpack(j_obj, "[i!]", &master_volume) == 0) {
AFB_NOTICE("master_volume: %s, value=%d", j_str, master_volume);
wrap_volume_master(master_volume);
}
else {
AFB_NOTICE("master_volume: INVALID STRING %s", j_str);
- }
+ }
}
void unicens_master_switch_cb(halCtlsTagT tag, alsaHalCtlMapT *control, void* handle, json_object *j_obj) {
const char *j_str = json_object_to_json_string(j_obj);
-
+
if (wrap_json_unpack(j_obj, "[b!]", &master_switch) == 0) {
AFB_NOTICE("master_switch: %s, value=%d", j_str, master_switch);
}
else {
AFB_NOTICE("master_switch: INVALID STRING %s", j_str);
- }
+ }
}
void unicens_pcm_vol_cb(halCtlsTagT tag, alsaHalCtlMapT *control, void* handle, json_object *j_obj) {
const char *j_str = json_object_to_json_string(j_obj);
-
+
if (wrap_json_unpack(j_obj, "[iiiiii!]", &pcm_volume[0], &pcm_volume[1], &pcm_volume[2], &pcm_volume[3],
&pcm_volume[4], &pcm_volume[5]) == 0) {
AFB_NOTICE("pcm_vol: %s", j_str);
@@ -74,15 +74,15 @@ void unicens_pcm_vol_cb(halCtlsTagT tag, alsaHalCtlMapT *control, void* handle,
}
/* declare ALSA mixer controls */
-STATIC alsaHalMapT alsaHalMap[]= {
+STATIC alsaHalMapT alsaHalMap[]= {
{ .tag=Master_Playback_Volume, .cb={.callback=unicens_master_vol_cb, .handle=&master_volume}, .info="Sets master playback volume",
- .ctl={.numid=1, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=1, .minval=0, .maxval=100, .step=1, .value=50, .name="Master Playback Volume"}
+ .ctl={.numid=1, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=1, .minval=0, .maxval=100, .step=1, .value=50, .name="Master Playback Volume"}
},
/*{ .tag=Master_OnOff_Switch, .cb={.callback=unicens_master_switch_cb, .handle=&master_switch}, .info="Sets master playback switch",
- .ctl={.numid=2, .type=SND_CTL_ELEM_TYPE_BOOLEAN, .count=1, .minval=0, .maxval=1, .step=1, .value=1, .name="Master Playback Switch"}
+ .ctl={.numid=2, .type=SND_CTL_ELEM_TYPE_BOOLEAN, .count=1, .minval=0, .maxval=1, .step=1, .value=1, .name="Master Playback Switch"}
},*/
{ .tag=PCM_Playback_Volume, .cb={.callback=unicens_pcm_vol_cb, .handle=&pcm_volume}, .info="Sets PCM playback volume",
- .ctl={.numid=3, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=6, .minval=0, .maxval=100, .step=1, .value=100, .name="PCM Playback Volume"}
+ .ctl={.numid=3, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=6, .minval=0, .maxval=100, .step=1, .value=100, .name="PCM Playback Volume"}
},
{ .tag=EndHalCrlTag} /* marker for end of the array */
} ;
@@ -100,19 +100,19 @@ STATIC int unicens_service_init() {
int err = 0;
char *config_file = NULL;
AFB_NOTICE("Initializing HAL-MOST-UNICENS-BINDING");
-
+
err = halServiceInit(afbBindingV2.api, &alsaHalSndCard);
if (err) {
AFB_ERROR("Cannot initialize ALSA soundcard.");
goto OnErrorExit;
- }
-
+ }
+
err= afb_daemon_require_api("UNICENS", 1);
if (err) {
AFB_ERROR("Failed to access UNICENS API");
goto OnErrorExit;
}
-
+
err = wrap_ucs_getconfig_sync(UCS2_CFG_PATH, &config_file);
if (err || (config_file == NULL)) {
AFB_ERROR("Failed to retrieve configuration");
@@ -121,46 +121,46 @@ STATIC int unicens_service_init() {
else {
AFB_NOTICE("Found configuration: %s", config_file);
}
-
+
err = wrap_ucs_subscribe_sync();
if (err) {
AFB_ERROR("Failed to subscribe to UNICENS binding");
goto OnErrorExit;
}
-
+
err = wrap_ucs_initialize_sync(config_file);
free(config_file);
config_file = NULL;
-
+
if (err) {
AFB_ERROR("Failed to initialize UNICENS binding");
goto OnErrorExit;
}
-
+
err = wrap_volume_init();
if (err) {
AFB_ERROR("Failed to initialize wrapper for volume library");
goto OnErrorExit;
}
-
+
OnErrorExit:
AFB_NOTICE("Initializing HAL-MOST-UNICENS-BINDING done..");
return err;
}
-// This receive all event this binding subscribe to
+// This receive all event this binding subscribe to
PUBLIC void unicens_event_cb(const char *evtname, json_object *j_event) {
-
+
if (strncmp(evtname, "alsacore/", 9) == 0) {
halServiceEvent(evtname, j_event);
return;
}
-
+
if (strncmp(evtname, "UNICENS/", 8) == 0) {
AFB_NOTICE("unicens_event_cb: evtname=%s [msg=%s]", evtname, json_object_get_string(j_event));
return;
}
-
+
AFB_NOTICE("unicens_event_cb: UNHANDLED EVENT, evtname=%s [msg=%s]", evtname, json_object_get_string(j_event));
}
diff --git a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/CMakeLists.txt b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/CMakeLists.txt
index 8735677..c734639 100644
--- a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/CMakeLists.txt
+++ b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/CMakeLists.txt
@@ -18,7 +18,7 @@
-# Define subproject targets
+# Define subproject targets
ADD_SUBDIRECTORY(src)
diff --git a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/inc/device_value.h b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/inc/device_value.h
index 21fdbdc..5364662 100644
--- a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/inc/device_value.h
+++ b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/inc/device_value.h
@@ -69,7 +69,7 @@ public:
bool RequiresUpdate(); // returns true if target is not actual value
// returns true if success, false if failed
// -> stop transmission
- bool FireUpdateMessage(lib_most_volume_writei2c_cb_t writei2c_fptr,
+ bool FireUpdateMessage(lib_most_volume_writei2c_cb_t writei2c_fptr,
lib_most_volume_writei2c_result_cb_t result_fptr,
void *result_user_ptr);// fires message & updates actual value
diff --git a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/inc/libmostvolume.h b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/inc/libmostvolume.h
index 1d7249d..94d5a1c 100644
--- a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/inc/libmostvolume.h
+++ b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/inc/libmostvolume.h
@@ -60,13 +60,13 @@ typedef void (*lib_most_volume_writei2c_result_cb_t)(uint8_t result, void *user_
* \return Returns \c 0 for success, other value on failure.
*/
typedef int (*lib_most_volume_writei2c_cb_t)(uint16_t node, uint8_t *data_ptr, uint8_t data_sz,
- lib_most_volume_writei2c_result_cb_t result_fptr,
+ lib_most_volume_writei2c_result_cb_t result_fptr,
void *result_user_ptr);
typedef struct lib_most_volume_init_ {
lib_most_volume_service_cb_t service_cb;
lib_most_volume_writei2c_cb_t writei2c_cb;
-
+
} lib_most_volume_init_t;
diff --git a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/device_container.cpp b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/device_container.cpp
index cef25b1..40177fc 100644
--- a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/device_container.cpp
+++ b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/device_container.cpp
@@ -112,7 +112,7 @@ void CDeviceContainer::Update()
{
return;
}
-
+
for (cnt = 0u; cnt < this->_values_sz; cnt++) /* just run one cycle */
{
IncrementProcIndex();
diff --git a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/device_value.cpp b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/device_value.cpp
index b8c681e..5a74354 100644
--- a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/device_value.cpp
+++ b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/device_value.cpp
@@ -93,14 +93,14 @@ bool CDeviceValue::RequiresUpdate()
return false;
}
-bool CDeviceValue::FireUpdateMessage(lib_most_volume_writei2c_cb_t writei2c_fptr,
+bool CDeviceValue::FireUpdateMessage(lib_most_volume_writei2c_cb_t writei2c_fptr,
lib_most_volume_writei2c_result_cb_t result_fptr,
void *result_user_ptr)
{
int ret;
ApplyMostValue(this->_target_value, _type, _tx_payload);
- ret = writei2c_fptr(this->_address, &_tx_payload[0], _tx_payload_sz,
+ ret = writei2c_fptr(this->_address, &_tx_payload[0], _tx_payload_sz,
result_fptr,
result_user_ptr);
diff --git a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/libmostvolume.cpp b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/libmostvolume.cpp
index a90b5b1..72d2b04 100644
--- a/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/libmostvolume.cpp
+++ b/HAL-afb/HAL_MOST_UNICENS/ucs2-vol/src/libmostvolume.cpp
@@ -72,7 +72,7 @@ extern "C" uint8_t lib_most_volume_set(enum lib_most_volume_channel_t channel, u
}
extern "C" uint8_t lib_most_volume_service(void)
-{
+{
uint8_t success = 1U;
/*std::cerr << "lib_most_volume_service(): called" << std::endl;*/
@@ -81,6 +81,6 @@ extern "C" uint8_t lib_most_volume_service(void)
CSetup::GetInstance()->Update();
success = 0U;
}
-
+
return success;
}
diff --git a/HAL-afb/HAL_MOST_UNICENS/wrap_unicens.c b/HAL-afb/HAL_MOST_UNICENS/wrap_unicens.c
index dc82568..0923c26 100644
--- a/HAL-afb/HAL_MOST_UNICENS/wrap_unicens.c
+++ b/HAL-afb/HAL_MOST_UNICENS/wrap_unicens.c
@@ -13,9 +13,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
-#define _GNU_SOURCE
+#define _GNU_SOURCE
#define AFB_BINDING_VERSION 2
#include <string.h>
@@ -31,24 +31,24 @@ typedef struct async_job_ {
typedef struct parse_result_ {
int done;
- char *str_result;
-} parse_result_t;
+ char *str_result;
+} parse_result_t;
/* Subscribes to unicens2-binding events.
* \return Returns 0 if successful, otherwise != 0".
*/
extern int wrap_ucs_subscribe_sync() {
-
+
json_object *j_response, *j_query = NULL;
int err;
-
+
/* Build an empty JSON object */
err = wrap_json_pack(&j_query, "{}");
if (err) {
AFB_ERROR("Failed to create subscribe json object");
- goto OnErrorExit;
+ goto OnErrorExit;
}
-
+
err = afb_service_call_sync("UNICENS", "subscribe", j_query, &j_response);
if (err) {
AFB_ERROR("Fail subscribing to UNICENS events");
@@ -60,7 +60,7 @@ extern int wrap_ucs_subscribe_sync() {
}
json_object_put(j_query);
j_query = NULL;
-
+
OnErrorExit:
if (j_query)
json_object_put(j_query);
@@ -69,52 +69,52 @@ OnErrorExit:
/* Checks if name ends with a given letter. */
static int wrap_ucs_string_ends_with(const char *name, char letter) {
-
+
int result = 0;
size_t len = strlen(name);
-
+
if (len > 0) {
-
+
if (name[len] == letter) {
result = 1;
}
}
-
+
return result;
}
/* Callback for iteration through found files. Marks search as "done" as
- * soon as the search pattern "kit.xml" matches.
+ * soon as the search pattern "kit.xml" matches.
* \param closure User reference. Points to parse_result_t.
* \param j_obj Points to json object within array.
*/
static void wrap_ucs_find_xml_cb(void *closure, struct json_object *j_obj) {
-
+
const char *dir, *name;
parse_result_t *result;
-
+
if (!closure)
return;
-
- result = (parse_result_t *)closure;
+
+ result = (parse_result_t *)closure;
if (result->done)
return;
-
+
wrap_json_unpack(j_obj, "{s:s, s:s}", "dirpath", &dir, "basename", &name);
AFB_DEBUG("Found file: %s", name);
-
+
if(strstr(name, "kit.xml") != NULL) {
size_t sz = strlen(dir)+strlen(name)+10;
char * full_path = malloc(sz);
-
+
strncpy(full_path, dir, sz);
-
+
if (!wrap_ucs_string_ends_with(dir, '/'))
strncat(full_path, "/", sz);
-
+
strncat(full_path, name, sz);
AFB_DEBUG("Found XML file: %s", full_path);
-
+
result->done = 1;
result->str_result = full_path;
}
@@ -127,24 +127,24 @@ static void wrap_ucs_find_xml_cb(void *closure, struct json_object *j_obj) {
* \return Returns 0 if successful, otherwise != 0".
*/
extern int wrap_ucs_getconfig_sync(const char *config_path, char **file_found) {
-
+
int err = 0;
json_object *j_response, *j_query, *j_paths = NULL;
parse_result_t result = {.done = 0, .str_result = NULL};
-
+
*file_found = NULL;
-
+
/* Build JSON object to retrieve UNICENS configuration */
if ((config_path == NULL) || (strcmp(config_path, "") == 0))
err = wrap_json_pack(&j_query, "{}");
else
err = wrap_json_pack(&j_query, "{s:s}", "cfgpath", config_path);
-
+
if (err) {
AFB_ERROR("Failed to create listconfig json object");
- goto OnErrorExit;
+ goto OnErrorExit;
}
-
+
err = afb_service_call_sync("UNICENS", "listconfig", j_query, &j_response);
if (err) {
AFB_ERROR("Failed to call listconfig");
@@ -152,13 +152,13 @@ extern int wrap_ucs_getconfig_sync(const char *config_path, char **file_found) {
}
else {
AFB_DEBUG("UNICENS listconfig result, res=%s", json_object_to_json_string(j_response));
-
+
if (json_object_object_get_ex(j_response, "response", &j_paths)) {
-
+
AFB_DEBUG("UNICENS listconfig result, paths=%s", json_object_to_json_string(j_paths));
-
+
wrap_json_optarray_for_all(j_paths, &wrap_ucs_find_xml_cb, &result);
-
+
if (result.done) {
*file_found = strdup(result.str_result);
free(result.str_result);
@@ -169,12 +169,12 @@ extern int wrap_ucs_getconfig_sync(const char *config_path, char **file_found) {
err = -1;
}
}
-
+
json_object_put(j_response);
}
json_object_put(j_query);
j_query = NULL;
-
+
OnErrorExit:
if (j_query)
json_object_put(j_query);
@@ -183,22 +183,22 @@ OnErrorExit:
/* Initializes the unicens2-binding.
* \param file_name Path to XML configuration file or \c NULL for
- * first found file in default path.
+ * first found file in default path.
* \return Returns 0 if successful, otherwise != 0".
*/
extern int wrap_ucs_initialize_sync(const char *file_name) {
json_object *j_response, *j_query = NULL;
int err;
-
+
/* Build JSON object to initialize UNICENS */
- if (file_name != NULL)
+ if (file_name != NULL)
err = wrap_json_pack(&j_query, "{s:s}", "filename", file_name);
else
err = wrap_json_pack(&j_query, "{}");
-
+
if (err) {
AFB_ERROR("Failed to create initialize json object");
- goto OnErrorExit;
+ goto OnErrorExit;
}
err = afb_service_call_sync("UNICENS", "initialise", j_query, &j_response);
if (err) {
@@ -209,10 +209,10 @@ extern int wrap_ucs_initialize_sync(const char *file_name) {
AFB_NOTICE("Initialized UNICENS, res=%s", json_object_to_json_string(j_response));
json_object_put(j_response);
}
-
+
json_object_put(j_query);
j_query = NULL;
-
+
OnErrorExit:
if (j_query)
json_object_put(j_query);
@@ -221,7 +221,7 @@ OnErrorExit:
/* Write I2C command to a network node.
* \param node Node address
- * \param data_ptr Reference to command data
+ * \param data_ptr Reference to command data
* \param data_sz Size of the command data. Valid values: 1..32.
* \return Returns 0 if successful, otherwise != 0".
*/
@@ -233,22 +233,22 @@ extern int wrap_ucs_i2cwrite_sync(uint16_t node, uint8_t *data_ptr, uint8_t data
j_query = json_object_new_object();
j_array = json_object_new_array();
-
+
if (!j_query || !j_array) {
err = -1;
AFB_ERROR("Failed to create writei2c json objects");
- goto OnErrorExit;
- }
-
+ goto OnErrorExit;
+ }
+
for (cnt = 0U; cnt < data_sz; cnt++) {
json_object_array_add(j_array, json_object_new_int(data_ptr[cnt]));
}
-
+
json_object_object_add(j_query, "node", json_object_new_int(node));
json_object_object_add(j_query, "data", j_array);
-
+
err = afb_service_call_sync("UNICENS", "writei2c", j_query, &j_response);
-
+
if (err) {
AFB_ERROR("Failed to call writei2c_sync");
goto OnErrorExit;
@@ -257,40 +257,40 @@ extern int wrap_ucs_i2cwrite_sync(uint16_t node, uint8_t *data_ptr, uint8_t data
AFB_INFO("Called writei2c_sync, res=%s", json_object_to_json_string(j_response));
json_object_put(j_response);
}
-
+
json_object_put(j_query);
j_query = NULL;
OnErrorExit:
if (j_query)
json_object_put(j_query);
- return err;
+ return err;
}
/* ------------------ ASYNCHRONOUS API ---------------------------------------*/
static void wrap_ucs_i2cwrite_cb(void *closure, int status, struct json_object *j_result) {
-
+
AFB_INFO("wrap_ucs_i2cwrite_cb: closure=%p status=%d, res=%s", closure, status, json_object_to_json_string(j_result));
-
+
if (closure) {
async_job_t *job_ptr = (async_job_t *)closure;
-
+
if (job_ptr->result_fptr)
job_ptr->result_fptr(0U, job_ptr->result_user_ptr);
-
+
free(closure);
}
}
/* Write I2C command to a network node.
* \param node Node address
- * \param data_ptr Reference to command data
+ * \param data_ptr Reference to command data
* \param data_sz Size of the command data. Valid values: 1..32.
* \return Returns 0 if successful, otherwise != 0".
*/
extern int wrap_ucs_i2cwrite(uint16_t node, uint8_t *data_ptr, uint8_t data_sz,
- wrap_ucs_result_cb_t result_fptr,
+ wrap_ucs_result_cb_t result_fptr,
void *result_user_ptr) {
json_object *j_query, *j_array = NULL;
@@ -300,31 +300,31 @@ extern int wrap_ucs_i2cwrite(uint16_t node, uint8_t *data_ptr, uint8_t data_sz,
j_query = json_object_new_object();
j_array = json_object_new_array();
-
+
if (!j_query || !j_array) {
err = -1;
AFB_ERROR("Failed to create writei2c json objects");
- goto OnErrorExit;
- }
-
+ goto OnErrorExit;
+ }
+
for (cnt = 0U; cnt < data_sz; cnt++) {
json_object_array_add(j_array, json_object_new_int(data_ptr[cnt]));
}
-
+
json_object_object_add(j_query, "node", json_object_new_int(node));
json_object_object_add(j_query, "data", j_array);
-
+
job_ptr = malloc(sizeof(async_job_t));
-
+
if (!job_ptr) {
err = -1;
AFB_ERROR("Failed to create async job object");
- goto OnErrorExit;
+ goto OnErrorExit;
}
-
+
job_ptr->result_fptr = result_fptr;
job_ptr->result_user_ptr = result_user_ptr;
-
+
afb_service_call("UNICENS", "writei2c", j_query, wrap_ucs_i2cwrite_cb, job_ptr);
err = 0;
j_query = NULL;
@@ -332,5 +332,5 @@ extern int wrap_ucs_i2cwrite(uint16_t node, uint8_t *data_ptr, uint8_t data_sz,
OnErrorExit:
if (j_query)
json_object_put(j_query);
- return err;
+ return err;
}
diff --git a/HAL-afb/HAL_MOST_UNICENS/wrap_volume.c b/HAL-afb/HAL_MOST_UNICENS/wrap_volume.c
index cf70647..8087a04 100644
--- a/HAL-afb/HAL_MOST_UNICENS/wrap_volume.c
+++ b/HAL-afb/HAL_MOST_UNICENS/wrap_volume.c
@@ -13,9 +13,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
*/
-#define _GNU_SOURCE
+#define _GNU_SOURCE
#define AFB_BINDING_VERSION 2
#include <string.h>
@@ -31,88 +31,88 @@
static int wrap_volume_service_timeout_cb(sd_event_source* source,
uint64_t timer __attribute__((__unused__)),
void *userdata __attribute__((__unused__))) {
-
+
uint8_t ret;
sd_event_source_unref(source);
ret = lib_most_volume_service();
-
+
if (ret != 0U) {
AFB_ERROR("lib_most_volume_service returns %d", ret);
}
-
+
return 0;
}
static void wrap_volume_service_cb(uint16_t timeout) {
uint64_t usec;
sd_event_now(afb_daemon_get_event_loop(), CLOCK_BOOTTIME, &usec);
- sd_event_add_time( afb_daemon_get_event_loop(), NULL, CLOCK_MONOTONIC,
- usec + (timeout*1000),
- 250,
- wrap_volume_service_timeout_cb,
+ sd_event_add_time( afb_daemon_get_event_loop(), NULL, CLOCK_MONOTONIC,
+ usec + (timeout*1000),
+ 250,
+ wrap_volume_service_timeout_cb,
NULL);
}
/* Retrieves a new value adapted to a new maximum value. Minimum value is
* always zero. */
static int wrap_volume_calculate(int value, int max_old, int max_new) {
-
+
if (value > max_old)
value = max_old;
-
+
value = (value * max_new) / max_old; /* calculate range: 0..255 */
assert(value <= max_new);
-
+
return value;
}
extern int wrap_volume_init(void) {
-
+
uint8_t ret = 0U;
lib_most_volume_init_t mv_init;
-
+
mv_init.writei2c_cb = &wrap_ucs_i2cwrite;
mv_init.service_cb = wrap_volume_service_cb;
-
+
ret = lib_most_volume_init(&mv_init);
-
+
return ret * (-1);
}
extern int wrap_volume_master(int volume) {
-
+
int new_value, ret;
-
+
new_value = wrap_volume_calculate(volume, 100, 255);
ret = lib_most_volume_set(LIB_MOST_VOLUME_MASTER, (uint8_t)new_value);
-
+
if (ret != 0) {
AFB_ERROR("wrap_volume_master: volume library not ready.");
ret = ret * (-1); /* make return value negative */
}
-
+
return ret;
}
extern int wrap_volume_pcm(int *volume_ptr, int volume_sz) {
-
+
const int MAX_PCM_CHANNELS = 6;
int cnt, ret;
assert(volume_ptr != NULL);
assert(volume_sz <= MAX_PCM_CHANNELS);
-
+
for (cnt = 0; cnt < volume_sz; cnt ++) {
-
+
int new_value = wrap_volume_calculate(volume_ptr[cnt], 100, 255);
ret = lib_most_volume_set((enum lib_most_volume_channel_t)cnt, (uint8_t)new_value);
-
+
if (ret != 0) {
AFB_ERROR("wrap_volume_pcm: volume library not ready.");
ret = ret * (-1); /* make return value negative */
break;
}
}
-
+
return ret;
}
diff --git a/HAL-afb/HDA-intel/IntelHdaHAL.c b/HAL-afb/HDA-intel/IntelHdaHAL.c
index ab822ca..e169baa 100644
--- a/HAL-afb/HDA-intel/IntelHdaHAL.c
+++ b/HAL-afb/HDA-intel/IntelHdaHAL.c
@@ -13,17 +13,17 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *
+ *
+ *
* To find out which control your sound card uses
* aplay -l # Check sndcard name name in between []
* amixer -D hw:xx controls # get supported controls
* amixer -D "hw:3" cget numid=xx # get control settings
- *
+ *
*/
-#define _GNU_SOURCE
+#define _GNU_SOURCE
#include "hal-interface.h"
-#include "audio-common.h"
+#include "audio-common.h"
// Default Values for MasterVolume Ramping
@@ -35,7 +35,7 @@ STATIC halVolRampT volRampMaster = {
.stepUp = 1,
};
-// Map HAL hight sndctl with Alsa numid and optionally with a custom callback for non Alsa supported functionalities.
+// Map HAL hight sndctl with Alsa numid and optionally with a custom callback for non Alsa supported functionalities.
STATIC alsaHalMapT alsaHalMap[] = {
{ .tag = Master_Playback_Volume, . ctl =
{ .name = "Master Playback Volume"}},
diff --git a/HAL-afb/Jabra-Solemate/CMakeLists.txt b/HAL-afb/Jabra-Solemate/CMakeLists.txt
index 41d6915..25c2626 100644
--- a/HAL-afb/Jabra-Solemate/CMakeLists.txt
+++ b/HAL-afb/Jabra-Solemate/CMakeLists.txt
@@ -32,7 +32,7 @@ PROJECT_TARGET_ADD(hal-jabra-usb)
)
# Library dependencies (include updates automatically)
- TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ TARGET_LINK_LIBRARIES(${TARGET_NAME}
hal-interface
audio-common
)
diff --git a/HAL-afb/Jabra-Solemate/JabraUsbHAL.c b/HAL-afb/Jabra-Solemate/JabraUsbHAL.c
index 7eeab90..03d53d8 100644
--- a/HAL-afb/Jabra-Solemate/JabraUsbHAL.c
+++ b/HAL-afb/Jabra-Solemate/JabraUsbHAL.c
@@ -13,18 +13,18 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *
+ *
+ *
* To find out which control your sound card uses
* aplay -l # Check sndcard name name in between []
* amixer -D hw:USB controls # get supported controls
* amixer -Dhw:USB cget name=Power-Switch
* amixer -Dhw:USB cset name=Power-Switch true
- *
+ *
*/
-#define _GNU_SOURCE
+#define _GNU_SOURCE
#include "hal-interface.h"
-#include "audio-common.h"
+#include "audio-common.h"
// Define few private tag for not standard functions
#define PCM_Volume_Multimedia 1000
@@ -61,8 +61,8 @@ STATIC halVolRampT volRampEmergency= {
.stepUp = 3,
};
-// Map HAL hight sndctl with Alsa numid and optionally with a custom callback for non Alsa supported functionalities.
-STATIC alsaHalMapT alsaHalMap[]= {
+// Map HAL hight sndctl with Alsa numid and optionally with a custom callback for non Alsa supported functionalities.
+STATIC alsaHalMapT alsaHalMap[]= {
{ .tag=Master_Playback_Volume, . ctl={.name="PCM Playback Volume" } },
{ .tag=PCM_Playback_Volume , .ctl={.name="PCM Playback Volume" } },
{ .tag=PCM_Playback_Switch , .ctl={.name="PCM Playback Switch" } },
@@ -74,7 +74,7 @@ STATIC alsaHalMapT alsaHalMap[]= {
},
// Implement Rampup Volume for Virtual Channels
- { .tag=Multimedia_Playback_Volume, .cb={.callback=volumeRamp, .handle=&volRampMultimedia}, .info="Rampup Multimedia Volume",
+ { .tag=Multimedia_Playback_Volume, .cb={.callback=volumeRamp, .handle=&volRampMultimedia}, .info="Rampup Multimedia Volume",
.ctl={.numid=CTL_AUTO, .type=SND_CTL_ELEM_TYPE_INTEGER, .name="Playback Multimedia Ramp"}
},
{ .tag=Navigation_Playback_Volume, .cb={.callback=volumeRamp, .handle=&volRampNavigation}, .info="RampUp Navigation Volume",
@@ -83,9 +83,9 @@ STATIC alsaHalMapT alsaHalMap[]= {
{ .tag=Emergency_Playback_Volume, .cb={.callback=volumeRamp, .handle=&volRampEmergency}, .info="Rampup Emergency Volume",
.ctl={.numid=CTL_AUTO, .type=SND_CTL_ELEM_TYPE_INTEGER,.name="Playback Emergency Ramp"}
},
-
+
// Sound Card does not support hardware channel volume mixer (note softvol default range 0-256)
- { .tag=PCM_Volume_Multimedia, .info="Playback Multimedia Softvol",
+ { .tag=PCM_Volume_Multimedia, .info="Playback Multimedia Softvol",
.ctl={.numid=CTL_AUTO, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=2, .maxval=255, .value=200, .name="Playback Multimedia"}
},
{ .tag=PCM_Volume_Navigation, .info="Playback Navigation Softvol",
@@ -94,8 +94,8 @@ STATIC alsaHalMapT alsaHalMap[]= {
{ .tag=PCM_Volume_Emergency, .info="Playback Emergency Softvol",
.ctl={.numid=CTL_AUTO, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=2, .maxval=255, .value=200, .name="Playback Emergency"}
},
-
-
+
+
{ .tag=EndHalCrlTag} /* marker for end of the array */
} ;
diff --git a/HAL-afb/Scarlett-Focusrite/CMakeLists.txt b/HAL-afb/Scarlett-Focusrite/CMakeLists.txt
index 90ee92a..d2a1742 100644
--- a/HAL-afb/Scarlett-Focusrite/CMakeLists.txt
+++ b/HAL-afb/Scarlett-Focusrite/CMakeLists.txt
@@ -32,7 +32,7 @@ PROJECT_TARGET_ADD(hal-scalett-usb)
)
# Library dependencies (include updates automatically)
- TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ TARGET_LINK_LIBRARIES(${TARGET_NAME}
hal-interface
audio-common
)
diff --git a/HAL-afb/Scarlett-Focusrite/ScarlettUsbHAL.c b/HAL-afb/Scarlett-Focusrite/ScarlettUsbHAL.c
index 94bfa4f..cff213c 100644
--- a/HAL-afb/Scarlett-Focusrite/ScarlettUsbHAL.c
+++ b/HAL-afb/Scarlett-Focusrite/ScarlettUsbHAL.c
@@ -13,18 +13,18 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
- *
+ *
+ *
* To find out which control your sound card uses
* aplay -l # Check sndcard name name in between []
* amixer -D hw:USB controls # get supported controls
* amixer -Dhw:USB cget name=Power-Switch
* amixer -Dhw:USB cset name=Power-Switch true
- *
+ *
*/
-#define _GNU_SOURCE
+#define _GNU_SOURCE
#include "hal-interface.h"
-#include "audio-common.h"
+#include "audio-common.h"
// Default Values for MasterVolume Ramping
STATIC halVolRampT volRampMaster= {
@@ -35,19 +35,19 @@ STATIC halVolRampT volRampMaster= {
.stepUp =1,
};
-// Map HAL hight sndctl with Alsa numid and optionally with a custom callback for non Alsa supported functionalities.
-STATIC alsaHalMapT alsaHalMap[]= {
+// Map HAL hight sndctl with Alsa numid and optionally with a custom callback for non Alsa supported functionalities.
+STATIC alsaHalMapT alsaHalMap[]= {
{ .tag=Master_Playback_Volume, . ctl={.name="Master Playback Volume" } },
{ .tag=PCM_Playback_Volume , .ctl={.name="Master 1 (Monitor) Playback Volume" } },
{ .tag=PCM_Playback_Switch , .ctl={.numid=05 } },
{ .tag=Capture_Volume , .ctl={.numid=12 } },
{ .tag=Vol_Ramp_Set_Mode , .cb={.callback=volumeRamp, .handle=&volRampMaster}, .info="select volramp speed",
- .ctl={.numid=0, .type=SND_CTL_ELEM_TYPE_ENUMERATED, .count=1, .value=RAMP_VOL_NORMAL, .name="Hal-VolRamp-Mode", .enums=halVolRampModes}
- },
+ .ctl={.numid=0, .type=SND_CTL_ELEM_TYPE_ENUMERATED, .count=1, .value=RAMP_VOL_NORMAL, .name="Hal-VolRamp-Mode", .enums=halVolRampModes}
+ },
{ .tag=Vol_Ramp_Set_Slave , .cb={.callback=volumeRamp, .handle=&volRampMaster}, .info="set slave volume master numid",
- .ctl={.numid=0, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=1, .value=Master_Playback_Volume, .name="Hal-VolRamp-Slave", .enums=halVolRampModes}
- },
+ .ctl={.numid=0, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=1, .value=Master_Playback_Volume, .name="Hal-VolRamp-Slave", .enums=halVolRampModes}
+ },
{ .tag=Vol_Ramp_Set_Delay , .cb={.callback=volumeRamp, .handle=&volRampMaster}, .info="set ramp delay [default 250ms]",
.ctl={.numid=0, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=1, .minval=0, .maxval=1000, .step=100, .value=250, .name="Hal-VolRamp-Step-Down"}
},
@@ -60,7 +60,7 @@ STATIC alsaHalMapT alsaHalMap[]= {
{ .tag=Master_Playback_Volume , .cb={.callback=volumeRamp, .handle=&volRampMaster}, .info="ramp volume linearly according to current ramp setting",
.ctl={.numid=0, .type=SND_CTL_ELEM_TYPE_INTEGER, .count=1, .minval=0, .maxval=100, .step=1, .name="Hal-VolRamp"}
},
-
+
{ .tag=EndHalCrlTag} /* marker for end of the array */
} ;
@@ -76,7 +76,7 @@ STATIC alsaHalSndCardT alsaHalSndCard = {
STATIC int sndServiceInit () {
int err;
AFB_DEBUG ("Scarlett Binding Init");
-
+
err = halServiceInit (afbBindingV2.api, &alsaHalSndCard);
return err;
}
diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake
index fd2dd40..1f07e15 100644
--- a/conf.d/cmake/config.cmake
+++ b/conf.d/cmake/config.cmake
@@ -68,7 +68,7 @@ set (PKG_REQUIRED_LIST
# Either separate options with ";", or each options must be quoted separately
# DO NOT PUT ALL OPTION QUOTED AT ONCE , COMPILATION COULD FAILED !
# ----------------------------------------------------------------------------
-set(COMPILE_OPTIONS
+set(COMPILE_OPTIONS
-Wall
-Wextra
-Wconversion
diff --git a/conf.d/project/alsa.d/asoundrc.sample b/conf.d/project/alsa.d/asoundrc.sample
index 4ea04dc..8976077 100644
--- a/conf.d/project/alsa.d/asoundrc.sample
+++ b/conf.d/project/alsa.d/asoundrc.sample
@@ -1,17 +1,17 @@
-#
+#
# Author: Fulup Ar Foll
-# Object: PCM hook type
+# Object: PCM hook type
#
# Test : Note: Jabra_USB=hw:v1340
# Check SoundCard speaker-test -Dhw:v1340 -c2 -twav
-# Check MixerPCM speaker-test -DMyMixerPCM -c2 -twav
-# Check HookPCM speaker-test -DMyNavigationHook -c2 -twav
+# Check MixerPCM speaker-test -DMyMixerPCM -c2 -twav
+# Check HookPCM speaker-test -DMyNavigationHook -c2 -twav
# Check NavPCM speaker-test -DMyNavPCM -c2 -twav
# MultiMedia aplay -DDMyNavPCM /usr/share/sounds/alsa/test.wav
#
# Bug/Feature: when softvol control is initialised from plugin and not
# from AGL binding. At 1st run ctl has invalid TLV and cannot be
-# use. Bypass Solution:
+# use. Bypass Solution:
# * start audio-binder before playing sound (binding create control before softvol plugin)
# * run a dummy aplay -DMyNavPCM "" to get a clean control
#
@@ -20,32 +20,32 @@
# Mixer PCM allow to play multiple stream simultaneously
# ------------------------------------------------------
-pcm.MyMixerPCM {
- type dmix
+pcm.MyMixerPCM {
+ type dmix
ipc_key 1024
ipc_key_add_uid false
ipc_perm 0666 # mixing for all users
# Define target effective sound card (cannot be a plugin)
- slave {
- pcm "hw:v1340" #Jabra Solmate
- period_time 0
- period_size 1024
+ slave {
+ pcm "hw:v1340" #Jabra Solmate
+ period_time 0
+ period_size 1024
buffer_size 8192
rate 44100
}
# DMIX can only map two channels
- bindings {
- 0 0
- 1 1
- }
-}
+ bindings {
+ 0 0
+ 1 1
+ }
+}
# Define a Hook_type with a private sharelib
# -------------------------------------------
pcm_hook_type.MyHookPlugin {
- install "AlsaInstallHook"
+ install "AlsaInstallHook"
lib "/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build/Alsa-Plugin/Alsa-Policy-Hook/policy_hook_cb.so"
}
@@ -64,12 +64,12 @@ pcm.MyNavigationHook {
# Every Call should return OK in order PCM to open (default timeout 100ms)
uri "ws://localhost:1234/api?token=audio-agent-token&uuid=audio-agent-session"
request {
- # Request autorisation to write on navigation
+ # Request autorisation to write on navigation
RequestNavigation {
api "control"
verb "dispatch"
query "{'target':'navigation', 'args':{'device':'Jabra SOLEMATE v1.34.0'}}"
- }
+ }
}
# map event reception to self generated signal
event {
@@ -99,7 +99,7 @@ pcm.MyMultimediaPCM {
hint {
show on
description "Navigation SolftVol PCM"
- }
+ }
}
# If hardware does not support mixer emulate it with softvol
@@ -120,7 +120,7 @@ pcm.MyNavPCM {
hint {
show on
description "Navigation SolftVol PCM"
- }
+ }
}
# If hardware does not support mixer emulate it with softvol
@@ -141,6 +141,6 @@ pcm.MyAlarmPCM {
hint {
show on
description "Navigation SolftVol PCM"
- }
+ }
}
diff --git a/htdocs/AFB-websock.js b/htdocs/AFB-websock.js
index ff9fa60..99ab3b8 100644
--- a/htdocs/AFB-websock.js
+++ b/htdocs/AFB-websock.js
@@ -123,14 +123,14 @@ var AFB_websocket;
switch (code) {
case RETOK:
reply(this.pendings, id, ans, 0);
- break;
+ break;
case RETERR:
reply(this.pendings, id, ans, 1);
- break;
+ break;
case EVENT:
default:
fire(this.awaitens, id, ans);
- break;
+ break;
}
}
diff --git a/htdocs/AudioBinding.js b/htdocs/AudioBinding.js
index 4d14600..0f5caf9 100644
--- a/htdocs/AudioBinding.js
+++ b/htdocs/AudioBinding.js
@@ -37,50 +37,50 @@
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
-
+
// default soundcard is "PCH"
var devid=getParameterByName("devid");
if (!devid) devid="hw:1";
-
+
var haldev=getParameterByName("haldev");
if (!haldev) haldev="scarlett-usb";
-
+
var sndname=getParameterByName("sndname");
if (!sndname) sndname="PCH";
-
+
var mode=getParameterByName("mode");
if (!mode) mode="0";
-
+
function replyok(obj) {
console.log("replyok:" + JSON.stringify(obj));
document.getElementById("output").innerHTML = "OK: "+ syntaxHighlight(obj);
}
-
+
function replyerr(obj) {
console.log("replyerr:" + JSON.stringify(obj));
document.getElementById("output").innerHTML = "ERROR: "+ syntaxHighlight(obj);
}
-
+
function gotevent(obj) {
console.log("gotevent:" + JSON.stringify(obj));
document.getElementById("outevt").innerHTML = (evtidx++) +": "+JSON.stringify(obj);
}
-
+
function send(message) {
var api = document.getElementById("api").value;
var verb = document.getElementById("verb").value;
document.getElementById("question").innerHTML = "subscribe: "+api+"/"+verb + " (" + JSON.stringify(message) +")";
ws.call(api+"/"+verb, {data:message}).then(replyok, replyerr);
}
-
- // On button click from HTML page
+
+ // On button click from HTML page
function callbinder(api, verb, query) {
console.log ("subscribe api="+api+" verb="+verb+" query=" +query);
- var question = urlws +"/" +api +"/" +verb + "?query=" + JSON.stringify(query);
+ var question = urlws +"/" +api +"/" +verb + "?query=" + JSON.stringify(query);
document.getElementById("question").innerHTML = syntaxHighlight(question);
ws.call(api+"/"+verb, query).then(replyok, replyerr);
}
@@ -89,26 +89,26 @@
// Retreive Select value and Text from the binder
// Note: selection of value/text for a given context is huggly!!!
function querySelectList (elemid, api, verb, query) {
-
+
console.log("querySelectList elemid=%s api=%s verb=%s query=%s", elemid, api, verb, query);
-
+
var selectobj = document.getElementById(elemid);
if (!selectobj) {
return;
}
-
+
// onlick update selected HAL api
selectobj.onclick=function(){
- sndcard= this.value;
- console.log ("Default Selection=" + sndcard);
+ sndcard= this.value;
+ console.log ("Default Selection=" + sndcard);
};
function gotit (result) {
-
+
// display response as for normal onclick action
replyok(result);
var response=result.response;
-
+
// fulfill select with avaliable active HAL
for (idx=0; idx<response.length; idx++) {
var opt = document.createElement('option');
@@ -120,39 +120,39 @@
// HAL selection mode
if (response[idx].shortname) opt.text = response[idx].shortname;
if (response[idx].api) opt.value = response[idx].api;
-
+
selectobj.appendChild(opt);
}
-
+
sndcard= selectobj.value;
}
-
- var question = urlws +"/"+api +"/" +verb + "?query=" + JSON.stringify(query);
+
+ var question = urlws +"/"+api +"/" +verb + "?query=" + JSON.stringify(query);
document.getElementById("question").innerHTML = syntaxHighlight(question);
// request lowlevel ALSA to get API list
ws.call(api+"/"+verb, query).then(gotit, replyerr);
}
-
+
function refresh_list (self, api, verb, query) {
console.log("refresh_list id=%s api=%s verb=%s query=%s", self.id, api, verb, query);
-
- if (self.value > 0) return;
-
+
+ if (self.value > 0) return;
+
// onlick update selected HAL api
self.onclick=function(){
- numid = parseInt(self.value);
- console.log ("Default numid=%d", numid);
+ numid = parseInt(self.value);
+ console.log ("Default numid=%d", numid);
};
function gotit (result) {
-
+
// display response as for normal onclick action
replyok(result);
var response=result.response;
-
+
// fulfill select with avaliable active HAL
for (idx=0; idx<response.length; idx++) {
var opt = document.createElement('option');
@@ -160,27 +160,27 @@
// Alsa LowLevel selection mode
opt.text = response[idx].name + ' id=' + response[idx].id;
opt.value = response[idx].id;
-
+
self.appendChild(opt);
- }
+ }
self.selectedIndex=2;
- numid = parseInt (self.value);
+ numid = parseInt (self.value);
}
-
- var question = urlws +"/"+api +"/" +verb + "?query=" + JSON.stringify(query);
+
+ var question = urlws +"/"+api +"/" +verb + "?query=" + JSON.stringify(query);
document.getElementById("question").innerHTML = syntaxHighlight(question);
// request lowlevel ALSA to get API list
ws.call(api+"/"+verb, query).then(gotit, replyerr);
}
-
-
+
+
function init(elemid, api, verb, query) {
-
+
function onopen() {
// check for active HALs
querySelectList (elemid, api, verb, query);
-
+
document.getElementById("main").style.visibility = "visible";
document.getElementById("connected").innerHTML = "Binder WS Active";
document.getElementById("connected").style.background = "lightgreen";
@@ -192,6 +192,6 @@
document.getElementById("connected").innerHTML = "Connected Closed";
document.getElementById("connected").style.background = "red";
- }
+ }
ws = new afb.ws(onopen, onabort);
}
diff --git a/htdocs/README.md b/htdocs/README.md
index bb14b7e..bb5f9fb 100644
--- a/htdocs/README.md
+++ b/htdocs/README.md
@@ -1,7 +1,7 @@
------------------------------------------------------------------------
Basic HTML & WS test
------------------------------------------------------------------------
-
+
# Load bindings directly from development tree for debug
afb-daemon --verbose --verbose --token="" --ldpaths=build --port=1234 --roothttp=htdocs
diff --git a/htdocs/alsa-core.html b/htdocs/alsa-core.html
index e946bdb..d8a02d6 100644
--- a/htdocs/alsa-core.html
+++ b/htdocs/alsa-core.html
@@ -2,23 +2,23 @@
<head>
<link rel="stylesheet" href="AudioBinding.css">
<title>Alsa Low Level Simple Test</title>
-
+
<script type="text/javascript" src="AFB-websock.js"></script>
<script type="text/javascript" src="AudioBinding.js"></script>
</head>
-
+
<body onload="init('alsa_registry','alsacore', 'getinfo')">
-
+
<button id="connected" onclick="init('alsa_registry','alsacore', 'getinfo');">Binder WS Fail</button>
<br><br>
<b>Selected SndCard </b>
<select id='alsa_registry'></select>
<b>Select NUMID </b>
- <select id='alsa_ctl_list' onclick="refresh_list(this, 'alsacore', 'getctl', {devid:sndcard, mode:1})">
+ <select id='alsa_ctl_list' onclick="refresh_list(this, 'alsacore', 'getctl', {devid:sndcard, mode:1})">
<option value='-1'>Refresh NUMID list</option>
- </select>
-
+ </select>
+
<b>API Verbosity </b>
<select id='api_verbosity' onclick='mode=this.value'>
<option value='0'>Quiet</option>
@@ -26,7 +26,7 @@
<option value='2'>Verbose</option>
<option value='3'>Full</option>
</select>
-
+
<br>
<ol>
@@ -34,29 +34,29 @@
<li><button onclick="callbinder('alsacore','getctl', {devid:sndcard, mode:mode, ctl:[numid]})">Get Alsa Ctls [numid]</button></li>
<li><button onclick="callbinder('alsacore','getctl', {devid:sndcard, mode:mode, ctl:[numid,numid+1]})">Get Alsa Ctls [numid,numid+1]</button></li>
<br>
-
-
+
+
<li><button onclick="callbinder('alsacore','setctl', {devid:sndcard, mode:mode, ctl:[[9,20]]})">Set Alsa Ctl ctl:[[9,20]]</button></li>
<li><button onclick="callbinder('alsacore','setctl', {devid:sndcard, mode:mode, ctl:[{id:9,val:50}]})">Set Alsa Ctl ctl:[{id:9,val:50}]}</button></li>
<li><button onclick="callbinder('alsacore','setctl', {devid:sndcard, mode:mode, ctl:[[6,[20,20]]]})">Set Alsa Ctl ctl:[[6,[20,20]]]</button></li>
<li><button onclick="callbinder('alsacore','setctl', {devid:sndcard, mode:mode, ctl:[{id:6,val:[50,50]}]})">Set Alsa Ctl ctl:[{id:2,val:[50,50]}]</button></li>
<li><button onclick="callbinder('alsacore','setctl', {devid:sndcard, mode:mode, ctl:[{id:6,val:[50,50]}, {id:9,val:50,50}]})">Set Alsa Ctl ctl:[{id:6,val:[50,50]}, {id:9,val:50,50}]</button></li>
- <br>
+ <br>
<li><button onclick="callbinder('alsacore','ucmquery', {devid:sndcard, mode:mode})">List UCM verbs</button></li>
<li><button onclick="callbinder('alsacore','ucmset' , {devid:sndcard, mode:mode, verb:'HiFi'})">Set UCM HiFi</button></li>
<li><button onclick="callbinder('alsacore','ucmset' , {devid:sndcard, mode:mode, verb:'HiFi', dev:'Headphone'})">Set UCM HiFi+Headphone</button></li>
<li><button onclick="callbinder('alsacore','ucmset' , {devid:sndcard, mode:mode, verb:'HiFi', dev:'Headphone', mod:'RecordMedia'})">Set UCM HiFi+Headphone+RecordMedia</button></li>
- <br>
+ <br>
<li><button onclick="callbinder('alsacore','ucmget' , {devid:sndcard, mode:mode, values:['OutputDspName','PlaybackPCM','CapturePCM']})">Get UCM OutputDspName+PlaybackPCM+CapturePCM (SET UCM)</button></li>
- <br>
+ <br>
<li><button onclick="callbinder('alsacore','subscribe', {devid:sndcard})">Subscribe AlsaCtl Events</button></li>
<br>
</ol>
-
+
<div id="main" style="visibility:hidden">
<ol>
<li>Question <pre id="question"></pre>
<li>Response <pre id="output"></pre>
<li>Events: <pre id="outevt"></pre>
</ol>
- </div>
+ </div>
diff --git a/htdocs/alsa-hal.html b/htdocs/alsa-hal.html
index 013c547..c05605d 100644
--- a/htdocs/alsa-hal.html
+++ b/htdocs/alsa-hal.html
@@ -6,27 +6,27 @@
<script type="text/javascript" src="AudioBinding.js"></script>
</head>
-
+
<body onload="init('hal_registry','alsacore', 'hallist')">
-
+
<h1>Simple AlsaHAL tests</h1>
<button id="connected" onclick="init('hal_registry','alsacore', 'hallist')">Binder WS Fail</button>
<br><br>
<b>Selected HAL </b>
<select id='hal_registry'></select>
-
+
<b>API Verbosity </b>
<select id='api_verbosity' onclick='mode=this.value'>
<option value='0'>Quiet</option>
<option value='1'>Compact</option>
<option value='2'>Verbose</option>
<option value='3'>Full</option>
- </select>
+ </select>
<br>
<br>
<ol>
-
+
<li><button onclick="callbinder(sndcard,'ctllist')">List Selected HAL Controls </button></li>
<li><button onclick="callbinder(sndcard,'ctlget', {label:'Master_Playback_Volume'})">Get {label:'Master_Playback_Volume'}</button></li>
<li><button onclick="callbinder(sndcard,'ctlget', [{tag:4},{tag:5}])">Get[{tag:4},{tag:5}]</button></li>
@@ -37,18 +37,18 @@
<li><button onclick="callbinder(sndcard,'ctlset', [{tag:4, val:25},{tag:5, val:25}])">Set[{tag:4, val:25},{tag:5, val:25}]</button></li>
<li><button onclick="callbinder(sndcard,'ctlset', [{tag:4, val:[55,45]},{tag:5, val:[45,55]}])">Set[{tag:4, val:[55,45]},{tag:5, val:[45,55]}]]</button></li>
<br>
-
+
<li>
<label for="volramp">Volume Ramp</label>
<input id="volramp" type="number" min=0 max=100 step=10 maxlength=3 placeholder="Enter 0-100" onChange="callbinder(sndcard,'ctl-set', {label:'Volume_Ramp', val:this.value})">
</li>
<br>
</ol>
-
+
<div id="main" style="visibility:hidden">
<ol>
<li>Question <pre id="question"></pre>
<li>Response <pre id="output"></pre>
<li>Events: <pre id="outevt"></pre>
</ol>
- </div>
+ </div>
diff --git a/htdocs/audio-control.html b/htdocs/audio-control.html
index 06010e5..46352c1 100644
--- a/htdocs/audio-control.html
+++ b/htdocs/audio-control.html
@@ -5,41 +5,41 @@
<script type="text/javascript" src="AFB-websock.js"></script>
<script type="text/javascript" src="AudioBinding.js"></script>
</head>
-
+
<body onload="init('hal_registry','alsacore', 'hallist')">
-
+
<h1>Simple Audio Control Test</h1>
<button id="connected" onclick="init('hal_registry','alsacore', 'hallist')">Binder WS Fail</button>
<br><br>
<b>Selected HAL </b>
<select id='hal_registry'></select>
-
+
<b>API Verbosity </b>
<select id='api_verbosity' onclick='mode=this.value'>
<option value='0'>Quiet</option>
<option value='1'>Compact</option>
<option value='2'>Verbose</option>
<option value='3'>Full</option>
- </select>
+ </select>
<br>
<br>
-
+
<ol>
-
+
<li><button onclick="callbinder('control','dispatch' ,{'target':'navigation','args':{'apihal':sndcard}});">Dispatch Navigation</button></li>
<li><button onclick="callbinder('control','dispatch' ,{'target':'multimedia','args':{'apihal':sndcard}});">Dispatch Mutimedia</button></li>
<li><button onclick="callbinder('control','dispatch' ,{'target':'emergency' });">Dispatch Emergency</button></li>
- <br>
+ <br>
<li><button onclick="callbinder('control','request' , {'target':'_Simple_Echo_Args', 'args':{speed:20}});">LUA function</button></li>
<li><button onclick="callbinder('control','request' , {'target':'_Simple_Timer_Test', args:{label:'MyTimer', 'delay':3000, 'count':10}});">LUA Timer</button></li>
<li><button onclick="callbinder('control','debuglua' , {'target':'helloworld', args:{'arg1':'abcd', 'next':7890, 'last':[1,2,3,4]}});">LUA script</button></li>
-
+
</ol>
-
+
<div id="main" style="visibility:hidden">
<ol>
<li>Question <pre id="question"></pre>
<li>Response <pre id="output"></pre>
<li>Events: <pre id="outevt"></pre>
</ol>
- </div>
+ </div>
diff --git a/htdocs/audio-logic.html b/htdocs/audio-logic.html
index c31282a..6eb97e3 100644
--- a/htdocs/audio-logic.html
+++ b/htdocs/audio-logic.html
@@ -1,7 +1,7 @@
<html>
<head>
<title>High Level API Simple Test Page</title>
-
+
<script type="text/javascript" src="AFB-websock.js"></script>
<script type="text/javascript" src="AudioBinding.js"></script>
</head>