summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2019-10-17Use dedicated systemd function for inotify eventsicefish_8.99.2icefish_8.99.1icefish/8.99.2icefish/8.99.18.99.28.99.1Jonathan Aillet1-150/+39
Use inotify events dedicated systemd function 'sd_event_add_inotify' instead of standard 'sd_event_add_io' function. BUG-AGL: SPEC-2909 Change-Id: Ie33d7ff049c9baa70e063a4f0192fc4e77daffac Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-17Prevent stop listening for control event on errorJonathan Aillet1-3/+2
Prevent stop listening for ALSA control events when control info and value was not possible to get. This error happen when a custom ALSA control is removed. BUG-AGL: SPEC-2897 Change-Id: Ie206247537715468f704e3c746d6e8744be23cf4 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-02Add a definition to force status refreshJonathan Aillet2-5/+54
Add a 'FORCE_STATUS_REFRESH_MS' definition that can be use to force cards/PCM status refresh. Might be used in case of missed events using 'inotify'. BUG-AGL: SPEC-2849 Change-Id: I8de80a95b752e5e4a14ad433460598e371d3a39f Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-02Add function to deal with PCM availability eventJonathan Aillet1-52/+74
Add a dedicated function to refresh monitored PCM status and fire event if PCM availability has changed. BUG-AGL: SPEC-2849 Change-Id: I1358b4019d7da80a8055bfbcd0bbf3f55a2499e3 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-01Add events when PCM availability changesJonathan Aillet2-1/+347
Add PCM availability application framework events to be notified when ALSA PCM availability changes. Use subscribe verb and json '{ "event" : "pcm", "name" : "hw:3,2,1", "stream" : 0 }' to subscribe to playback PCM 'hw:3,2,1' availability events. Use subscribe verb and json '{ "event" : "pcm", "name" : "hw:1,2,3", "stream" : 1 }'' to subscribe to capture PCM 'hw:1,2,3' availability events. from removed card events. To handle PCM events, inode notification (using inotify) is used on '/dev/snd/pcm*' file (e.g. '/dev/snd/pcmC0D0p') to monitor PCM availability. BUG-AGL: SPEC-2835 Change-Id: I5bfaef73b896fa7213e1308035eeaff1464f62f6 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-01Add verb to get PCM availabilityJonathan Aillet3-1/+152
Add verb to get PCM availability, this verb will return a boolean json. PCM can be specified using two ways : - card & device & subdevice & stream - pcmName & stream BUG-AGL: SPEC-2834 Change-Id: I176fdc261fa117906a2af069d3ddd07d5941904c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-01Add possibility to unsubscribe from eventsJonathan Aillet3-27/+70
Add possibility to unsubscribe from events using 'unsubscribe' verb with the same json payload used for subscribe. BUG-AGL: SPEC-2833 Change-Id: Ie01f36b2bf0a446cc80b09d79417a301ce9ecfff Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-01Add verb to remove custom ALSA controlJonathan Aillet3-56/+147
Add verb to remove previously added custom ALSA control. It can be done using 'removecustomctl' verb. BUG-AGL: SPEC-2836 Change-Id: I07b842e3425f6c176423473afcd8b3d18dcaa79b Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-01Rework subscription handlingJonathan Aillet1-239/+279
Rework subscription handling to : - use an "event" key to select which event type we want to subscribe to, this will allow an easier integration of new events. - merge 'soundcard-added' and 'soundcard-removed' cards events into one 'cards-monitoring' event. Will ease unsubscription. - remove concept of 'mode' in json sent by event, this will allow to avoid 'mode' conflicts when several bindings are subscribed to the same event. Also, normalize some syntax issues. SPEC-2832 Change-Id: Ief8b3065a3e18dc710ef5b951053f96459c65e0b Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-01Rework verb request json parsingJonathan Aillet4-123/+190
Rework verb request json parsing to allow having request without 'devid' key in json. BUG-AGL: SPEC-2832 Change-Id: Id937d98c29d30b9298be3a1972f1a2cf5d0b722c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-01Add a definition for subdevice maximumJonathan Aillet2-7/+9
Add a definition to define the maximum number of subdevices in an ALSA device. BUG-AGL: SPEC-2832 Change-Id: Id44d53252119319feb400f3b3fa59534392038af Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-01Correct the use of wrong variable typeJonathan Aillet1-2/+7
Correct the use of an 'unsigned int' instead of an 'int'. BUG-AGL: SPEC-2832 Change-Id: Iee374404c60698e9d243d0622eb1900c5cc8ae7e Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-01Correct errors in printed variablesJonathan Aillet1-2/+2
Before, the modified print was using '*currentDevice' variable which is an ALSA device number. As the print point was to show on which card the error happened, variable has been changed to print the ALSA card number. BUG-AGL: SPEC-2832 Change-Id: I7a8b85fba4f8aa9c37b4e5ee5d293b9a6b09a0e9 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-08-19Add events when ALSA card are added/removedJonathan Aillet1-2/+271
Add 'soundcard-added'/'soundcard-removed' application framework events to be notified when ALSA card are added/removed. Use subscribe verb and json '{ "devid" : "added" }' to subscribe to added card events. Use subscribe verb and json '{ "devid" : "removed" }' to subscribe to removed card events. Bug-AGL: SPEC-2749 Change-Id: Ia021d7f6984b2263a5011121a69f17bb4ee2bf9e Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-08-19Make a function to get card number from card pathJonathan Aillet2-22/+39
Make a function to get card number from card path, will be needed to for added/removed card events. Bug-AGL: SPEC-2749 Change-Id: Ic0cc6fd84a54432c696892772f2f66d1bde59a65 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-08-19Declare 'getCardInfo' function as publicJonathan Aillet2-1/+2
Declare 'getCardInfo' function as public, will be needed to get information about added/removed card events. Bug-AGL: SPEC-2749 Change-Id: Ic23542a64e92fd2b3f91853a968b3feff5b76cc5 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-08-19Rework ALSA card control events functionsJonathan Aillet1-66/+84
Rework ALSA card control events subscription and handling to: - Clean unnecessary part of codes. - Increase reliability of ALSA control events polling callback. Bug-AGL: SPEC-2749 Change-Id: I75dc90483254b1befdf83968c9032ec877c1d895 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-08-14Avoid epoll errors to be fired indefinitelyJonathan Aillet1-0/+6
When a audio card with control event generation is removed, avoid epoll errors to be fired indefinitely by event loop. Bug-AGL: SPEC-2749 Change-Id: I65dddc2f9714fa2303773b212bc3cad7cb164d73 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-08-14Minor syntax changes in get card info functionsJonathan Aillet1-23/+42
Minor syntax changes in get card info functions. Bug-AGL: SPEC-2749 Change-Id: I90c896618fca73dbae9e51ff996ac5613713d7b6 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-03-27Improve tests for 4a-alsa-corehalibut_8.0.6halibut_8.0.5halibut_8.0.4halibut_8.0.3halibut_8.0.2halibut_8.0.1halibut_8.0.0halibut_7.99.3halibut_7.99.2halibut_7.99.1halibut/8.0.6halibut/8.0.5halibut/8.0.4halibut/8.0.3halibut/8.0.2halibut/8.0.1halibut/8.0.0halibut/7.99.3halibut/7.99.2halibut/7.99.18.0.68.0.58.0.48.0.38.0.28.0.18.0.07.99.37.99.27.99.1halibutFrederic Marec4-7/+160
Change-Id: Ief879bd4856b3aa906c3b256c432e2a5ddf78fcd Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
2019-02-19Rework ALSA card get info functionJonathan Aillet3-100/+598
Rework ALSA card get info function to : - Be able to probe an ALSA card depending on multiple parameters (card number, card path, card id, card short name, card long name, card driver, card mixer name, card components). If several parameters are requested, all should be true to find a corresponding card. - Be able to add parameters about a playback device depending on multiple parameters (device number, device id, device name). The combination of all card parameters and all device parameters should be true to find a corresponding card/device. - If a corresponding card/device is found, information about it will be returned as a json object. - If multiple card/device are corresponding to the request, all cards information will be returned in a json array. - If no request json is available, all cards information will be returned (using a json array). - Add the possibility to ask for multiple card/device in one verb call using a json array in request json. Each case will be handled as an individual request. The response will be an array of the same length as the request json, with each response case corresponding to the request case. Change-Id: Ia71e40ce10c8bb10d51099832748c5621d202647 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-01-25Rework ALSA control set/get functionhalibut_7.90.0halibut/7.90.07.90.0Jonathan Aillet1-80/+134
Rework ALSA control set/get function to : - Improve malformed JSON request detection. - Optimize execution when an array of control to set/get is received. - Send back error when the control is not found (instead of a warning). - Send back errors when an error happened during call to ALSA set/get functions (instead of warnings). Change-Id: Id3c0092bfb50979cbec048fa431d989c3c34db33 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-01-25Improve prints when setting values of controlJonathan Aillet1-3/+8
Improve prints when setting values of control by : - Increasing print level of error print - Printing more information when sent values array is not corresponding to the number of values of the control. Change-Id: I1ffe4bce78921e885da9dced21bd3bbb4e1c2aa6 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-01-25Send back cardid only if request is validJonathan Aillet1-7/+9
When trying to get information about ALSA card, fail if request JSON is malformed. However, send back information about all ALSA cards when no request JSON has been transfered. Change-Id: I2d45abb59d00cea27bfb09e74b15cc82cf84a086 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-01-25Improve ALSA control creationJonathan Aillet1-30/+60
Improve ALSA control creation by : - Checking supported controls type at function start. - Prevent segfault when a none INTEGER control is updated. Change-Id: Icbff18ec6fc6c35938bf2945edc27c36fecf99d1 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-01-25Fix dbScale generation when adding custom controlJonathan Aillet1-22/+15
Fix dbScale generation when a custom INTEGER ALSA control is added. Change-Id: I935de59d1ca30466c071972939c8ef200007ceb3 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-12-20alsaSetGetCtls: fixed a memory leakguppy_6.99.4guppy_6.99.3guppy/6.99.4guppy/6.99.36.99.46.99.3Thierry Bultel1-2/+5
By reading the sources of libasound, snd_ctl_elem_list_alloc_space needs a snd_ctl_elem_list_free_space to free the allocated memory Change-Id: I47280fa95c5a47a993c399329aaf655f8c83dd2a Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-11-22Move autobuild to top treeguppy_6.99.2guppy/6.99.26.99.2Frederic Marec2-28/+44
Bug-AGL: SPEC-495 Change-Id: I36d58dfb86a5b6e3bf4370931ec3fb8413febc51 Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
2018-11-22Add test for 4a-alsa-coreguppy_6.99.1guppy/6.99.16.99.1Frederic Marec7-1/+208
Add test tree Set API_NAME in conf.d/cmake/config.cmake Bug-AGL: SPEC-1796 Change-Id: I0065260549f3fc95b7e2c3c47036e775382139be Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
2018-11-08Change .gitmodules following submodule migrationFrederic Marec1-3/+0
Remove app-template in .gitmodules Remove .gitmodules Change-Id: Ic3637b3a2cd2245f51bc14e972b5e58b2e41ae2c Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
2018-10-31Migrate app-templates to CMake moduleRomain Forlot3-4/+6
Bug-AGL SPEC-1682 Change-Id: Ic4a8925d8be17ab6d53d18ca8abaf99ce348ded8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-20Use application framework binding v3guppy_6.90.0guppy/6.90.0flounder_5.99.6flounder_5.99.5flounder_5.99.4flounder_5.99.3flounder_5.99.2flounder/5.99.6flounder/5.99.5flounder/5.99.4flounder/5.99.3flounder/5.99.26.90.05.99.65.99.55.99.45.99.35.99.2Jonathan Aillet1-1/+1
Change binding version to use application framework v3. Change-Id: Ic54f5418396562c53e4712d14bd86ab4ca3e16df Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-07-20Use some app-fwk macros to support v2 and v3Jonathan Aillet6-38/+42
Use some application framework macros to support both v2 and v3 compilation. Change-Id: I3051bbeff8788ea2c71545e5d253619d4749ff41 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-07-20Use app-fwk macro to get verbosity levelJonathan Aillet2-4/+1
Use application framework macro to get verbosity level instead of a legacy function. Change-Id: I925b2ccea3c7d58bc50281eb8d39f82dac1f49b4 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-07-20Correct warning that was raised at compilationJonathan Aillet4-9/+15
Correct warning that was raised at compilation concerning 3 subjects : - Too short strings for 'snprintf'. - Forget cast returns of 'json_object_array_length' function. - Checking return of 'asprintf' function. Change-Id: I0fc702750841a0f8da921c3c3b1453c5afee0fd8 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-07-20Set afb version in cmake instead of in headerJonathan Aillet2-1/+2
Set application framework binding version in cmake instead of setting it before including binding header. Change-Id: Ic841069248d40fdd023c8056a614e484004be298 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-07-19Update version of conf.d/app-templates submodule.Jonathan Aillet1-0/+0
Changes of conf.d/app-templates: (f94e45e - Romain Forlot) Align sample on actual default compile options (d0acc2a - Romain Forlot) Add support to binding version 3. (6fb3846 - Romain Forlot) Warning if not using wgtpkg-pack to make a widget (35f3af1 - Sebastien Douheret) Rework CMAKE_INSTALL_PREFIX and INSTALL_PREFIX var (332f377 - Romain Forlot) Be able to overwrite BUILD_TYPE using CLI (1ec7531 - Romain Forlot) Use CACHE variable for other common CMAKE variable (0880356 - Romain Forlot) Fix:: wrong wgt using RELEASE BUILD TYPE (eec9f07 - Romain Forlot) Fix: SYSROOT location detection... Wrong test. (291aa4e - Romain Forlot) Change the default debug compilation options. (22a2cbf - Romain Forlot) Clearer coverage compilation options configuration (aa68dbd - Romain Forlot) Don't overwrite the autobuild script if it exists (a13e7b9 - Romain Forlot) Disable the in-tree build method. (51026d2 - Romain Forlot) Detect Yocto as OS distribution (1f2944e - Romain Forlot) Fix: wrong compile options added (92646f6 - Romain Forlot) Fallback using zip format if no wgtpkg-pack found (f65761c - José Bollo) 02-variables.cmake: Avoid checking CXX version if not required (3965d37 - José Bollo) config.cmake.sample: Remove dependency to libsystemd (a45ae0c - José Bollo) config.cmake.sample: Remove dependency to libmicrohttpd (9b17efe - Thierry Bultel) Added -D_FORTIFY_SOURCE=2 to CFLAGS (66f7bc8 - Thierry Bultel) start-on-target: uses RSYNC_PREFIX path for config (e400fb3 - Sebastien Douheret) Fixed spelling. (6621af0 - Romain Forlot) Improve OS detection (829dd69 - Romain Forlot) Fix: OS detection (8f5a17b - Romain Forlot) Launch from workdir (72ca4ff - Romain Forlot) Change closing that could fix native debugging (6e1a3c3 - Romain Forlot) Fix filename pattern to match .cmake files (30e78a5 - Romain Forlot) Adding cmake file at the root directory (a3c312e - Romain Forlot) Adds commit hash to the version. (6c0e9e4 - Romain Forlot) Change default sample settings. (dd0cec7 - Romain Forlot) Forgot updating README also... (66d0ca1 - Romain Forlot) Update documentation (4b26503 - Romain Forlot) Use LFSH named, rename data to var (bb3c541 - Romain Forlot) Use new CPP generation from afb-genskel (ee5d60f - Romain Forlot) Update README with latest docs modifications (f3954e8 - Romain Forlot) Doesn't set rpath for built target and update doc (935c390 - Romain Forlot) Details external library. (dc4debf - Romain Forlot) Deprecate PROJECT_LIBDIR and PROJECT_RESOURCES var (c9fdbc1 - Romain Forlot) Make sure to point to correct dir for cmake script (818a2bc - Romain Forlot) Fix variables checking. (e40a854 - Romain Forlot) CMake doesn't path protection. (0487d44 - Romain Forlot) Compare to manual Project version if not from git (7dabdeb - Romain Forlot) No failure if none tags found on project git repo (52a3998 - Romain Forlot) Protect path with space in it. (1687531 - Romain Forlot) Check version between app-templates and project. (d275993 - Romain Forlot) Cleaning (054d3b8 - Romain Forlot) Could specify others default install directories (8c2b059 - Scott Murray) Fix finding config template Change-Id: I4e161dc23a08e15d12fa76383a3544bc70d18781 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-26Fixed crash when 'set' request is based on numidsflounder_5.99.1flounder/5.99.15.99.1Thierry Bultel1-3/+10
When numids are given, the 'tag' field is not initialized to NULL, and leads to a crash on strcasecmp. Change-Id: I23a1552bba565259280140a5e099be10613ab1bc Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-06-06Add an option to 'ctlget' verbJonathan Aillet2-1/+12
Add a new way to ask for alsa controls info by implementing the possibility to ask for alsa control using its label. It is a clean way to get control numid using control label. Bug-AGL: SPEC-1405 Change-Id: If5387c63a41a07d451a21edab86e9bb90b4908c4 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-06Add an option to 'infoget' verbJonathan Aillet2-20/+75
Add a new way to get card info when using 'infoget' verb : When the request contains a section 'devpath', the path specified will be used to search for the device. Bug-AGL: SPEC-1405 Change-Id: Idc99a27229f0db3484f62f8f761b7e0daee13a3c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-06Update dB basic TLVJonathan Aillet1-8/+8
Handle volume in dB instead of absolute value. Allows a more natural augmentation/diminution of volume. Bug-AGL: SPEC-1405 Change-Id: If186c826e7008283f7c05599efa6158ac613a380 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-06Correct a segfault when using ping verbJonathan Aillet1-1/+1
When 'ping' verb is called, be sure that we won't generate a segfault by using 'json_object_get' before responding. Bug-AGL: SPEC-1405 Change-Id: I22fb8e1e492a33e7310d009998fd3c72383e702d Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-05-31alsa-hook: Update to future version of app-framework-binderJosé Bollo1-2/+6
The subcall behaviour changes. This commits updates the code to the upcoming behaviour. Change-Id: Ib43b085017536feeb379750bbdef4616d69651cd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-05-24Update to binder changes for bindings v3José Bollo1-0/+12
The bindings v3 are now allowed to return an object with errors. To enforce taking that change into account, the signature of the object changed. It implies some change in clients. The current patch makes a minimal change. Change-Id: I587b5b656d57e747bd4bb1d9f7fa97126211f891 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-01-05Improve resource liberationRonan Le Martret1-16/+50
* Add magic to pcm handle to assert client (pulse) provides a valid structure and ignore invalid data. * TMP Fix for CES 2018, return True even policies are refused. otherwith sig fault. * TMP remove afb_proto_ws_unref on client. Change-Id: I498786147e2dac473a6a9704fef7d12fe4fcaf10 Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
2017-12-27Fix undeclared event crash on 4ARonan Le Martret1-15/+66
- Add comment to Alsa Hook - Free resource when closing PCM - Fix Mainloop freeze on the second query Bug-AGL: SPEC-1110 Change-Id: I296f30b82cc85d4a57c1300518627ff1f8685c57 Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
2017-12-20Change websock session id from uid only to pcm+uidRonan Le Martret4-2093/+2
This allow to have one session per PCM in order to allow a single process handling multiple PCM like pulse to have on independant session per PCM. Change-Id: Icdd3e4d44539dba2349d70edeaaeee861c3bd1cf Signed-off-by: Fulup Ar Foll <fulup@iot.bzh> Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org> Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
2017-11-30Merge "Change initial volume to be in % in place of absolute values"ronan Le Martret2-45/+51
2017-11-30Change initial volume to be in % in place of absolute valuesFulup Ar Foll2-45/+51
Signed-off-by: Fulup Ar Foll <fulup@iot.bzh>
2017-11-28Improve thread ressource liberationRonan Le Martret1-41/+42
* afbClient thread must be kill when we Close the alsa Hook Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh> Change-Id: I834f888f41c179950ea7c03d6d9325d7df5b4599