From 3f23af5ad7251ec4304f8c379830f74148135d62 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Sun, 21 Dec 2025 21:12:15 +0800 Subject: [PATCH] fix(serial): add default handler for gsm Signed-off-by: sakumisu <1203593632@qq.com> --- class/serial/usbh_gsm.c | 14 ++++++++++++-- class/serial/usbh_serial.c | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/class/serial/usbh_gsm.c b/class/serial/usbh_gsm.c index a62e6798..63418736 100644 --- a/class/serial/usbh_gsm.c +++ b/class/serial/usbh_gsm.c @@ -63,6 +63,16 @@ static void usbh_gsm_detach(struct usbh_serial *serial) usb_osal_free(gsm_class); } +static int usbh_gsm_set_line_coding(struct usbh_serial *serial, struct cdc_line_coding *line_coding) +{ + return 0; +} + +static int usbh_gsm_set_line_state(struct usbh_serial *serial, bool dtr, bool rts) +{ + return 0; +} + static const struct usbh_serial_driver gsm_driver = { .driver_name = "gsm", @@ -72,9 +82,9 @@ static const struct usbh_serial_driver gsm_driver = { .attach = usbh_gsm_attach, .detach = usbh_gsm_detach, .set_flow_control = NULL, - .set_line_coding = NULL, + .set_line_coding = usbh_gsm_set_line_coding, .get_line_coding = NULL, - .set_line_state = NULL, + .set_line_state = usbh_gsm_set_line_state, .get_modem_status = NULL, }; diff --git a/class/serial/usbh_serial.c b/class/serial/usbh_serial.c index 5319f1e1..d6361b21 100644 --- a/class/serial/usbh_serial.c +++ b/class/serial/usbh_serial.c @@ -584,7 +584,7 @@ int usbh_serial_cdc_write_async(struct usbh_serial *serial, uint8_t *buffer, uin return -USB_ERR_INVAL; } - if (serial->ref_count > 0) { + if (serial->ref_count == 0) { return -USB_ERR_NODEV; } @@ -603,7 +603,7 @@ int usbh_serial_cdc_read_async(struct usbh_serial *serial, uint8_t *buffer, uint return -USB_ERR_INVAL; } - if (serial->ref_count > 0) { + if (serial->ref_count == 0) { return -USB_ERR_NODEV; }