]> git.pld-linux.org Git - packages/bluez.git/blame - btattach-bcm-service.sh
up to 5.60
[packages/bluez.git] / btattach-bcm-service.sh
CommitLineData
477801c9
JR
1#!/bin/sh
2
3# Simple shell script to wait for the tty for an uart using BT HCI to show up
4# and then invoke btattach with the right parameters, this is intended to be
5# invoked from a hardware-activated systemd service
6#
7# For now this only suports ACPI enumerated Broadcom BT HCIs.
8# This has been tested on Bay and Cherry Trail devices with both ACPI and
9# PCI enumerated UARTs.
10#
11# Note the kernel bt developers are working on solving this entirely in the
12# kernel, so it is not worth the trouble to write something better then this.
13
14BT_DEV="/sys/bus/platform/devices/$1"
15BT_DEV="$(readlink -f $BT_DEV)"
16UART_DEV="$(dirname $BT_DEV)"
17
18# Stupid GPD-pocket has USB BT with id 0000:0000, but still claims to have
19# an uart attached bt
20if [ "$1" = "BCM2E7E:00" ] && lsusb | grep -q "ID 0000:0000"; then
21 exit 0
22fi
23
24while [ ! -d "$UART_DEV/tty" ]; do
25 sleep .2
26done
27
28TTY="$(ls $UART_DEV/tty)"
29
30exec btattach --bredr "/dev/$TTY" -P bcm
This page took 0.025204 seconds and 4 git commands to generate.