Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | SUMMARY = "Script to properly configure BT-HCI on Raspberry Pi" |
| 2 | HOMEPAGE = "https://github.com/RPi-Distro/pi-bluetooth" |
| 3 | SECTION = "kernel" |
| 4 | LICENSE = "BSD-3-Clause" |
| 5 | LIC_FILES_CHKSUM = "\ |
| 6 | file://debian/copyright;md5=6af8de3c8ee71f8e91e9b22f84ff2022 \ |
| 7 | " |
| 8 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 9 | SRC_URI = "\ |
| 10 | git://github.com/RPi-Distro/pi-bluetooth \ |
| 11 | file://0001-bthelper-correct-path-for-hciconfig-under-Yocto.patch \ |
| 12 | " |
Andrew Geissler | a4353c8 | 2021-06-25 14:23:27 -0500 | [diff] [blame] | 13 | SRCREV = "fd4775bf90e037551532fc214a958074830bb80d" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 14 | |
| 15 | S = "${WORKDIR}/git" |
| 16 | |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 17 | inherit ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 'update-rc.d', d)} |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 18 | # hciuart.service replaces what was brcm43438.service |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 19 | SYSTEMD_SERVICE:${PN} = "\ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 20 | hciuart.service \ |
| 21 | bthelper@.service \ |
| 22 | " |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 23 | INITSCRIPT_NAME = "btuart" |
| 24 | INITSCRIPT_PARAMS = "start 18 2 3 4 5 ." |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 25 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 26 | do_install() { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 27 | install -d ${D}${sysconfdir}/udev/rules.d |
| 28 | install -m 0644 ${S}/lib/udev/rules.d/* ${D}${sysconfdir}/udev/rules.d |
| 29 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 30 | install -d ${D}${bindir} |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 31 | install -m 0755 ${S}/usr/bin/bthelper ${D}${bindir} |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 32 | install -m 0755 ${S}/usr/bin/btuart ${D}${bindir} |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 33 | |
| 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 Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 38 | else |
| 39 | install -d ${D}${sysconfdir}/init.d/ |
| 40 | cat > ${WORKDIR}/btuart.init << EOF |
| 41 | #!/bin/sh |
| 42 | /usr/bin/btuart |
| 43 | EOF |
| 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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 46 | fi |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 47 | } |
| 48 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 49 | FILES:${PN} = "\ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 50 | ${bindir} \ |
| 51 | ${sysconfdir} \ |
| 52 | ${systemd_unitdir}/system \ |
| 53 | " |
Brad Bishop | 870eb53 | 2020-01-06 09:44:45 -0500 | [diff] [blame] | 54 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 55 | RDEPENDS:${PN} += " \ |
Brad Bishop | 870eb53 | 2020-01-06 09:44:45 -0500 | [diff] [blame] | 56 | udev-rules-rpi \ |
| 57 | " |