devfs
[Top] [All Lists]

Re: ttyS1, S2, etc...

To: tytso@xxxxxxx
Subject: Re: ttyS1, S2, etc...
From: Richard Gooch <rgooch@xxxxxxxxxxxxxxx>
Date: Thu, 13 Apr 2000 00:58:17 -0600
Cc: jurgen@xxxxxxxx, devfs@xxxxxxxxxxx
In-reply-to: <200003170543.AAA02886@xxxxxxxxxxxxxxxxxxxx>
References: <200003161751.JAA24104@xxxxxxxxxxxxx> <200003170543.AAA02886@xxxxxxxxxxxxxxxxxxxx>
Sender: owner-devfs@xxxxxxxxxxx
[Apologies for the late response]
tytso@xxxxxxx writes:
>    Date: Thu, 16 Mar 2000 09:51:18 -0800
>    From: Jurgen Botz <jurgen@xxxxxxxx>
> 
>    Richard Gooch wrote:
>    > In drivers/char/serial.c:register_serial() there are calls which
>    > create devfs entries. So the low-level serial driver should call
>    > register_serial() and everything should be fine. It certainly works
>    > for PCMCIA serial cards. Insert the card and the devfs entry magically
>    > appears.
> 
>    The problem is that ISA multiport serial cards don't appear to be
>    detected by the kernel at all and register_serial never gets called.
>    To use the ports you set the IO base and IRQ with setserial which
>    sets them in the driver with ioctls on the device.  This bypasses
>    register_serial in the driver, too, so even if I create /dev/ttyS2
>    and then do the setserial thing, /dev/tts/2 still doesn't appear
>    (but /dev/ttyS2 then works fine).  Not that that would make a
>    difference for devfs, of course.
> 
> Right.  There are actually two parts to this problem.  The first is that
> when setserial calls TIOCSSERIAL to change the uart from "none" to
> "non-none" and vice versa, tty_register_devfs() and
> tty_unregister_devfs() needs to be called.  I can fix this in the serial
> driver fairly easily, and this will take care of the problem which you
> reported.
> 
> The second problem is how do you actually get setserial to set the port,
> irq, and uart settings using only devfs in the first place.  The issue
> here is that you can't autodetect ISA multiport serial cards, at least
> not those cards that don't have PNP support.  The port and irq settings
> either have to manually configured such as is the case for COM 1/2/3/4,
> or the user has to manually set them using the setserial command.    
> 
> But, in a devfs only world, the device file doesn't appear until the
> port is configured, but setserial needs the device file in order to
> configure the port.  There's no real way around this....

But is this a problem? If you configure devfsd to load the serial
driver when you attempt a lookup of /dev/tts/0 (or whatever), then:
# setserial /dev/tts/0 ...

will just work.

>    That may not be worth the trouble to provide automatic devfs 
>    support for the diminishing number of non-PNP ISA multiport
>    boards out there.  Since I currently have to run an rc script
>    to configure the ports anyway, I might as well create the device
>    files there with mknod.
> 
> Perhaps, but this isn't very satisfying; it's certainly very awkward
> for users, and for people who were accustomed to things Just Working
> (tm) in Linux 2.2, it's really, really, really ugly to tell them
> that they have to manually mknod the device in devfs.  However,
> short of telling them (a) don't use devfs, or (b) hacking setserial
> to automatically do the mknod if /dev/ttyS* is passed in and
> /dev/ttyS* doesn't exist.  Both aren't pretty solutions, though.

Oh, definately there shouldn't be any need to mknod(2) in devfs.

> I suppose we could shovel all of this dirt under the devfsd rug, and
> make devfsd responsible for parsing some new serial configuration
> file which then does the mknod and TIOCSERIAL ioctl.  But that's not
> that great of a solution either.

No, I don't want devfsd to need intimate knowledge of device internals
(I consider setserial part of the "internals"). Devfsd should only
care about names, internally.

> I'll need to think about this one some more.  I'm not particularly
> happy with any of these solutions.  Richard, what do you think?

I don't see why you can't just have devfsd load the module when you
attempt a lookup of /dev/ttyS.* or whatever. Then the existing rc
scripts which do:
# setserial /dev/ttyS0 ...
# setserial /dev/ttyS1 ...
# setserial /dev/ttyS2 ...
# setserial /dev/ttyS3 ...

will just work.

                                Regards,

                                        Richard....
Permanent: rgooch@xxxxxxxxxxxxx
Current:   rgooch@xxxxxxxxxxxxxxx


<Prev in Thread] Current Thread [Next in Thread>