From bc5a22f88380721c618af7f333f4dd672d65e380 Mon Sep 17 00:00:00 2001 From: Arturo Buzarra Date: Fri, 18 Oct 2019 09:41:58 +0200 Subject: [PATCH] bluez5: add support to ccimx8mn platform Add initial support cloned from ccimx8x-sbc-pro. https://jira.digi.com/browse/DEL-6806 Signed-off-by: Arturo Buzarra --- .../bluez/bluez5-5.50/ccimx8mn/bluetooth-init | 69 +++++++++++++++++++ .../bluez/bluez5-5.50/ccimx8mn/main.conf | 12 ++++ .../bluez/bluez5_5.50.bbappend | 3 +- 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/ccimx8mn/bluetooth-init create mode 100644 meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/ccimx8mn/main.conf diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/ccimx8mn/bluetooth-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/ccimx8mn/bluetooth-init new file mode 100644 index 000000000..01f57c95f --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/ccimx8mn/bluetooth-init @@ -0,0 +1,69 @@ +#!/bin/sh +#=============================================================================== +# +# Copyright (C) 2018,2019 by Digi International Inc. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. +# +# +# !Description: Initialize bluetooth hardware +# +#=============================================================================== + +bluetooth_init() { + # Get MAC address from the device tree. Use a default value if it has not been set. + BT_MACADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address 2>/dev/null | sed 's/:$//g')" + if [ -z "${BT_MACADDR}" ] || [ "${BT_MACADDR}" = "00:00:00:00:00:00" ]; then + BT_MACADDR="00:04:F3:FF:FF:BB" + fi + + # Start the Bluetooth driver and bring up the interface + HCIATTACH_LOG="/var/log/hciattach.log" + + for RETRY in $(seq 1 5) + do + killproc hciattach + modprobe btdigi + if hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then + return + fi + rmmod btdigi + sleep 1 + done + BT_ERROR="FAIL (hciattach)" +} + +# Source function library +. /etc/init.d/functions + +case "$1" in + start) + if [ -d "/proc/device-tree/bluetooth" ]; then + if [ "$(tr -d '\0' 2>/dev/null