Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions ovos_PHAL/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,40 @@ def is_respeaker_2mic():


def is_respeaker_4mic():
cmd = 'i2cdetect -y -a 0x35 0x35 | egrep "(35|UU)" | awk \'{print $2}\''
cmd = 'i2cdetect -y -a 1 0x3b 0x3b | egrep "(3b|UU)" | awk \'{print $2}\''
out = subprocess.check_output(cmd, shell=True).strip()
if out == b"35" or out == b"UU":
if out == b"3b" or out == b"UU":
return True
return False


def is_respeaker_6mic():
cmd = 'i2cdetect -y -a 0x3b 0x3b | egrep "(3b|UU)" | awk \'{print $2}\''
cmd = 'i2cdetect -y -a 1 0x35 0x35 | egrep "(35|UU)" | awk \'{print $2}\''
out = subprocess.check_output(cmd, shell=True).strip()
if out == b"3b" or out == b"UU":
if out == b"35" or out == b"UU":
return True
return False


def is_adafruit():
cmd = 'i2cdetect -y -a 0x4b 0x4b | egrep "(4b|UU)" | awk \'{print $2}\''
cmd = 'i2cdetect -y -a 1 0x4b 0x4b | egrep "(4b|UU)" | awk \'{print $2}\''
out = subprocess.check_output(cmd, shell=True).strip()
if out == b"4b" or out == b"UU":
return True
return False


def is_texas_tas5806():
cmd = 'i2cdetect -y -a 0x2f 0x2f | egrep "(2f|UU)" | awk \'{print $2}\''
cmd = 'i2cdetect -y -a 1 0x2f 0x2f | egrep "(2f|UU)" | awk \'{print $2}\''
out = subprocess.check_output(cmd, shell=True).strip()
if out == b"2f" or out == b"UU":
return True
return False

def is_aiy_voicebonnet():
# def is_aiy_voicebonnet_mic():
cmd = 'i2cdetect -y -a 1 0x52 0x52 | egrep "(52|UU)" | awk \'{print $2}\''
out = subprocess.check_output(cmd, shell=True).strip()
if out == b"52" or out == b"UU":
return True
return False