Like scr_lock, the grab count needs to be per-physical-device to work.

This bug corrupted the grab count on both vtys if the ungrabbed vty is
different from the console, and failed to restore the keyboard state
on the ungrabbed vty, but not restoring the latter usually left the
keyboard mode part of it uncorrupted at 1 (K_XLATE), while after this
fix the keyboard mode part is usually corrupted to 0 (K_RAW).

While here, rename the grab count from 'grabbed' to grab_level.
This commit is contained in:
Bruce Evans 2016-08-15 17:08:25 +00:00
parent 304c3654d7
commit 71e40e4a49

View File

@ -1661,7 +1661,7 @@ sc_cngrab(struct consdev *cp)
if (scp->sc->kbd == NULL)
return;
if (scp->grabbed++ > 0)
if (scp->sc->grab_level++ > 0)
return;
/*
@ -1687,7 +1687,7 @@ sc_cnungrab(struct consdev *cp)
if (scp->sc->kbd == NULL)
return;
if (--scp->grabbed > 0)
if (--scp->sc->grab_level > 0)
return;
kbdd_poll(scp->sc->kbd, FALSE);