aboutsummaryrefslogtreecommitdiffstats
path: root/src/4a-internals-hal/4a-internals-hal-cb.c
AgeCommit message (Collapse)AuthorFilesLines
2019-10-17Add functions to unmanage handled halmapJonathan Aillet1-25/+119
Add functions to unmanage handled halmap. Using these functions, it is possible to unmanage : - a specific halmap. - dependency related halmaps (e.g. at dynamic dependency disconnection). - all handled halmaps (a.g. at binder exit). BUG-AGL: SPEC-2893 Change-Id: I24c40ade8a392b30ad962e2396fdb5f8d7e71b33 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-17Handle 'alsacore' events in a dedicated functionJonathan Aillet1-68/+16
Handle 'alsacore' events in a dedicated function. For now, only 'controls' events are handled. This modification will also ease addition of other 'alsacore' events. BUG-AGL: SPEC-2885 Change-Id: Ie56d4d58242fd7ff78306d85b54d48ed771f3227 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-17Rework Alsacore subscription functionsJonathan Aillet1-1/+1
Reworking of Alsacore subscription functions to ease adding new Alsacore events subscription. BUG-AGL: SPEC-2891 Change-Id: I8796bc5923e640cccd5a27167a0aa58ca4967609 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-17Add verbose level to json hal info verbJonathan Aillet1-52/+94
Add verbose level to specify the requested information level when calling a json hal 'info' verb. Also, move into a function the code that allows to get information about json hal. BUG-AGL: SPEC-2889 Change-Id: I9d5cbc6cfa550f4f7c8033dad0f3ec66d1268ea5 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-17Rework mixer calls to handle dependenciesJonathan Aillet1-5/+20
Rework 'attach' mixer calls to handle dependencies individually. That means that an attach call will be performed for each dependency. To avoid errors when calling mixer, complete list of dependencies should be send to it, but we can specify which dependency we want to be processed using 'handled' key. BUG-AGL: SPEC-2887 Change-Id: I9db7391fe7a44ba045fd82d94221a1442b7c2198 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-17Reorder 'internals-hal-cb.c' functionsJonathan Aillet1-553/+553
Reorder hal json section handling functions in 'internals-hal-cb.c' to match processing order define in 'ctrlSectionsDefault' table. BUG-AGL: SPEC-2885 Change-Id: I9bf2c59706982339b5676fe900c7f48af68b96c8 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-17Correct behaviour of halmap handling functionJonathan Aillet1-2/+2
Correct behaviour of halmap handling function by : - Avoid unnecessary set to 0 newly allocated data. - Correct return value. BUG-AGL: SPEC-2884 Change-Id: I647812e8fe8770954ada5cfded2505bf9f412699 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-10-17Remove an unnecessary double pointerJonathan Aillet1-7/+3
Remove an unnecessary double pointer in 'InternalHalHandleOneHalDependencies' function. BUG-AGL: SPEC-2884 Change-Id: I20e0b0d11288814322b3480a70b77df14a08564a Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-09-26Update call to 'subscribe' verb of 'alsacore' apiJonathan Aillet1-1/+1
Update call to 'subscribe' verb of 'alsacore' api to match last '4a-alsacore' events/subscription handling updates. BUG-AGL: SPEC-2832 Change-Id: Ib6b5e1f4536440fd4f83a07d66fe047bfa889a5b Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-08-12Optimize hal 'info' response json allocationJonathan Aillet1-29/+15
Optimize hal 'info' response json allocation by removing empty objects/arrays from response. BUG-AGL: SPEC-2733 Change-Id: I521626b67076b603ab1caa974b697246c8fff759 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-07-18Correct error level for hal-dependenciesJonathan Aillet1-4/+4
Correct error level when a mandatory hal-dependencies is not available. BUG-AGL: SPEC-2652 Change-Id: I053913a83be8124eaac26dd4f2cd28d1e5ff5083 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-26Remove global card number of halhalibut_7.99.3halibut_7.99.2halibut/7.99.3halibut/7.99.27.99.37.99.2Jonathan Aillet1-5/+23
As we are now using haldependencies to get hal card number(s), it does not make sense to store a global card number for a hal. BUG-AGL: SPEC-2329 Change-Id: If5beb84b71b5e5e67aeabd947b5c3edbf154fa3c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-26Use haldependencies to process and handle halmapJonathan Aillet1-87/+238
Use haldependencies section definition to process and to handle halmap section. That means that each 'halmap' control can use its own probed audio device card number using a targeted dependencies. Also, change halmap section definition to be able to handle several halmap defined with the same dependencies. Update example hal to match new json file format. BUG-AGL: SPEC-2329 Change-Id: I31997a037ee8f0e727e0a67866d651b988b85260 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-25Use a dynamic allocation for halmap data storageJonathan Aillet1-20/+51
Use a dynamically allocated structure to store properties about ALSA controls (halmap). BUG-AGL: SPEC-2329 Change-Id: I691648452d6c950d201bc25977a493608fede197 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-25Use of linked list for 'halmap' dataJonathan Aillet1-131/+122
Use of linked list for 'halmap' data instead of a fixed array. It uses the same mechanism already implemented for other linked list. BUG-AGL: SPEC-2329 Change-Id: I2ff9c9a797a5547cd74f0240c5b7573a02c90781 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-25Rework json strings allocation/freeingJonathan Aillet1-23/+57
Rework json strings allocation/freeing because : - Some json strings are freed twice. - Some containing strings json are not correctly freed. BUG-AGL: SPEC-2329 Change-Id: I90f9470c6a4bc4b1641a01dd2da5051da1ff9547 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-25Move function used to process all halmap objectsJonathan Aillet1-50/+50
Move function used to process all halmap json objects. BUG-AGL: SPEC-2329 Change-Id: I692b1810ce2298b24198a001c26b9233740ca31a Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-18Add a function to handle selected dependencyJonathan Aillet1-17/+51
Add a function to handle selected dependency using its uid. BUG-AGL: SPEC-2329 Change-Id: I0e92448f9102bc5e6e0f19d1598d75c1ba782863 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-18Refactoring 'streams data' linked listJonathan Aillet1-7/+4
Refactoring 'streams data' linked list code using liburcu. BUG-AGL: SPEC-2329 Change-Id: Idf9367c015d73574d96d83c82a9e8f5b7588a45d Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-18Refactoring 'probed devices' linked listJonathan Aillet1-16/+13
Refactoring 'probed devices' linked list code using liburcu. BUG-AGL: SPEC-2329 Change-Id: I4d0255bc020733b1abbea1f3e6195c73cf8da8f6 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-06Add 'hal-dependencies' info at hal 'info' callJonathan Aillet1-3/+13
Add available 'hal-dependencies' full json info in response of hal 'info' verb call. BUG-AGL: SPEC-2329 Change-Id: I74615b84d015d142a6aebc291fb9e849a053344a Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-06Prevent errors when multiple devices are foundJonathan Aillet1-0/+1
Prevent errors when multiple devices are found by a 'hal-dependency' BUG-AGL: SPEC-2329 Change-Id: I276cc7abe19d5c0ee27ee3a8950271f58dd14f04 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-06-06Move functions used to generate jsonJonathan Aillet1-84/+4
Move functions used to generate hal information json into there corresponding files in hal-utilities. BUG-AGL: SPEC-2329 Change-Id: Id518e7f732ef393bbf98f3b3a32edf01ec81f70c Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-29Add forgotten spaces in some multi-lines printsJonathan Aillet1-3/+3
Add forgotten spaces in some multi-lines prints. BUG-AGL: SPEC-2329 Change-Id: I84457ac695a613b3cf280c3e8fb4f25b71070438 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-29Rework internal hals event handlingJonathan Aillet1-28/+54
Rework internal hals event handling to avoid : - rare segmentation fault. - too early alsa-core events subscription. - use of not available data. BUG-AGL: SPEC-2329 Change-Id: Ib84103682614b80bca3c0c2251779775cd35744f Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-24Add 'haldependencies' section support.halibut_7.99.1halibut/7.99.17.99.1Jonathan Aillet1-0/+27
Add 'haldependencies' section into handled section table. Also, add a function to redirect to 'processing' and to 'handling' functions depending hal initialization stage. BUG-AGL: SPEC-2329 Change-Id: I4fa09493fecf48844bff171e2e8ca764f9fe8f18 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-24Add functions to handle 'haldependencies'Jonathan Aillet1-0/+182
Add functions to handle new 'haldependencies' section. This new section will be used to probe for multiple audio device using only one hal. Each probed device could be 'mandatory', 'dynamic' (optional but periodically probed), or 'static' (optional and probed only at startup). The result of handling this section will be used by softmixer and in 'halmap' section. BUG-AGL: SPEC-2329 Change-Id: Ib763b86c0f306abba7a886f5a348d5414ab5e88d Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-24Add functions to process 'haldependencies'Jonathan Aillet1-0/+317
Add functions to process new 'haldependencies' section. This new section will be used to probe for multiple audio device using only one hal. Each probed device could be 'mandatory', 'dynamic' (optional but periodically probed), or 'static' (optional and probed only at startup). The result of handling this section will be used by softmixer and in 'halmap' section. BUG-AGL: SPEC-2329 Change-Id: Id4ea2a9c5d87158f0cfa9a88bc5c9296770a6a9b Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-24Rework mixer answer handlingJonathan Aillet1-4/+23
Rework mixer answer handling to make it simpler and to avoid fanciful returns. Add some error prints to help diagnostic in case of mixer answer handling error. BUG-AGL : SPEC-2329 Change-Id: I14fe86496585bdc66b8aa761f4ff2c56333c5515 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-24Remove obsolete links to softmixer controlsJonathan Aillet1-51/+9
Remove obsolete links to playbacks/captures softmixer controls. These links are not used anymore (only 'halmap' controls are used). It also means that references to controls in 'halmixer' section of json configuration files must be removed (as it's done for example json configuration file in this commit). BUG-AGL : SPEC-2329 Change-Id: Ic5a7f055d09b44021d817c04d56023fed3c0e478 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-24Add forgotten verifications of allocation resultsJonathan Aillet1-31/+93
Concern several types of allocation such as : - malloc/calloc - json_object_new_* - wrap_json_pack - strdup BUG-AGL: SPEC-2329 Change-Id: Iffe2a6a44ef4df2ed0ec4d159682159db5e78cfb Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-24Add freeing of halmap data table in case of errorJonathan Aillet1-0/+1
Add freeing of halmap data table in case of error when parsing 'halmap' section. BUG-AGL: SPEC-2329 Change-Id: Ic2c819dfc3155122ade0f37bb06fa304f4859779 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-24Normalize coding style among repositoryJonathan Aillet1-39/+56
Normalize coding style among project : - When possible, set the variable outside test in 'if' statement. - Remove fanciful returns. - Split too long lines. - Remove unnecessary '\n' into prints. - Normalize use of tabulation. - Use 'afb_req_fail' instead of 'afb_req_fail_f' when possible. - Add some error prints. BUG-AGL: SPEC-2329 Change-Id: I14867e05e02b4c4c0389108c335fec2d2aa27495 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2019-05-24Reorganize repository directoriesJonathan Aillet1-0/+790
Reorganize repository directories to clarify code use. BUG-AGL: SPEC-2329 Change-Id: Ia9be0c1818cb2e331e75b51a87fcb2820407c1d8 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>