in line'929' has error='string index out of range'
beacon loop bad data,skipping
def whichHCI():
ret = subprocess.Popen("hciconfig ",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()################################# BLE iBeaconScanner ----> end
# try again, sometimes does not return anything
if len(ret[0]) < 5:
time.sleep(0.5)
ret = subprocess.Popen("hciconfig ",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()################################# BLE iBeaconScanner ----> end
print "U.whichHCI, hciconfig 2. try: ",ret
lines = ret[0].split("\n")
hci={}
for ll in range(len(lines)):
if lines[ll].find("hci")>-1:
bus = lines[ll].split("Bus: ")[1]
hciNo = lines[ll].split(":")[0]
hci[hciNo] = {"bus":bus, "numb":int(hciNo[3:])}
if lines[ll+1].find("BD Address:")>-1:
mm=lines[ll+1].strip().split(" ")
if len(mm)>2:
hci[hciNo]["BLEmac"]= mm[2]
#hci1: Type: Primary Bus: UART
# BD Address: B8:27:EB:D4:E3:35 ACL MTU: 1021:8 SCO MTU: 64:1
# UP RUNNING
# RX bytes:2850 acl:21 sco:0 events:141 errors:0
# TX bytes:5581 acl:20 sco:0 commands:115 errors:0
#
#hci0: Type: Primary Bus: USB
# BD Address: 5C:F3:70:69:69:FB ACL MTU: 1021:8 SCO MTU: 64:1
# UP RUNNING
# RX bytes:11143 acl:0 sco:0 events:379 errors:0
# TX bytes:4570 acl:0 sco:0 commands:125 errors:0
if hci =={}: print lines
return hci
Users browsing this forum: No registered users and 23 guests