public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] Add Ctrl combo key support to usb keyboard driver.
@ 2008-01-03  2:51 Zhang Wei
  2008-01-09 16:12 ` Markus Klotzbücher
  2008-01-09 20:52 ` Wolfgang Denk
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Wei @ 2008-01-03  2:51 UTC (permalink / raw)
  To: u-boot

Ctrl combo key support is added, which is very useful to input Ctrl-C
for interrupt current job.
Also add usb_event_poll() calling to usb_kbd_testc(), which can get
key input when tstc() is called.

Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
---
 common/usb_kbd.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 7bdfcc0..1703b23 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -84,6 +84,7 @@ int repeat_delay;
 static unsigned char num_lock = 0;
 static unsigned char caps_lock = 0;
 static unsigned char scroll_lock = 0;
+static unsigned char ctrl = 0;
 
 static unsigned char leds __attribute__ ((aligned (0x4)));
 
@@ -120,6 +121,9 @@ static void usb_kbd_put_queue(char data)
 /* test if a character is in the queue */
 static int usb_kbd_testc(void)
 {
+#ifdef CFG_USB_EVENT_POLL
+	usb_event_poll();
+#endif
 	if(usb_in_pointer==usb_out_pointer)
 		return(0); /* no data */
 	else
@@ -274,6 +278,10 @@ static int usb_kbd_translate(unsigned char scancode,unsigned char modifier,int p
 		else /* non shifted */
 			keycode=usb_kbd_numkey[scancode-0x1e];
 	}
+
+	if (ctrl)
+		keycode = scancode - 0x3;
+
 	if(pressed==1) {
 		if(scancode==NUM_LOCK) {
 			num_lock=~num_lock;
@@ -306,6 +314,17 @@ static int usb_kbd_irq(struct usb_device *dev)
 		return 1;
 	}
 	res=0;
+
+	switch (new[0]) {
+	case 0x0:	/* No combo key pressed */
+		ctrl = 0;
+		break;
+	case 0x01:	/* Left Ctrl pressed */
+	case 0x10:	/* Right Ctrl pressed */
+		ctrl = 1;
+		break;
+	}
+
 	for (i = 2; i < 8; i++) {
 		if (old[i] > 3 && memscan(&new[2], old[i], 6) == &new[8]) {
 			res|=usb_kbd_translate(old[i],new[0],0);
-- 
1.5.2

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

* [U-Boot-Users] [PATCH] Add Ctrl combo key support to usb keyboard driver.
  2008-01-03  2:51 [U-Boot-Users] [PATCH] Add Ctrl combo key support to usb keyboard driver Zhang Wei
@ 2008-01-09 16:12 ` Markus Klotzbücher
  2008-01-09 20:52 ` Wolfgang Denk
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Klotzbücher @ 2008-01-09 16:12 UTC (permalink / raw)
  To: u-boot

Zhang Wei <wei.zhang@freescale.com> writes:

> Ctrl combo key support is added, which is very useful to input Ctrl-C
> for interrupt current job.
> Also add usb_event_poll() calling to usb_kbd_testc(), which can get
> key input when tstc() is called.
>
> Signed-off-by: Zhang Wei <wei.zhang@freescale.com>

Added to custodian repo, thanks!

Best regards

Markus Klotzb?cher

--
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de

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

* [U-Boot-Users] [PATCH] Add Ctrl combo key support to usb keyboard driver.
  2008-01-03  2:51 [U-Boot-Users] [PATCH] Add Ctrl combo key support to usb keyboard driver Zhang Wei
  2008-01-09 16:12 ` Markus Klotzbücher
@ 2008-01-09 20:52 ` Wolfgang Denk
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2008-01-09 20:52 UTC (permalink / raw)
  To: u-boot

In message <11993286752643-git-send-email-wei.zhang@freescale.com> you wrote:
> Ctrl combo key support is added, which is very useful to input Ctrl-C
> for interrupt current job.
> Also add usb_event_poll() calling to usb_kbd_testc(), which can get
> key input when tstc() is called.
> 
> Signed-off-by: Zhang Wei <wei.zhang@freescale.com>

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The human mind ordinarily operates at only ten percent of its capaci-
ty - the rest is overhead for the operating system.

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

end of thread, other threads:[~2008-01-09 20:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-03  2:51 [U-Boot-Users] [PATCH] Add Ctrl combo key support to usb keyboard driver Zhang Wei
2008-01-09 16:12 ` Markus Klotzbücher
2008-01-09 20:52 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox