Re: How do I choose an arbitrary minor number for my tty device?

From: Alan Cox
Date: Tue Nov 23 2010 - 18:05:19 EST


> Are you talking about this:
>
> static struct tty_driver *ehv_bc_console_device(struct console *co, int *index)
> {
> *index = co->index;
>
> return ehv_bc_driver;
> }

Yes.

> I never really understood this function, but almost everyone does the same
> thing, and it seems to work for me. Looking at console_device(), it appears
> that all of the xxx_console_device functions are called in order until one of
> them returns non-NULL.

*index is the minor number to use - so you can return whichever minor
matches your primary interface

> > I suspect in your case you probably want to attach the primary byte
> > channel to minor 0 in the driver (and reserve it for that), or some
> > similar rule.
>
> Yes, that's a good idea. It does simplify things a lot.

It's probably the cleanest and simplest solution and it fits the
"natural" order of things.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/