I'm using terminal bluetooth client to scan for BLE devices. When I encounter a device by name 'Ac2', I would like to stop searching (stop Popen and continue in my code) and read the particular line in which the device was encountered, for extracting it's MAC address.
I'm using hcitool to scan (following line of code)
child = subprocess.Popen(['sudo', '/usr/local/bin/hcitool', 'lescan'], stdout = subprocess.PIPE)
Now how do I check whether device 'Ac2' has been found or not? And how do I read the line where it was found?