I believe that the correct approach would be to handle the issue from the project's script. I mean, you could add an exception to the code for this kind of issue that could prevent the script from crashing; my idea is that the exception would make the Edison disconnect from the phone before it turns off. Another way to handle it is to have the script check for the RSSI (since you mentioned that RSSI is low) and if it gets too low, disconnect the Edison from the phone to prevent the issue.
I believe the issue is not in the BCM43340 but on the script, because it might not know what to do when the connection to the phone is lost so it needs to be restarted when it happens. Have you tried to just restart the script instead of the BCM43340 and the script? What happens?
thanks for your reply.
I already did "check for the RSSI and if it gets too low, disconnect the Edison from the phone."
but it doesn't work. because, It doen't get low rssi when phone is turning off.
instead of it,I can detect if rssi doesn't updated. (using check timeout..)
I checked it. and it works. so when I detect rssi update timeout, I call process.exit(1); and I use forever to restart my node.js application.
I'd like to know why is it happened?
could it be a bluez problem?
there is one thing I confused about what you said.
"Have you tried to just restart the script instead of the BCM43340 and the script? What happens?"
what does it mean?
I've understand like below..
if I restart my program without "rfkill block bluetooth" and "rfkill unblock bluetooth" ,
I get those messages.(I've told already..)
[ 2978.427043] Bluetooth: hci0 command 0x200a tx timeout
[ 2980.426796] Bluetooth: hci0 command 0x0406 tx timeout
[ 3267.976723] Bluetooth: hci0 command 0x0c01 tx timeout
[ 3269.976541] Bluetooth: hci0 command 0x2001 tx timeout
[ 3271.976128] Bluetooth: hci0 command 0x1001 tx timeout
[ 3273.975882] Bluetooth: hci0 command 0x0c6d tx timeout
[ 3275.975574] Bluetooth: hci0 command 0x0c6c tx timeout
[ 3277.975320] Bluetooth: hci0 command 0x1009 tx timeout
It doesn't happen everytime when phone is turning off.
sometimes it doesn't happen..(at that time, I can connect edison normally after rebooting phone )