fix(serial): add default handler for gsm

Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
sakumisu
2025-12-21 21:12:15 +08:00
parent 34166b361a
commit 3f23af5ad7
2 changed files with 14 additions and 4 deletions

View File

@@ -63,6 +63,16 @@ static void usbh_gsm_detach(struct usbh_serial *serial)
usb_osal_free(gsm_class); 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 = { static const struct usbh_serial_driver gsm_driver = {
.driver_name = "gsm", .driver_name = "gsm",
@@ -72,9 +82,9 @@ static const struct usbh_serial_driver gsm_driver = {
.attach = usbh_gsm_attach, .attach = usbh_gsm_attach,
.detach = usbh_gsm_detach, .detach = usbh_gsm_detach,
.set_flow_control = NULL, .set_flow_control = NULL,
.set_line_coding = NULL, .set_line_coding = usbh_gsm_set_line_coding,
.get_line_coding = NULL, .get_line_coding = NULL,
.set_line_state = NULL, .set_line_state = usbh_gsm_set_line_state,
.get_modem_status = NULL, .get_modem_status = NULL,
}; };

View File

@@ -584,7 +584,7 @@ int usbh_serial_cdc_write_async(struct usbh_serial *serial, uint8_t *buffer, uin
return -USB_ERR_INVAL; return -USB_ERR_INVAL;
} }
if (serial->ref_count > 0) { if (serial->ref_count == 0) {
return -USB_ERR_NODEV; 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; return -USB_ERR_INVAL;
} }
if (serial->ref_count > 0) { if (serial->ref_count == 0) {
return -USB_ERR_NODEV; return -USB_ERR_NODEV;
} }