[LTP] [PATCH 1/3] ioctl01: Add default tty device

Li Wang liwang@redhat.com
Thu Feb 9 07:15:40 CET 2023


On Wed, Feb 8, 2023 at 9:54 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Li,
>
> > > +#define        DEFAULT_TTY_DEVICE      "/dev/tty0"
>
> > Hidden the device path parameter is a good idea.
>
> > But maybe can we add a function to find available char devices instead
> > of using the tty0 as default? In that function, we do the S_ISCHR() check
> > and return the valid path of it. Then the rest test (e.g. ioctl02) can
> make
> > use of it but not set the specified device as well. WDYT?
>
> FYI I'm using S_ISCHR() in other patches, which check if device can be
> used.
> Implementing search looks like a good idea. Are useful files any /dev/tty*
> (including /dev/tty, /dev/ttyACM0, /dev/ttyS0) or should I avoid any file
> or include other paths?
>

It seems not all char devices can be used here.
The /dev/tty*Num* should be the first choice.

I tried some of them and only /dev/tty0-N works well,
maybe we can just make use of them to avoid no tty0
file failure should be enough. Because my only concern
about the hard coding is that "/dev/tty0" is non-exist.



>
> Kind regards,
> Petr
>
>

-- 
Regards,
Li Wang


More information about the ltp mailing list