blob: 1c3daffcb3e0a82d20d0da1fabf2ec0163db99a0 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001SUMMARY = "Script to properly configure BT-HCI on Raspberry Pi"
2HOMEPAGE = "https://github.com/RPi-Distro/pi-bluetooth"
3SECTION = "kernel"
4LICENSE = "BSD-3-Clause"
5LIC_FILES_CHKSUM = "\
6 file://debian/copyright;md5=6af8de3c8ee71f8e91e9b22f84ff2022 \
7"
8
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08009SRC_URI = "\
Andrew Geissler595f6302022-01-24 19:11:47 +000010 git://github.com/RPi-Distro/pi-bluetooth;branch=master;protocol=https \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080011 file://0001-bthelper-correct-path-for-hciconfig-under-Yocto.patch \
12"
Andrew Geisslera4353c82021-06-25 14:23:27 -050013SRCREV = "fd4775bf90e037551532fc214a958074830bb80d"
Brad Bishop316dfdd2018-06-25 12:45:53 -040014
15S = "${WORKDIR}/git"
16
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050017inherit ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 'update-rc.d', d)}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080018# hciuart.service replaces what was brcm43438.service
Patrick Williams213cb262021-08-07 19:21:33 -050019SYSTEMD_SERVICE:${PN} = "\
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080020 hciuart.service \
21 bthelper@.service \
22"
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050023INITSCRIPT_NAME = "btuart"
24INITSCRIPT_PARAMS = "start 18 2 3 4 5 ."
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080025
Brad Bishop316dfdd2018-06-25 12:45:53 -040026do_install() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080027 install -d ${D}${sysconfdir}/udev/rules.d
28 install -m 0644 ${S}/lib/udev/rules.d/* ${D}${sysconfdir}/udev/rules.d
29
Brad Bishop316dfdd2018-06-25 12:45:53 -040030 install -d ${D}${bindir}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080031 install -m 0755 ${S}/usr/bin/bthelper ${D}${bindir}
Brad Bishop316dfdd2018-06-25 12:45:53 -040032 install -m 0755 ${S}/usr/bin/btuart ${D}${bindir}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080033
34 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
35 install -d ${D}${systemd_system_unitdir}
36 install -m 0644 ${S}/debian/pi-bluetooth.bthelper@.service ${D}${systemd_system_unitdir}/bthelper@.service
37 install -m 0644 ${S}/debian/pi-bluetooth.hciuart.service ${D}${systemd_system_unitdir}/hciuart.service
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050038 else
39 install -d ${D}${sysconfdir}/init.d/
40 cat > ${WORKDIR}/btuart.init << EOF
41#!/bin/sh
42/usr/bin/btuart
43EOF
44 install -m 0755 ${WORKDIR}/btuart.init ${D}${sysconfdir}/init.d/btuart
45 sed -i -e 's:TAG+="systemd".*$:RUN+="/usr/bin/bthelper %k":' ${D}${sysconfdir}/udev/rules.d/90-pi-bluetooth.rules
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080046 fi
Brad Bishop316dfdd2018-06-25 12:45:53 -040047}
48
Patrick Williams213cb262021-08-07 19:21:33 -050049FILES:${PN} = "\
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080050 ${bindir} \
51 ${sysconfdir} \
52 ${systemd_unitdir}/system \
53"
Brad Bishop870eb532020-01-06 09:44:45 -050054
Patrick Williams213cb262021-08-07 19:21:33 -050055RDEPENDS:${PN} += " \
Brad Bishop870eb532020-01-06 09:44:45 -050056 udev-rules-rpi \
57"