Re: [PATCH] kbd_mode: support Disabled mode (K_OFF)
Alexey Gladkov <[email protected]> Tue, 4 Feb 2025 14:13:28 +0100
| Newsgroups | dev.linux.lists.kbd |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Feb 03, 2025 at 06:47:31PM +0100, [email protected] wrote: > From: Tianhao Wang <[email protected]> > > Since linux 2.6.39 KDGKBMODE could have K_OFF (0x04), the Disabled mode. > This may be set by e.g. Xorg that doesn't read /dev/tty > > Reference: https://lore.kernel.org/all/[email protected]/ > > Signed-off-by: Tianhao Wang <[email protected]> Applied. Thanks. > --- > src/kbd_mode.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/src/kbd_mode.c b/src/kbd_mode.c > index 9a4aff3..f37c321 100644 > --- a/src/kbd_mode.c > +++ b/src/kbd_mode.c > @@ -16,9 +16,14 @@ > #include <sysexits.h> > #include <sys/ioctl.h> > #include <linux/kd.h> > +#include <linux/version.h> > > #include "libcommon.h" > > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) > +#define HAS_K_OFF > +#endif > + > static void KBD_ATTR_NORETURN > usage(int rc, const struct kbd_help *options) > { > @@ -48,6 +53,11 @@ fprint_mode(FILE *stream, int mode) > case K_UNICODE: > fprintf(stream, _("The keyboard is in Unicode (UTF-8) mode")); > break; > +#ifdef HAS_K_OFF > + case K_OFF: > + fprintf(stream, _("The keyboard is in Disabled mode, perhaps you are using a graphical environment?")); > + break; > +#endif > default: > fprintf(stream, _("The keyboard is in some unknown mode")); > } > -- > 2.48.1 > > -- Rgrds, legion