Home > Blockchain >  How can I scan for a bluetooth device in a script?
How can I scan for a bluetooth device in a script?

Time:10-17

I know I can use bluetoothctl scan on to scan for a device. But when I want to use this in a bash script, this is not usable, as this command never ends.

I would like a command that scans for say 30 seconds and prints whatever it found to standard out.

Is that possible with bluetoothctl or any other tool?

CodePudding user response:

you can use --timeout <seconds> to use it in non interactive mode e.g:

bluetoothctl --timeout 20 scan on

It will stop the scan after 20 sec

  • Related