From 6f08f2d0d84cb47db8752737d4ba537457783bbd Mon Sep 17 00:00:00 2001 From: Patrick Yavitz Date: Sun, 3 Aug 2025 06:15:00 -0400 Subject: [PATCH] aic-bluetooth: Targeted process management and error handling Signed-off-by: Patrick Yavitz --- packages/bsp/aic8800/aic-bluetooth | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/bsp/aic8800/aic-bluetooth b/packages/bsp/aic8800/aic-bluetooth index 12b310691..8839679fb 100755 --- a/packages/bsp/aic8800/aic-bluetooth +++ b/packages/bsp/aic8800/aic-bluetooth @@ -1,15 +1,23 @@ #!/bin/bash -# HW Reset -hciattach -r -s 1500000 /dev/ttyS1 any 1500000 flow nosleep > /dev/null 2>&1 +set -e -# Kill hciattach +# HW Reset +if ! hciattach -r -s 1500000 /dev/ttyS1 any 1500000 flow nosleep > /dev/null 2>&1; then + echo "Failed to reset HCI device" >&2 + exit 1 +fi + +# Kill process using device sleep .50 -killall hciattach +pkill -f "/dev/ttyS1" || true # Attach Bluetooth HCI UART sleep .50 -hciattach -s 1500000 /dev/ttyS1 any 1500000 flow nosleep > /dev/null 2>&1 +if ! hciattach -s 1500000 /dev/ttyS1 any 1500000 flow nosleep > /dev/null 2>&1; then + echo "Failed to attach HCI device" >&2 + exit 1 +fi rfkill unblock all exit 0