Re: [PATCH v2] agetty: don't put the VC into canonical mode

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

 



On Thu, Oct 18, 2018 at 09:25:33PM +0200, Stanislav Brabec wrote:
> On Oct 16, 2018 at 9:40 AM Karel Zak wrote:
> > On Tue, Oct 16, 2018 at 08:41:49AM +0200, Lubomir Rintel wrote:
> >> Seems like zero lflags do the job just fine on a Linux VT. Reset it to
> >> canonical mode before running login.
> > 
> > What about Del/Backspace keys when user is typing login name? :-)
> 
> It could be easy without Backspace support. Just read the characters.
> But we have to implement Backspace.
> 
> When you leave canonical mode, then agetty code has to handle Backspace.
> 
> Hopefully, agetty doesn't support arrows and Delete (forward delete),
> so we don't have to implement advanced parts of line editing.
> 
> My experiments show two possibilities. I am not sure, what is better,
> but 1 seems to be more straightforward.
> 
> 
> 1) c_lflag &= ~(ICANON | ECHO)
> 
> This falls back to a no echo mode. Program has to handle echo and
> buffer parsing. Program has to handle backspace.
> 
> The implementation seems to be straightforward.
> 
> Downside: Remote logins can experience delays when getting echo.

This seems like a small downside as data from remote machine is pretty
common thing for remote access :-)

> 2) c_lflag &= ~(ICANON)
> 
> Non-canonical mode with echo seems to be usable as well. The terminal
> itself does the echo, program does the input parsing. Program has to
> handle Backspace. Echo will be immediate even with slow remote logins,
> but Backspace has to be handled remotely.
> 
> The second implementation has a problem: The Linux console input and
> output are out of sync in the time of agetty. Input returns 0x7f after
> pressing backspace, but output does back step (not back space) after
> sending 0x08. I don't know the fix yet.

This seems fragile, especially on environment with obscure serial
lines (or serial over ssh, etc.) where nobody has clue about proper
setting. It seems better to be slow than fragile.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux