linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2 10/18] input&tty: Fix the keyboard led light display problem
       [not found] <616cd589.1c69fb81.e7b01.b706SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2021-10-18  5:57 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2021-10-18  5:57 UTC (permalink / raw)
  To: changlianzhi
  Cc: linux-kernel, dmitry.torokhov, jirislaby, andriy.shevchenko,
	linux-input, 282827961

On Mon, Oct 18, 2021 at 10:01:34AM +0800, changlianzhi wrote:
> Switching from the desktop environment to the tty environment,
> the state of the keyboard led lights and the state of the keyboard
> lock are inconsistent. This is because the attribute kb->kbdmode
> of the tty bound in the desktop environment (xorg) is set to
> VC_OFF, which causes the ledstate and kb->ledflagstate
> values of the bound tty to always be 0, which causes the switch
> from the desktop When to the tty environment, the LED light
> status is inconsistent with the keyboard lock status.
> 
> Signed-off-by: lianzhi chang <changlianzhi@uniontech.com>
> ---
> v2 10/18:
> (1) Move the definition of ledstate to the input module
> (/drivers/input/input.c),
> and set or get its value through the input_update_ledstate(Replace the
> update_value_ledstate function defined in the last patch, and optimize
> the code according to the proposal) and input_get_ledstate functions.
> (2) To update the ledstate reference in keyboard.c, you must first get
> the value through input_get_ledstate.
> (3)Some macro definitions have been added to input.c.
> 
> drivers/input/input.c | 46 ++++++++++++++++++++++++++++++++++++++-
> drivers/tty/vt/keyboard.c | 19 ++++++++++++++--
> include/linux/input.h | 3 +++
> 3 files changed, 65 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index ccaeb2426385..8c0ef947ac34 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -37,6 +37,11 @@ static DEFINE_IDA(input_ida);
> static LIST_HEAD(input_dev_list);
> static LIST_HEAD(input_handler_list);
> +#define VC_SCROLLOCK 0 /* scroll-lock mode */
> +#define VC_NUMLOCK 1 /* numeric lock mode */
> +#define VC_CAPSLOCK 2 /* capslock mode */
> +static unsigned int ledstate = -1U; /* undefined */
> +
> /*
> * input_mutex protects access to both input_dev_list and input_handler_list.
> * This also causes input_[un]register_device and input_[un]register_handler
> @@ -472,8 +477,12 @@ void input_inject_event(struct input_handle *handle,
> rcu_read_lock();
> grab = rcu_dereference(dev->grab);
> - if (!grab || grab == handle)
> + if (!grab || grab == handle) {
> input_handle_event(dev, type, code, value);
> +
> + if (type == EV_LED && code <= LED_SCROLLL)
> + input_update_ledstate(code, value);
> + }
> rcu_read_unlock();
> spin_unlock_irqrestore(&dev->event_lock, flags);
> @@ -481,6 +490,41 @@ void input_inject_event(struct input_handle *handle,
> }
> EXPORT_SYMBOL(input_inject_event);
> +void input_update_ledstate(unsigned int flag, unsigned int value)
> +{
> + unsigned int bit;
> +
> + switch (flag) {
> + case LED_NUML:

<snip>

Again, your email client corrupted the patch and made it so that it can
not be applied :(

Please just use git send-email.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 10/18] input&tty: Fix the keyboard led light display problem
       [not found] <616cd589.1c69fb81.f43e6.d620SMTPIN_ADDED_BROKEN@mx.google.com>
@ 2021-10-18  5:04 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2021-10-18  5:04 UTC (permalink / raw)
  To: changlianzhi
  Cc: linux-kernel, gregkh, jirislaby, andriy.shevchenko, linux-input,
	282827961

Hi,

On Mon, Oct 18, 2021 at 10:01:34AM +0800, changlianzhi wrote:
> Switching from the desktop environment to the tty environment,
> the state of the keyboard led lights and the state of the keyboard
> lock are inconsistent. This is because the attribute kb->kbdmode
> of the tty bound in the desktop environment (xorg) is set to
> VC_OFF, which causes the ledstate and kb->ledflagstate
> values of the bound tty to always be 0, which causes the switch
> from the desktop When to the tty environment, the LED light
> status is inconsistent with the keyboard lock status.
> 
> Signed-off-by: lianzhi chang <changlianzhi@uniontech.com>
> ---
> v2 10/18:
> (1) Move the definition of ledstate to the input module
> (/drivers/input/input.c),
> and set or get its value through the input_update_ledstate(Replace the
> update_value_ledstate function defined in the last patch, and optimize
> the code according to the proposal) and input_get_ledstate functions.
> (2) To update the ledstate reference in keyboard.c, you must first get
> the value through input_get_ledstate.
> (3)Some macro definitions have been added to input.c.
> 
> drivers/input/input.c | 46 ++++++++++++++++++++++++++++++++++++++-

As I mentioned, I do not see a reason for your patch to touch input
core, please keep the modifications contained within
drivers/tty/vt/keyboard.c

> drivers/tty/vt/keyboard.c | 19 ++++++++++++++--
> include/linux/input.h | 3 +++
> 3 files changed, 65 insertions(+), 3 deletions(-)
> 

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-18  5:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <616cd589.1c69fb81.e7b01.b706SMTPIN_ADDED_BROKEN@mx.google.com>
2021-10-18  5:57 ` [PATCH v2 10/18] input&tty: Fix the keyboard led light display problem Greg KH
     [not found] <616cd589.1c69fb81.f43e6.d620SMTPIN_ADDED_BROKEN@mx.google.com>
2021-10-18  5:04 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).