diff --git a/sys/dev/usb/serial/uchcom.c b/sys/dev/usb/serial/uchcom.c --- a/sys/dev/usb/serial/uchcom.c +++ b/sys/dev/usb/serial/uchcom.c @@ -155,6 +155,14 @@ #define UCHCOM_BULK_BUF_SIZE 1024 /* bytes */ +/* + * As speeds for uchcom devices increase, these numbers will need to + * be increased. This needs to be tested. + * + * TODO: The TTY buffers should be increased! + */ +#define UCHCOM_BUF_SIZE 1024 + enum { UCHCOM_BULK_DT_WR, UCHCOM_BULK_DT_RD, @@ -242,6 +250,28 @@ static usb_callback_t uchcom_read_callback; static const struct usb_config uchcom_config_data[UCHCOM_N_TRANSFER] = { + [UCHCOM_BULK_WR] = { + .type = UE_BULK, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_TX, + .if_index = 0, + .bufsize = UCHCOM_BUF_SIZE, + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = &uchcom_write_callback, + .usb_mode = USB_MODE_DUAL, + }, + + [UCHCOM_BULK_RD] = { + .type = UE_BULK, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_RX, + .if_index = 0, + .bufsize = UCHCOM_BUF_SIZE, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = &uchcom_read_callback, + .usb_mode = USB_MODE_DUAL, + }, + [UCHCOM_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -673,6 +703,12 @@ uchcom_cfg_open(struct ucom_softc *ucom) { struct uchcom_softc *sc = ucom->sc_parent; + + /* clear stall */ + if ((sc->sc_super_ucom.sc_flag & UCOM_FLAG_DEVICE_MODE) == 0) { + usbd_xfer_set_stall(sc->sc_xfer[UCHCOM_BULK_WR]); + usbd_xfer_set_stall(sc->sc_xfer[UCHCOM_BULK_RD]); + } DPRINTF("\n");