mirror of
https://github.com/furrtek/PrecIR.git
synced 2026-03-29 18:30:31 +00:00
Silence warning; Fix port selection on OS X
This commit is contained in:
@@ -3,6 +3,12 @@
|
||||
# See LICENSE
|
||||
|
||||
import serial
|
||||
import os
|
||||
import re
|
||||
|
||||
if os.name == 'posix':
|
||||
from serial.tools.list_ports_posix import comports
|
||||
|
||||
|
||||
def try_serialport(comport):
|
||||
try:
|
||||
@@ -43,6 +49,17 @@ def search_esl_blaster():
|
||||
found = True
|
||||
break
|
||||
|
||||
# Mac
|
||||
if found == False:
|
||||
r = re.compile('usbmodem', re.I)
|
||||
for info in comports():
|
||||
comport, desc, hwid = info
|
||||
if r.search(comport):
|
||||
result = try_serialport(comport)
|
||||
if result[0]:
|
||||
found = True
|
||||
break
|
||||
|
||||
if found == False:
|
||||
print("Could not find ESL Blaster.")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user