Closed rparkins999 closed 3 months ago
Oops, markdown thinks # is a heading. The crontab
code should be
# Force bluetooth to reconnect my phone if connection lost because I walked out of range
# runs every minute
- * root /etc/bluetooth/bluetooth-autoconnect
This has come up in the issues a few times. Please review the closed issues for more detailed discussions on this matter, but the simple answer is: it can't know when a device is brought back into range and at least one of the devices would need to continually scan / probe. This can trivially be solved with a cron job like yours above. If you only want to scan for a specific device with a known mac address you could instead use bluetoothctl connect <mac_address>
which will no-op (except for log spam) if the device is already connected.
P.S. you can open a code block with triple backticks. E.g. but without the leading backslashes:
\```
# code here
\```
At present the script only tries to reconnect if it detects a new adapter. If a connected device is a phone being carried by its owner, the connection will be dropped if the owner walks away from the computer and stays out of bluetooth range for a while. It would be nice to automatically reconnect the phone when it comes back into range. In the meantime this
crontab
entry might helpForce bluetooth to reconnect my phone if connection lost because I walked out of range
runs every minute
- * root /etc/bluetooth/bluetooth-autoconnect