Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 340e01248478ba8b78a6d4d1809b1eff > files > 399

kvm-83-270.el5_11.src.rpm

From 1a010b58c14e421b520bc28a68f2a879c6fe74b5 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Fri, 12 Mar 2010 12:01:26 -0300
Subject: [PATCH 3/4] kbd leds: usb kbd

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1268395287-16378-4-git-send-email-kraxel@redhat.com>
Patchwork-id: 7684
O-Subject: [RHEL-5 kvm PATCH 3/4] kbd leds: usb kbd
Bugzilla: 517814
RH-Acked-by: Zachary Amsden <zamsden@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>

Add led status notification support to the usb kbd driver.

upstream: commit bd87813e8c3adfa1c12f763b35b2dbacc7796f0d
---
 qemu/hw/usb-hid.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu/hw/usb-hid.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/usb-hid.c b/qemu/hw/usb-hid.c
index 46e0a4c..5b8802c 100644
--- a/qemu/hw/usb-hid.c
+++ b/qemu/hw/usb-hid.c
@@ -670,12 +670,20 @@ static int usb_keyboard_poll(USBKeyboardState *s, uint8_t *buf, int len)
 static int usb_keyboard_write(USBKeyboardState *s, uint8_t *buf, int len)
 {
     if (len > 0) {
+        int ledstate = 0;
         /* 0x01: Num Lock LED
          * 0x02: Caps Lock LED
          * 0x04: Scroll Lock LED
          * 0x08: Compose LED
          * 0x10: Kana LED */
         s->leds = buf[0];
+        if (s->leds & 0x04)
+            ledstate |= QEMU_SCROLL_LOCK_LED;
+        if (s->leds & 0x01)
+            ledstate |= QEMU_NUM_LOCK_LED;
+        if (s->leds & 0x02)
+            ledstate |= QEMU_CAPS_LOCK_LED;
+        kbd_put_ledstate(ledstate);
     }
     return 0;
 }
-- 
1.7.0.3