Emmanuel Dreyfus <m...@netbsd.org> wrote:
> On Tue, Jun 17, 2025 at 03:41:15PM +0100, Robert Swindells wrote:
>> You could look at what is in sys/dev/ic/com.c to handle a serial
>> console and add the equivalent to sys/dev/usb/ucom.c.
>> 
>> Start at the 'struct consdev comcons' declaration, that links to the
>> functions needed.
>
> I created a struct filled with functions that for now are no-ops, they
> just return.
> static struct consdev comcons = {
>        .cn_probe = ucomcnprobe,
>        .cn_init = ucomcninit,
>        .cn_getc = ucomcngetc,
>        .cn_putc = ucomcnputc,
>        .cn_pollc = ucomcnpollc,
>        .cn_bell = ucomcnbell,
>        .cn_halt = ucomcnhalt,
>        .cn_flush = ucomcnflush,
>        .cn_dev = NODEV,
>        .cn_pri = CN_NORMAL
> };
>
> At the end of ucom_attach, I try this if everything went fine:
>        comcons.cn_dev = makedev(66, 0);
>        cn_tab = &comcons;

> That is enough to crash during the boot, and since there is no
> console, there is no clue about what went wrong. Any idea?

I think the point would be to not make the functions no-ops so that
you do have a console.

Have done this with a non-standard serial port for a PowerPC SoC.

You don't need all the functions, maybe start with .cn_putc.

Reply via email to