tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [RFC] new APIs to use wskbd(4) input on non-wsdisplay tty devices



uwe@ wrote:

> On Sat, Apr 06, 2024 at 23:56:27 +0900, Izumi Tsutsui wrote:
> 
> > To support "text only" framebuffer console, we can use putchar
> > functions provided by the firmware PROM.
> 
> Is that a console-typewriter--like device without addressable cursor
> terminal emulation?  Can you use wsemul_dumb to avoid rasops &c?  It
> still uses copy/erase, but with trivial argument values that can be
> reversed back to puchar calls for tab/lf (from a very quick look).

The PROM provides (at least I can use) only a "putchar()" function.
No other framebuffer ops like bitblt.
For now I cannot find any proper implementation example in such case..

> > The attached patch provides new two APIs
> > - wskbd_consdev_kbdinput_register()
> > - wskbd_consdev_kbdinput_deregister()
> > to allow a kernel to use wskbd(9) for non-wsdisplay tty device.
> 
> AFAIU, there's nothing console-specific in this (except that it's
> first use is going to be for a console), so may be it would be better
> to drop the "consdev" from the name?

Hmm.

Actually it is not a "console" device (by sys/dev/cons.c) of the kernel,
but I just intended it as a "screen console (not a serial one)".

What name should we use in such case?
dispdev? scrndev? putchar?
"wskbd_ttyinput_register()" and "ttydev" (for members) or something?

> > Index: sys/dev/wscons/wskbd.c
> > ===================================================================
> > RCS file: /cvsroot/src/sys/dev/wscons/wskbd.c,v
> > retrieving revision 1.143
> > diff -u -p -d -r1.143 wskbd.c
> > --- sys/dev/wscons/wskbd.c	5 Feb 2019 10:04:49 -0000	1.143
> > +++ sys/dev/wscons/wskbd.c	6 Apr 2024 06:59:50 -0000
> [...]
> > @@ -706,6 +709,24 @@ wskbd_input(device_t dev, u_int type, in
> >  	}
> >  #endif
> >  
> > +#if NWSDISPLAY == 0
> > +	if (sc->sc_translating) {
> 
> The #endif above is for NWSDISPLAY > 0, so may be get rid of the
> ifdefs and use plain ifs?

It looks wskbd(9) assumes always attached to wsdisplay(9) (ttyE?)
if wsdisplay(4) is configured (in the above #if NWSDISPLAY >0 block)
even if no wsdisplay(4) devices are actually attached.

In my news68k case, I thought we should not override the current
assumptions even in the wskbd_consdev_kbdinput_register() case.

I have a feeling we should have separate 'if (sc->sc_translating)'
blocks for both case. Maybe we can simply use #else like:
#if NWSDISPLAY > 0
 [send kbd inputs to wsdisplay_kbdinput() and return unconditionally]
#else
 [send kbd inputs to sc_consdev_kbdinput() and return if it's registered]
#endif

Thanks,
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index