summaryrefslogtreecommitdiffstats
path: root/meta-audio-4a-framework/recipes-multimedia/agl-service-audio-4a/agl-service-audio-4a_git.bb
blob: 5165f949db091f5405b82100b1b87db0f5ff22b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
SUMMARY     = "4A - High Level Audio API Service"
DESCRIPTION = "High Level Audio API service used in 4A (AGL Advanced Audio Agent)"
HOMEPAGE    = "https://git.automotivelinux.org/apps/agl-service-audio-4a/"
SECTION     = "apps"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"

SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/apps/agl-service-audio-4a;protocol=https;branch=${AGL_BRANCH}"
SRCREV = "${AUTOREV}"

PV = "0.1"
S  = "${WORKDIR}/git"

inherit cmake aglwgt pkgconfig

DEPENDS += "alsa-lib json-c systemd af-binder glib-2.0"

do_aglwgt_deploy_append() {
	cat <<'EOF' >${D}/${sysconfdir}/agl-postinsts/99_4A_service_patch.sh
N=600
svcfile="/usr/local/lib/systemd/*/afm-service-agl-service-audio-4a*.service"
set -x
echo "-- TMP 4A INSTALL FIX from meta-agl/meta-app-framework/recipes-multimedia/agl-service-audio-4a/agl-service-audio-4a_git.bb - MUST BE REMOVED !!!"
while ! ls $svcfile > /dev/null; do
	if [ $N = 0 ]; then echo "-- TMP 4A INSTALL NOT FIXED"; exit 0; fi
	echo .
	sleep 0.2
	N=$(expr $N - 1)
done
sed -i -e 's|/usr/bin/afb-daemon\>|& --ldpath=/usr/libexec/agl/afb-aaaa/lib:/usr/libexec/agl/4a-alsa-core/lib|' $svcfile
echo "-- TMP 4A INSTALL FIX END"

EOF
	chmod a+x ${D}/${sysconfdir}/agl-postinsts/99_4A_service_patch.sh
}
/span> AFB:servsync(hal["api"],"ctlget", {["label"]=label}) -- if no error save current volume and set adjustment if (err ~= nil) then local response= result["response"] printf ("--- Response %s=%s", hal["api"], Dump_Table(response)) if (response == nil) then printf ("--- Fail to Activate '%s'='%s' result=%s", hal["api"], label, Dump_Table(result)) return 1 -- unhappy end -- save response in global space _CurrentHalVolume [hal["api"]] = response -- finally set the new value local query= { ["tag"]= response["tag"], ["val"]= adjustment } -- best effort to set adjustment value AFB:servsync(hal["api"],"ctlset",query) end else -- when label is release reverse action at preempt time if (_CurrentHalVolume [hal["api"]] ~= nil) then printf("--- Restoring initial volume HAL=%s Control=%s", hal["api"], _CurrentHalVolume [hal["api"]]) AFB:servsync(hal["api"],"ctlset", _CurrentHalVolume [hal["api"]]) end end end return 0 -- happy end end -- Temporally adjust volume function _Temporarily_Control(source, control, client) printf ("[--> _Temporarily_Control -->] source=%d control=%s client=%s", source, Dump_Table(control), Dump_Table(client)) -- Init should have been properly done if (_Global_Context["registry"] == nil) then AFB:error ("--* (Hoops) No Hal in _Global_Context=%s", Dump_Table(_Global_Context)) return 1 end -- make sure label as valid if (control["ctl"] == nil or control["val"] == nil) then AFB:error ("--* Action Ignore no/invalid control=%s", Dump_Table(control)) return 1 -- unhappy end if (source == 0) then AFB:info("-- Adjust %s=%d", control["ctl"], control["val"]) local error=Apply_Hal_Control(source, control["ctl"], control["val"]) if (error == nil) then return 1 -- unhappy end AFB:notice ("[<-- _Temporarily_Control Granted<--]") else Apply_Hal_Control(source, control["ctl"],0) AFB:notice ("[<-- _Temporarily_Control Restore--]") end return 0 -- happy return end -- Permanent Adjust volume function _Permanent_Control(source, control, client) printf ("[--> _Permanent_Control -->] source=%d control=%s client=%s", source, Dump_Table(control), Dump_Table(client)) -- Init should have been properly done if (_Global_Context["registry"] == nil) then AFB:error ("--* (Hoops) No Hal in _Global_Context=%s", Dump_Table(_Global_Context)) return 1 end -- make sure label as valid if (control["ctl"] == nil or control["val"] == nil) then AFB:error ("--* Action Ignore no/invalid control=%s", Dump_Table(control)) return 1 -- unhappy end if (source == 0) then AFB:info("-- Adjust %s=%d", control["ctl"], control["val"]) local error=Apply_Hal_Control(1, control["ctl"], control["val"]) if (error == nil) then return 1 -- unhappy end AFB:notice ("[<-- _Permanent_Control Granted<--]") else Apply_Hal_Control(source, control["ctl"],0) AFB:notice ("[<-- _Permanent_Control Restore--]") end return 0 -- happy return end