You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using bluepy to passively scan for devices with manufacturer specific data (beacons, etc). Bluepy has issues if the scan is interrupted by other processes messing with the bluetooth subsystem. In my case this was another process using pygatt which by defaults resets the bluetooth stack before trying to connect by executing "sudo systemctl restart bluetooth" and "sudo hciconfig hci0 reset". Two cases:
interrupted by sudo hciconfig hci0 reset
... start a passive scan
Sent: le on
Got: 'rsp=$mgmt code=$success\n'
Sent: pasv
Got: 'rsp=$mgmt code=$success\n'
Got: "rsp=$stat state=$scan dst='(null) mtu=h0 sec='low\n"
Got: 'rsp=$scan addr=bE723780BBFFE type=h2 rssi=h4D flag=h0 d=b020106\n'
... Scan interrupted here by 'sudo hciconfig hci0 reset' in another process
... a little while later the scan timeout occurs
Select timeout
Sent: pasvend
... this is the dying gasp of bluepy-helper exiting
Got: ''
... sometime later try scanning again
Sent: le on
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/pi/mike/bluepy/test.py", line 91, in _worker
Test._scanner.scan(10.0, passive=True)
File "/home/pi/mike/bluepy/bluepy/btle.py", line 746, in scan
self.start(passive=passive)
File "/home/pi/mike/bluepy/bluepy/btle.py", line 684, in start
self._mgmtCmd("le on")
File "/home/pi/mike/bluepy/bluepy/btle.py", line 278, in _mgmtCmd
self._writeCmd(cmd + '\n')
File "/home/pi/mike/bluepy/bluepy/btle.py", line 274, in _writeCmd
self._helper.stdin.write(cmd)
IOError: [Errno 32] Broken pipe
interrupted by sudo systemctl restart bluetooth
... start passive scan
Sent: le on
Got: 'rsp=$mgmt code=$success\n'
Sent: pasv
Got: 'rsp=$mgmt code=$success\n'
Got: "rsp=$stat state=$scan dst='(null) mtu=h0 sec='low\n"
Got: 'rsp=$scan addr=bE723780BBFFE type=h2 rssi=h4E flag=h0 d=b020106\n'
Got: 'rsp=$scan addr=bE723780BBFFE type=h2 rssi=h50 flag=h0 d=b020106\n'
... Scan interrupted here by 'sudo systemctl restart bluetooth' in another process
... Extraneous response 'mgmt success' huh?
Got: 'rsp=$mgmt code=$success\n'
... sometime later try scanning again
Sent: le on
... fails out early with no scan results
Got: "rsp=$stat state=$disc mtu=h0 sec='low\n"
Stopping /home/pi/mike/bluepy/bluepy/bluepy-helper
The text was updated successfully, but these errors were encountered:
Using bluepy to passively scan for devices with manufacturer specific data (beacons, etc). Bluepy has issues if the scan is interrupted by other processes messing with the bluetooth subsystem. In my case this was another process using pygatt which by defaults resets the bluetooth stack before trying to connect by executing "sudo systemctl restart bluetooth" and "sudo hciconfig hci0 reset". Two cases:
interrupted by sudo hciconfig hci0 reset
interrupted by sudo systemctl restart bluetooth
The text was updated successfully, but these errors were encountered: