USB output in ucom
Emmanuel Dreyfus <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.kernel |
|---|---|
| Message-ID | <[email protected]> |
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?
--
Emmanuel Dreyfus
[email protected]