summaryrefslogtreecommitdiff
path: root/recipes-support/btuart/btuart.bb
blob: dabe9d43e7bbb39a0d38321b63eb8fd860e34fa7 (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
37
SUMMARY = "Initialize Bluetooth UART"
DESCRIPTION = "At runtime on target make sure appropriate firmware is used and initialize Bluetooth UART"
LICENSE = "PD"

PACKAGE_ARCH = "${MACHINE_ARCH}"

RRECOMMENDS:${PN} = "bluez5"

SRC_URI = " \
    file://btuart.sh \
    file://btuart.service \
    file://COPYING \
"

LIC_FILES_CHKSUM = "file://${WORKDIR}/COPYING;md5=1c3a7fb45253c11c74434676d84fe7dd"

do_install () {
    install -d ${D}/${sbindir}
    install -m 0755 ${WORKDIR}/*.sh ${D}/${sbindir}

    install -d ${D}${systemd_unitdir}/system/
    install -m 0644 ${WORKDIR}/btuart.service ${D}${systemd_unitdir}/system
}

SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} = "btuart.service"

inherit allarch systemd

pkg_postinst_ontarget:${PN}:verdin-imx8mp () {
    # only BT UART modules need our service
    if fgrep -q V1.0 /proc/device-tree/toradex,board-rev || ! fgrep -q toradex,verdin-imx8mp-wifi /proc/device-tree/compatible; then
        /bin/systemctl disable btuart.service
        /bin/systemctl stop btuart.service
        exit 0
    fi
}