fix(serial): fix host serial framework support for rt-thread

This commit is contained in:
MDLZCOOL
2025-12-15 00:34:17 +08:00
committed by sakumisu
parent 11b91a0283
commit 1cbe3c5957
4 changed files with 21 additions and 9 deletions

View File

@@ -389,7 +389,7 @@ static int usbh_serial_tiocmset(struct usbh_serial *serial, uint32_t set, uint32
line_state &= ~USBH_SERIAL_TIOCM_RTS;
}
dtr = (line_state & USBH_SERIAL_TIOCM_RTS) ? true : false;
dtr = (line_state & USBH_SERIAL_TIOCM_DTR) ? true : false;
rts = (line_state & USBH_SERIAL_TIOCM_RTS) ? true : false;
if (serial && serial->driver && serial->driver->set_line_state) {
@@ -643,6 +643,12 @@ int usbh_serial(int argc, char **argv)
return 0;
}
if (serial) {
if (!serial->hport || !serial->hport->connected) {
serial = NULL;
}
}
if (!serial) {
serial = usbh_serial_open(argv[1], USBH_SERIAL_O_RDWR | USBH_SERIAL_O_NONBLOCK);
if (!serial) {