mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-10-01 03:43:51 +08:00
agnos 6.1 (#25973)
* agnos 6.1 * staging manifest * no casync * prod manifest
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import os
|
||||
import time
|
||||
import select
|
||||
from serial import Serial
|
||||
from crcmod import mkCrcFun
|
||||
@@ -11,18 +9,7 @@ class ModemDiag:
|
||||
self.pend = b''
|
||||
|
||||
def open_serial(self):
|
||||
def op():
|
||||
return Serial("/dev/ttyUSB0", baudrate=115200, rtscts=True, dsrdtr=True, timeout=0)
|
||||
try:
|
||||
serial = op()
|
||||
except Exception:
|
||||
# TODO: this is a hack to get around modemmanager's exclusive open
|
||||
print("unlocking serial...")
|
||||
os.system('sudo su -c \'echo "1-1.1:1.0" > /sys/bus/usb/drivers/option/unbind\'')
|
||||
os.system('sudo su -c \'echo "1-1.1:1.0" > /sys/bus/usb/drivers/option/bind\'')
|
||||
time.sleep(0.5)
|
||||
os.system("sudo chmod 666 /dev/ttyUSB0")
|
||||
serial = op()
|
||||
serial = Serial("/dev/ttyUSB0", baudrate=115200, rtscts=True, dsrdtr=True, timeout=0, exclusive=True)
|
||||
serial.flush()
|
||||
serial.reset_input_buffer()
|
||||
serial.reset_output_buffer()
|
||||
|
||||
Reference in New Issue
Block a user