This repository has been archived on 2024-11-07. You can view files and clone it, but cannot push or open issues or pull requests.
brcm_patchram/brcm-patchram-init

46 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/bin/bash
# brcm-patchram initscript
#
# chkconfig: 345 30 70
# description: Broadcom Bluetooth partchram file downloader
. /etc/sysconfig/rc
[ -r "$rc_functions" ] && . $rc_functions
case "$1" in
start)
# source function library
[ -e /etc/sysconfig/brcm-patchram ] || exit 0
. /etc/sysconfig/brcm-patchram
[ "$BD_ADDR" ] && BD_ADDR_ADD="--bd_addr $BD_ADDR"
[ -e $PATCHRAM_FILE -a -e $UART_DEVICE_NAME ] || exit 0
[ `pidof brcm_patchram_plus` ] && exit 0
echo -n "Starting Broadcom Bluetooh patchram loader: "
rfkill block bluetooth
rfkill unblock bluetooth
brcm_patchram_plus \
--enable_hci \
--baudrate $BAUD_RATE \
--patchram $PATCHRAM_FILE \
$BD_OPT_ADD \
$BD_ADDR_ADD \
$UART_DEVICE_NAME &>/dev/null &
evaluate_retval
echo
# Hannspad specific
[ -e /sys/devices/platform/smba1002-pm-bt/power_on ] && \
echo "1" > /sys/devices/platform/smba1002-pm-bt/power_on
exit 0
;;
stop)
echo -n "Stopping Broadcom Bluetooh patchram loader: "
killall -9 brcm_patchram_plus
evaluate_retval
echo
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac