firmware-murata-infineon: add service support for start/stop

https://onedigi.atlassian.net/browse/DEL-9287

Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
Isaac Hermida 2025-01-30 12:33:20 +01:00
parent 33f269d7cb
commit 2f5ccac0c6
2 changed files with 29 additions and 8 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh
#===============================================================================
#
# Copyright (C) 2024 by Digi International Inc.
# Copyright (C) 2024,2025 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
@ -24,15 +24,15 @@ log() {
fi
}
bt_power_cycle() {
bt_power() {
#CCMP2 BT_REG_EN GPIO PZ5
gpioset gpiochip11 5=0
sleep 0.5
gpioset gpiochip11 5=1
gpioset gpiochip11 5="${1}"
}
bt_init() {
bt_power_cycle
bt_power 0
sleep 0.5
bt_power 1
# Load Bluetooth firmware on device
mbt download /lib/firmware/brcm/CYW55500A1.hcd
# Attach serial UART to the Bluetooth stack
@ -47,4 +47,24 @@ bt_init() {
log info "OK"
}
bt_init
bt_stop() {
killall btattach
bt_power 0
}
case "$1" in
start)
bt_init
;;
stop)
bt_stop
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac

View File

@ -5,7 +5,8 @@ ConditionPathIsDirectory=/proc/device-tree/bluetooth
[Service]
Type=forking
ExecStart=/etc/cyw55512-bluetooth
ExecStart=/etc/cyw55512-bluetooth start
ExecStop=/etc/cyw55512-bluetooth stop
[Install]
WantedBy=multi-user.target suspend.target