How to verify Bluetooth?
-
I have "upgraded" to Ubuntu 23.04. "Discovered"it is lacking Bluetooth. Used this opportunity to test "verify Bluetooth " in my code using "bluetoothctl". The command responds correctly , but "gets stuck " in "Waiting to connect to bluetoothd...". Used same command in "terminal" with same result. Can somebody suggest similar command or "bluetoothctl"command option (timeout ?)so it does detect lack of Bluetooth, but does not get stuck. Temporary , I do verify Bluetooth not working by looking for "Agent registered " failure - which is correct response when Bluetooth is OK, actually running. Then if it runs I can "exit" from command. Help is much appreciated. Thanks
nov25-1@nov251-desktop:~$ bluetoothctl
Waiting to connect to bluetoothd... -
I have "upgraded" to Ubuntu 23.04. "Discovered"it is lacking Bluetooth. Used this opportunity to test "verify Bluetooth " in my code using "bluetoothctl". The command responds correctly , but "gets stuck " in "Waiting to connect to bluetoothd...". Used same command in "terminal" with same result. Can somebody suggest similar command or "bluetoothctl"command option (timeout ?)so it does detect lack of Bluetooth, but does not get stuck. Temporary , I do verify Bluetooth not working by looking for "Agent registered " failure - which is correct response when Bluetooth is OK, actually running. Then if it runs I can "exit" from command. Help is much appreciated. Thanks
nov25-1@nov251-desktop:~$ bluetoothctl
Waiting to connect to bluetoothd... -
I have "upgraded" to Ubuntu 23.04. "Discovered"it is lacking Bluetooth. Used this opportunity to test "verify Bluetooth " in my code using "bluetoothctl". The command responds correctly , but "gets stuck " in "Waiting to connect to bluetoothd...". Used same command in "terminal" with same result. Can somebody suggest similar command or "bluetoothctl"command option (timeout ?)so it does detect lack of Bluetooth, but does not get stuck. Temporary , I do verify Bluetooth not working by looking for "Agent registered " failure - which is correct response when Bluetooth is OK, actually running. Then if it runs I can "exit" from command. Help is much appreciated. Thanks
nov25-1@nov251-desktop:~$ bluetoothctl
Waiting to connect to bluetoothd...I certainly cannot find a way to change a timeout for it. Presumably this is your actual situation since it was not clear whether you fixed the first. 1. Bluetooth is not installed 2. You ran the command. 3. It blocks. Given that then in terms of error detection for a tool you would need to do the following 1. Code something that can run the command asynchronously such as a thread. 2. The caller initiates the call with a timer (that will expire.) 3. If the timer fires a timeout then the tool reports 'bluetooth not found' 4. If the command returns (before the timeout) cancel the timer, then process the results from the command.
-
I have "upgraded" to Ubuntu 23.04. "Discovered"it is lacking Bluetooth. Used this opportunity to test "verify Bluetooth " in my code using "bluetoothctl". The command responds correctly , but "gets stuck " in "Waiting to connect to bluetoothd...". Used same command in "terminal" with same result. Can somebody suggest similar command or "bluetoothctl"command option (timeout ?)so it does detect lack of Bluetooth, but does not get stuck. Temporary , I do verify Bluetooth not working by looking for "Agent registered " failure - which is correct response when Bluetooth is OK, actually running. Then if it runs I can "exit" from command. Help is much appreciated. Thanks
nov25-1@nov251-desktop:~$ bluetoothctl
Waiting to connect to bluetoothd... -
Sorry for delay, had to move my PC and it all broke. Appreciate both suggestions, will use both. While testing, found out that some commands requires "boot access" on "check if enabled" and no "root access" "enable service" -- weird and incontinent.
Found bluetoothctl --timeout BUT it is not working as expected. Any idea ? ( Maybe it is not going to work when no bluettoth is NOT running ?)
nov25-1@nov251-desktop:~$ bluetoothctl --timeout
bluetoothctl: option '--timeout' requires an argument
bluetoothctl ver 5.66
Usage:
bluetoothctl [--options] [commands]
Options:
--agent Register agent handler: --endpoints Register Media endpoints
--monitor Enable monitor output
--timeout Timeout in seconds for non-interactive mode
--version Display version
--help Display help
nov25-1@nov251-desktop:~$ bluetoothctl --timeout 20
Waiting to connect to bluetoothd... -
Found bluetoothctl --timeout BUT it is not working as expected. Any idea ? ( Maybe it is not going to work when no bluettoth is NOT running ?)
nov25-1@nov251-desktop:~$ bluetoothctl --timeout
bluetoothctl: option '--timeout' requires an argument
bluetoothctl ver 5.66
Usage:
bluetoothctl [--options] [commands]
Options:
--agent Register agent handler: --endpoints Register Media endpoints
--monitor Enable monitor output
--timeout Timeout in seconds for non-interactive mode
--version Display version
--help Display help
nov25-1@nov251-desktop:~$ bluetoothctl --timeout 20
Waiting to connect to bluetoothd...That's pretty clear. You need to tell bluetoothctl how long to wait e.g.
bluetoothctl --timeout 2
should time out after 2 seconds. Who knows, maybe you could even use a floating point value e.g.--timeout 1.5
for finer grain control. Normally, though, a long option is specified as--timeout=2
, so you might try that as well if the above does not work. I've checked a few of web sites, but none of them were able to help in this regard. Still a little experimentation on your part should clear that up. When you get it sorted, maybe post a note the to the maintainers that it needs to be explained better.Keep Calm and Carry On