public inbox for kbd@lists.linux.dev
 help / color / mirror / Atom feed
From: Alexey Gladkov <legion@kernel.org>
To: shrik3@mailbox.org
Cc: kbd@lists.linux.dev
Subject: Re: [PATCH] kbd_mode: support Disabled mode (K_OFF)
Date: Tue, 4 Feb 2025 14:13:28 +0100	[thread overview]
Message-ID: <Z6ISeGjJiDgQUEE3@example.org> (raw)
In-Reply-To: <20250203175118.30479-1-shrik3@mailbox.org>

On Mon, Feb 03, 2025 at 06:47:31PM +0100, shrik3@mailbox.org wrote:
> From: Tianhao Wang <shrik3@mailbox.org>
> 
> 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/AANLkTikZe1EuvNQHceNUdKFpmmeAbQG8H+34AG9fw43u@mail.gmail.com/
> 
> Signed-off-by: Tianhao Wang <shrik3@mailbox.org>

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


      reply	other threads:[~2025-02-04 13:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 17:47 [PATCH] kbd_mode: support Disabled mode (K_OFF) shrik3
2025-02-04 13:13 ` Alexey Gladkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z6ISeGjJiDgQUEE3@example.org \
    --to=legion@kernel.org \
    --cc=kbd@lists.linux.dev \
    --cc=shrik3@mailbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox