input: Save keyboard's LED state to correct place
Subsystems (2)
PATCH 1/6 input: Save keyboard's LED state to correct place
Currently keyboard's LED state is wrongly saved to config->leds in process_modifier(). It should really be config->flags.
---
drivers/input/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/input.c +1 -1
@@ -268,7 +268,7 @@ static struct input_key_xlate *process_modifier(struct input_config *config,if (flip !=-1 ) {int leds =0 ; - config->leds ^= flip; + config->flags ^= flip;if (config->flags &FLAG_NUM_LOCK ) leds |=INPUT_LED_NUM ;if (config->flags &FLAG_CAPS_LOCK )
Signature · 1 line
1.8.2.1
PATCH 2/6 input: Call keyboard's update_leds() method when the LEDs change
We should request keyboard to turn on/off its LED when detecting any changes on the LEDs.
---
drivers/input/input.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/input/input.c +9 -0
@@ -9,9 +9,11 @@#include <common.h> #include <console.h> +#include <dm.h> #include <errno.h> #include <stdio_dev.h> #include <input.h> +#include <keyboard.h> #include <linux/input.h> enum {
@@ -236,6 +238,8 @@ int input_getc(struct input_config *config)static struct input_key_xlate *process_modifier (struct input_config *config,int key,int release) { +struct udevice *dev = config->dev; +struct keyboard_ops *ops =keyboard_get_ops (dev);struct input_key_xlate *table;int i;
@@ -277,6 +281,11 @@ static struct input_key_xlate *process_modifier(struct input_config *config, leds |=INPUT_LED_SCROLL ; config->leds = leds; config->leds_changed = flip; + +if (ops->update_leds) { +if (ops->update_leds (dev, config->leds)) +debug ("Update keyboard's LED failed\n" ); + } } }
Signature · 1 line
1.8.2.1
PATCH 2/6 input: Call keyboard's update_leds() method when the LEDs change
Quoted 8 lines · Bin Meng
We should request keyboard to turn on/off its LED when detecting any changes on the LEDs.
Signed-off-by Bin Meng <[email protected]>---
drivers/input/input.c | 9 +++++++++ 1 file changed, 9 insertions(+)
PATCH 2/6 input: Call keyboard's update_leds() method when the LEDs change
Updated to fix build errors when CONFIG_DM_KEYBOARD is not enabled, and
Applied to u-boot-dm, thanks!
PATCH 3/6 input: Change LED state bits to conform i8042 compatible keyboard
In reply to Bin MengWhen sending LED update command to an i8042 compatible keyboard, bit1 is 'Num Lock' and bit2 is 'Caps Lock' in the data byte. But input library defines bit1 as 'Caps Lock' and bit2 as 'Num Lock'. This causes a wrong LED to be set on an i8042 compatible keyboard. Change the LED state bits to be i8042 compatible, and change the keyboard flags as well.
---
drivers/input/input.c | 6 +++--- include/input.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/input/input.c +3 -3
@@ -18,9 +18,9 @@enum {/* These correspond to the lights on the keyboard */ -FLAG_NUM_LOCK =1 <<0 , -FLAG_CAPS_LOCK =1 <<1 , -FLAG_SCROLL_LOCK =1 <<2 , +FLAG_SCROLL_LOCK =1 <<0 , +FLAG_NUM_LOCK =1 <<1 , +FLAG_CAPS_LOCK =1 <<2 ,/* Special flag ORed with key code to indicate release */ KEY_RELEASE =1 <<15 ,
include/input.h +2 -2
@@ -17,8 +17,8 @@ enum {enum {/* Keyboard LEDs */ INPUT_LED_SCROLL =1 <<0 , -INPUT_LED_CAPS =1 <<1 , -INPUT_LED_NUM =1 <<2 , +INPUT_LED_NUM =1 <<1 , +INPUT_LED_CAPS =1 <<2 , };/*
Signature · 1 line
1.8.2.1
PATCH 3/6 input: Change LED state bits to conform i8042 compatible keyboard
Quoted 7 lines · Bin Meng
When sending LED update command to an i8042 compatible keyboard, bit1 is 'Num Lock' and bit2 is 'Caps Lock' in the data byte. But input library defines bit1 as 'Caps Lock' and bit2 as 'Num Lock'. This causes a wrong LED to be set on an i8042 compatible keyboard. Change the LED state bits to be i8042 compatible, and change the keyboard flags as well.
Quoted 6 lines
Signed-off-by Bin Meng <[email protected]>---
drivers/input/input.c | 6 +++--- include/input.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
PATCH 3/6 input: Change LED state bits to conform i8042 compatible keyboard
Applied to u-boot-dm, thanks!
PATCH 4/6 input: Ban digit numbers if 'Num Lock' is not on
In reply to Bin MengWhen 'Num Lock' is not on, we should not send these digit numbers (0-9 and dot) to the output buffer.
---
drivers/input/input.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/input/input.c +6 -0
@@ -474,6 +474,12 @@ static int input_keycodes_to_ascii(struct input_config *config,if ((config->flags &FLAG_CAPS_LOCK ) && ch >='a' && ch <='z' ) ch -='a' -'A' ; +/* ban digit numbers if 'Num Lock' is not on */ +if (!(config->flags &FLAG_NUM_LOCK )) { +if (key >=KEY_KP7 && key <=KEY_KPDOT && + key !=KEY_KPMINUS && key !=KEY_KPPLUS ) + ch =0xff ; + }if (ch_count < max_chars && ch !=0xff ) output_ch[ch_count++] = (uchar )ch; }else {
Signature · 1 line
1.8.2.1
PATCH 4/6 input: Ban digit numbers if 'Num Lock' is not on
Quoted 8 lines · Bin Meng
When 'Num Lock' is not on, we should not send these digit numbers (0-9 and dot) to the output buffer.
Signed-off-by Bin Meng <[email protected]>---
drivers/input/input.c | 6 ++++++ 1 file changed, 6 insertions(+)
PATCH 4/6 input: Ban digit numbers if 'Num Lock' is not on
Applied to u-boot-dm, thanks!
PATCH 5/6 x86: crownbay: Convert to use driver model keyboard
In reply to Bin MengConvert to use driver model keyboard on Intel Crown Bay.
---
arch/x86/dts/crownbay.dts | 1 + include/configs/crownbay.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
arch/x86/dts/crownbay.dts +1 -0
@@ -10,6 +10,7 @@ /include/ "skeleton.dtsi" /include/ "serial.dtsi" +/include/ "keyboard.dtsi" /include/ "rtc.dtsi" / {
include/configs/crownbay.h +1 -1
@@ -35,7 +35,7 @@#define CONFIG_SYS_EARLY_PCI_INIT #define CONFIG_PCI_PNP -#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,vga,usbkbd\0" \ +#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd,usbkbd\0" \ "stdout=serial,vga\0" \ "stderr=serial,vga\0"
Signature · 1 line
1.8.2.1
PATCH 5/6 x86: crownbay: Convert to use driver model keyboard
Quoted 8 lines · Bin Meng
Convert to use driver model keyboard on Intel Crown Bay.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/dts/crownbay.dts | 1 + include/configs/crownbay.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
PATCH 5/6 x86: crownbay: Convert to use driver model keyboard
Applied to u-boot-dm, thanks!
PATCH 6/6 x86: qemu: Convert to use driver model keyboard
In reply to Bin MengConvert to use driver model keyboard on QEMU.
---
arch/x86/dts/qemu-x86_i440fx.dts | 1 + arch/x86/dts/qemu-x86_q35.dts | 1 + include/configs/qemu-x86.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/dts/qemu-x86_i440fx.dts +1 -0
@@ -10,6 +10,7 @@ /include/ "skeleton.dtsi" /include/ "serial.dtsi" +/include/ "keyboard.dtsi" /include/ "rtc.dtsi" / {
arch/x86/dts/qemu-x86_q35.dts +1 -0
@@ -20,6 +20,7 @@ /include/ "skeleton.dtsi" /include/ "serial.dtsi" +/include/ "keyboard.dtsi" /include/ "rtc.dtsi" / {
include/configs/qemu-x86.h +1 -1
@@ -30,7 +30,7 @@#define CONFIG_PCI_PNP -#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,vga\0" \ +#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd\0" \ "stdout=serial,vga\0" \ "stderr=serial,vga\0"
Signature · 1 line
1.8.2.1
PATCH 6/6 x86: qemu: Convert to use driver model keyboard
Quoted 9 lines · Bin Meng
Convert to use driver model keyboard on QEMU.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/dts/qemu-x86_i440fx.dts | 1 + arch/x86/dts/qemu-x86_q35.dts | 1 + include/configs/qemu-x86.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-)
PATCH 6/6 x86: qemu: Convert to use driver model keyboard
Applied to u-boot-dm, thanks!
PATCH 1/6 input: Save keyboard's LED state to correct place
In reply to Bin MengQuoted 8 lines · Bin Meng
Currently keyboard's LED state is wrongly saved to
config->ledsinprocess_modifier(). It should really beconfig->flags.Signed-off-by Bin Meng <[email protected]>---
drivers/input/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 1/6 input: Save keyboard's LED state to correct place
Applied to u-boot-dm, thanks!