mirror of https://github.com/ARMmbed/mbed-os.git
Tests: USB: Wait before closing host's port
This delay eliminates the possibility of the device detecting the port being closed when still waiting for data.pull/9768/head
parent
7b80cb6586
commit
dbfd43a098
|
|
@ -32,6 +32,7 @@ MSG_KEY_LOOPBACK = 'loopback'
|
|||
MSG_KEY_CHANGE_LINE_CODING = 'change_lc'
|
||||
|
||||
RX_BUFF_SIZE = 32
|
||||
TERM_CLOSE_DELAY = 0.01
|
||||
TERM_REOPEN_DELAY = 0.1
|
||||
LINE_CODING_STRLEN = 13
|
||||
|
||||
|
|
@ -181,6 +182,7 @@ class USBSerialTest(mbed_host_tests.BaseHostTest):
|
|||
return
|
||||
while mbed_serial.out_waiting > 0:
|
||||
time.sleep(0.001)
|
||||
time.sleep(TERM_CLOSE_DELAY)
|
||||
mbed_serial.close()
|
||||
|
||||
def loopback(self, usb_id_str):
|
||||
|
|
@ -212,6 +214,7 @@ class USBSerialTest(mbed_host_tests.BaseHostTest):
|
|||
return
|
||||
while mbed_serial.out_waiting > 0:
|
||||
time.sleep(0.001)
|
||||
time.sleep(TERM_CLOSE_DELAY)
|
||||
mbed_serial.close()
|
||||
|
||||
def change_line_coding(self, usb_id_str):
|
||||
|
|
@ -249,6 +252,7 @@ class USBSerialTest(mbed_host_tests.BaseHostTest):
|
|||
self.log('TEST ERROR: {}'.format(exc))
|
||||
self.notify_complete(False)
|
||||
return
|
||||
time.sleep(TERM_CLOSE_DELAY)
|
||||
mbed_serial.close()
|
||||
|
||||
def setup(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue