]> xenbits.xen.org Git - xenclient/ioemu-pq.git/commitdiff
Check the bus ID for HID devices.
authorJean Guyader <jean.guyader@eu.citrix.com>
Tue, 2 Jun 2009 13:40:16 +0000 (14:40 +0100)
committerJean Guyader <jean.guyader@eu.citrix.com>
Tue, 2 Jun 2009 13:40:16 +0000 (14:40 +0100)
Only take I8042 and USB.

master/dom0-driver

index f148c8bb5cea6bcafbe6cad6de287de6debd760e..f79bb8b32cb10436d47743b8cab5b18c569017b8 100644 (file)
@@ -24,7 +24,7 @@ index 14b42f3..97214c0 100644
  #endif
 diff --git a/dom0_driver.c b/dom0_driver.c
 new file mode 100644
-index 0000000..1b5cd06
+index 0000000..fdd24ab
 --- /dev/null
 +++ b/dom0_driver.c
 @@ -0,0 +1,697 @@
@@ -727,10 +727,10 @@ index 0000000..1b5cd06
 +}
 diff --git a/hid-linux.c b/hid-linux.c
 new file mode 100644
-index 0000000..4ec6bdd
+index 0000000..59dfec8
 --- /dev/null
 +++ b/hid-linux.c
-@@ -0,0 +1,513 @@
+@@ -0,0 +1,527 @@
 +/*
 + * QEMU hid-linux /dev/input driver
 + *
@@ -1164,16 +1164,20 @@ index 0000000..4ec6bdd
 +
 +void hid_linux_probe(int grab)
 +{
-+    int         i = 0, j = 0, c = 0;
-+    int         fd = -1;
-+    int         keyboard = 0, mouse = 0;
-+    char        path[strlen(EVENT_PATH) + 3];
-+    char        name[128];
-+    int               *controllers;
++    int                 i = 0, j = 0, c = 0;
++    int                 fd = -1;
++    int                 keyboard = 0, mouse = 0;
++    char                path[strlen(EVENT_PATH) + 3];
++    char                name[128];
++    int                       *controllers;
++    struct input_id     id;
 +    struct stat       st;
 +
 +    while (1)
 +    {
++        if (fd != -1)
++            close(fd);
++
 +      sprintf(path, "%s%i", EVENT_PATH, i++);
 +
 +      if (stat(path, &st) == -1)
@@ -1192,20 +1196,30 @@ index 0000000..4ec6bdd
 +      if (ioctl(fd, EVIOCGNAME(128), name) == -1)
 +      {
 +          DEBUG("Input get name failed on %s\n", path);
-+          break;
++            break;
 +      }
 +
-+      if (strcasestr(name, "keyboard"))
++        if (ioctl(fd, EVIOCGID, &id) == -1)
 +      {
-+          DEBUG("Add %s %s as a keyboard, fd=%d\n", path, name, fd);
-+          controllers = hid_linux_driver.keyboard_fds;
-+      }
-+      else
-+      {
-+          DEBUG("Add %s %s as a mouse, fd=%d\n", path, name, fd);
-+          controllers = hid_linux_driver.mouse_fds;
++          DEBUG("Input get id failed on %s\n", path);
++            continue;
 +      }
 +
++        /* Only get devices on usb and i8042 */
++        if (id.bustype != BUS_I8042 && id.bustype != BUS_USB)
++            continue;
++
++        if (strcasestr(name, "keyboard"))
++        {
++            DEBUG("Add %s %s as a keyboard, fd=%d, bus=%d\n", path, name, fd, id.bustype);
++            controllers = hid_linux_driver.keyboard_fds;
++        }
++        else
++        {
++            DEBUG("Add %s %s as a mouse, fd=%d, bus=%d\n", path, name, fd, id.bustype);
++            controllers = hid_linux_driver.mouse_fds;
++        }
++
 +      for ( j = 0; j < (HID_LINUX_MAX_DEV / 2) && controllers[j] != -1; j++)
 +          ;
 +      assert(j != (HID_LINUX_MAX_DEV / 2));
@@ -1333,7 +1347,7 @@ index e519705..0ffe1ec 100644
  
      main_loop();
 diff --git a/xen-hooks.mak b/xen-hooks.mak
-index 7c94718..f243df1 100644
+index d171928..15ba4d1 100644
 --- a/xen-hooks.mak
 +++ b/xen-hooks.mak
 @@ -37,6 +37,8 @@ OBJS += helper2.o
@@ -1343,8 +1357,8 @@ index 7c94718..f243df1 100644
 +OBJS += dom0_driver.o
 +OBJS += hid-linux.o
  
- ifdef CONFIG_STUBDOM
- CPPFLAGS += $(TARGET_CPPFLAGS) -DNEED_CPU_H \
+ CONFIG_AUDIO=1
 diff --git a/xenstore.c b/xenstore.c
 index 01afcf0..20ca8cf 100644
 --- a/xenstore.c