tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: USB output in ucom
On Fri, Jul 11, 2025 at 06:20:50AM +0000, Emmanuel Dreyfus wrote:
> Hello
>
> I am still working on ucom console. My first cn_putc used ucomwrite(),
> but it always hung after reaching multi-user. I suspect a locking problem.
>
> Another approach is to use USB transfers directly, bypassing a lot of
> code in ucom.c, tty.c and tty_subr.c. I try this:
>
> error = usbd_create_xfer(sc->sc_bulkout_pipe,
> sc->sc_obufsize, USBD_SYNCHRONOUS, 0,
> &ucomcons_xfer_out);
>
> u_char *data = usbd_get_buffer(ucomcons_xfer_out;
> u_char *buf = __UNCONST("hello world!\nxxx\n");
> int cnt = 13;;
>
> if (sc->sc_methods->ucom_write != NULL)
> sc->sc_methods->ucom_write(sc->sc_parent, sc->sc_portno,
> data, buf, &cnt);
> else
> memcpy(data, buf, cnt);
>
> usbd_setup_xfer(ucomcons_xfer_out, sc, data, cnt,
> 0, USBD_NO_TIMEOUT, NULL /* no cb */);
>
> usbd_transfer(ucomcons_xfer_out);
>
> This actually output "ollow world!" on the serial line. How does the
> "he" turns into a "o"? Is there a header to add, or some control characters
> to insert?
Are you using a ucom driver that has a ucom_write method?
Home |
Main Index |
Thread Index |
Old Index