initscript: update to fix stop timeout with systemd [release 20130728git-4mamba;Tue Sep 17 2013]

This commit is contained in:
Silvan Calarco 2024-01-05 20:55:23 +01:00
parent 1907f5cb69
commit 33b48ba3dd
4 changed files with 156 additions and 0 deletions

View File

@ -1,2 +1,4 @@
# brcm_patchram
This service downloads a patchram files in the HCD format to Broadcom Bluetooth based silicon and combo chips and and other utility functions.

45
brcm-patchram-init Normal file
View File

@ -0,0 +1,45 @@
#!/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

29
brcm-patchram-sysconfig Normal file
View File

@ -0,0 +1,29 @@
#
# brcm-patchram configuration
#
if [ -r /etc/sysconfig/bluetooth ]; then
BD_ADDR=`cat /etc/sysconfig/bluetooth`
else
BD_ADDR=`ifconfig wlan0 | grep HWaddr | awk '{ print $5 }'`
[ "$BD_ADDR" ] || BD_ADDR="01:02:03:04:05:06"
fi
# Hannspad
if [ -d /sys/devices/platform/smba1002-pm-bt ]; then
BAUD_RATE=3000000
UART_DEVICE_NAME=/dev/ttyHS2
PATCHRAM_FILE=/lib/firmware/BCM4329B1.hcd
BD_OPT_ADD="--enable_lpm"
elif [ -e /dev/ttySAC0 ]; then
# Samsung Galaxy Note 10.1
BAUD_RATE=4000000
UART_DEVICE_NAME=/dev/ttySAC0
PATCHRAM_FILE=/lib/firmware/bcm4334.hcd
BD_OPT_ADD="--enable_hci --enable_lpm --no2bytes --tosleep 50000 --use_baudrate_for_download --i2s=1,1,0,1"
elif [ -e /dev/ttyHS2 ]; then
# Iconia A200/A500
BAUD_RATE=3000000
UART_DEVICE_NAME=/dev/ttyHS2
PATCHRAM_FILE=/lib/firmware/bcm4329.hcd
BD_OPT_ADD="--enable_lpm"
fi

80
brcm_patchram.spec Normal file
View File

@ -0,0 +1,80 @@
Name: brcm_patchram
Version: 20130728git
Release: 4mamba
Summary: Patchram files downloader for Broadcom Bluetooth based silicon and combo chips
Group: System/Kernel and Hardware
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://code.google.com/p/broadcom-bluetooth
Source: https://code.google.com/p/broadcom-bluetooth.git/master/broadcom-bluetooth-%{version}.tar.bz2
#Source: brcm_patchram-%{version}.tar.xz
Source1: brcm-patchram-init
Source2: brcm-patchram-sysconfig
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libbluetooth-devel
## AUTOBUILDREQ-END
Requires: rfkill
Requires: broadcom-firmware
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
This service downloads a patchram files in the HCD format to Broadcom Bluetooth based silicon and combo chips and and other utility functions.
%prep
%setup -q -n broadcom-bluetooth-%{version}
%build
%make
%install
install -D -m0755 brcm_patchram_plus %{buildroot}%{_sbindir}/brcm_patchram_plus
install -D -m0755 brcm_patchram_plus_usb %{buildroot}%{_sbindir}/brcm_patchram_plus_usb
install -D -m0755 %{SOURCE1} %{buildroot}%{_initrddir}/brcm-patchram
install -D -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/brcm-patchram
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post
if [ $1 -eq 1 ]; then
/sbin/chkconfig --add brcm-patchram
service brcm-patchram stop
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
# uninstall
service brcm-patchram stop
/sbin/chkconfig --del brcm-patchram
fi
exit 0
%files
%defattr(-,root,root)
%{_initrddir}/brcm-patchram
%config %{_sysconfdir}/sysconfig/brcm-patchram
%{_sbindir}/brcm_patchram_plus
%{_sbindir}/brcm_patchram_plus_usb
%changelog
* Tue Sep 17 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 20130728git-4mamba
- initscript: update to fix stop timeout with systemd
* Mon Jul 29 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 20130728git-3mamba
- require broadcom-firmware
* Mon Jul 29 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 20130728git-2mamba
- added support for Samsung Galaxy Note 10.1
* Sun Jul 28 2013 Silvan Calarco <silvan.calarco@mambasoft.it> 20130728git-1mamba
- update to 20130728git
* Mon Mar 05 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 0.2-1mamba
- update to 0.2
* Sun Nov 27 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 0.1-1mamba
- package created by autospec