bluez5-init: ccimx93: modify script to support suspend/resume
The BT chip for the ccimx93 cannot be turned off, nor can it be re-uploaded. Therefore, we need to set some conditions to assume that it is going to be attached correctly. The changes in this script take care of that. Upon the first attachment, the rate is set to 3M, and future uses will always be done at this rate. If, for any reason, it was not stopped and the chip is already attached, do nothing. https://onedigi.atlassian.net/browse/DEL-8464 Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
parent
ac1e4633fb
commit
06e84d1b7b
|
|
@ -45,14 +45,22 @@ bluetooth_start() {
|
|||
return
|
||||
fi
|
||||
|
||||
hciattach -t5 /dev/ttyBt any 115200 flow nosleep && \
|
||||
hciconfig ${HCI_IFACE} up && \
|
||||
sleep 0.2 && \
|
||||
set_btaddr && \
|
||||
hcitool -i ${HCI_IFACE} cmd 0x3f 0x0009 0xc0 0xc6 0x2d 0x00 && \
|
||||
sleep 0.2 && \
|
||||
killall hciattach && \
|
||||
sleep 0.2 && \
|
||||
# If there is a hciattach process running, just do nothing
|
||||
pidof hciattach > /dev/null && log "Bluetooth already activated" && return
|
||||
|
||||
# If port speed is 3M, assume that FW has been modified to run at that speed
|
||||
if [ "$(stty -F /dev/ttyBt speed)" != "3000000" ]; then
|
||||
hciattach -t5 /dev/ttyBt any 115200 flow nosleep && \
|
||||
hciconfig ${HCI_IFACE} up && \
|
||||
sleep 0.2 && \
|
||||
set_btaddr && \
|
||||
# Change rate to 3M using a custom vendor command
|
||||
hcitool -i ${HCI_IFACE} cmd 0x3f 0x0009 0xc0 0xc6 0x2d 0x00 && \
|
||||
sleep 0.2 && \
|
||||
killall hciattach && \
|
||||
sleep 0.2
|
||||
fi
|
||||
|
||||
hciattach -t5 /dev/ttyBt any -s 3000000 3000000 flow && \
|
||||
hciconfig ${HCI_IFACE} up && \
|
||||
sleep 0.2 && \
|
||||
|
|
@ -65,12 +73,10 @@ bluetooth_start() {
|
|||
|
||||
bluetooth_stop() {
|
||||
if [ -e "/sys/class/bluetooth/${HCI_IFACE}" ]; then
|
||||
# hci reset command
|
||||
hcitool -i ${HCI_IFACE} cmd 0x03 0x0003
|
||||
sleep 0.2
|
||||
# set baudrate to 115200
|
||||
hcitool -i ${HCI_IFACE} cmd 0x3f 0x0009 0x00 0xc2 0x01 0x00
|
||||
killall hciattach
|
||||
killall hciattach > /dev/null
|
||||
sleep 1
|
||||
# send a raw hci reset to set the chip in a good state
|
||||
echo -e -n \\x01\\x03\\x0c\\x00 > /dev/ttyBt
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue