qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal S


From: Brad Campbell
Subject: Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
Date: Sun, 09 Apr 2006 22:35:03 +0400
User-agent: Thunderbird 1.6a1 (X11/20060214)

Leonardo E. Reiter wrote:
This is by no means a complete patch (do not apply it as it will break usb-hid.c), but it adjusts the report descriptor in usb-hid.c to provide position in 16-bits, and in absolute coordinates:

Index: usb-hid.c
===================================================================
RCS file: /cvsroot/qemu/qemu/hw/usb-hid.c,v
retrieving revision 1.1
diff -a -u -r1.1 usb-hid.c
--- usb-hid.c   5 Nov 2005 16:57:08 -0000       1.1
+++ usb-hid.c   8 Apr 2006 20:56:02 -0000
@@ -117,7 +117,7 @@
     0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01,
     0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01,
     0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x15, 0x81,
-    0x25, 0x7F, 0x75, 0x08, 0x95, 0x02, 0x81, 0x06,
+    0x25, 0x7F, 0x75, 0x16, 0x95, 0x02, 0x81, 0x02,
     0xC0, 0xC0,
 };

According to: http://72.14.203.104/search?q=cache:wVYUTwc33f8J:www.usb.org/developers/devclass_docs/HID1_11.pdf+usb+hid+specification+absolute+relative&hl=en&gl=us&ct=clnk&cd=1

I can't get the existing usb-hid mouse to work in win2k. It sees a device but it marks it as non-functional. After wrapping my head around this descriptor I can't really seem to reconcile what is here with the data we are passing in usb_mouse_poll()

I'm sure it works with a linux guest.. has anyone had -usb -usbdevice mouse 
working under windows ?

This descriptor seems slightly whacky compared to most mouse examples I've seen floating about on the net.


static const uint8_t qemu_mouse_hid_report_descriptor[] = {
    0x05, 0x01, /* Usage Page Generic Desktop */
    0x09, 0x02, /* Usage Mouse */
    0xA1, 0x01  /* Collection Application */
    0x09, 0x01, /* Usage Pointer */
    0xA1, 0x00, /* Collection Physical */
    0x05, 0x09, /* Usage Page Button */
    0x19, 0x01, /* Usage Minimum Button 1 */
    0x29, 0x03, /* Usage Maximum Button 3 */
    0x15, 0x00, /* Logical Minimum 0 */
    0x25, 0x01, /* Logical Maximum 1 */
    0x95, 0x03, /* Report Count 3 */
    0x75, 0x01, /* Report Size 1 */
    0x81, 0x02, /* Input (Data, Var, Abs) */
    0x95, 0x01, /* Report Count 1 */
    0x75, 0x05, /* Report Size 5 */
    0x81, 0x01, /* Input (Cnst, Var, Abs) */
    0x05, 0x01, /* Usage Page Generic Desktop */
    0x09, 0x30, /* Usage X */
    0x09, 0x31, /* Usage Y */
    0x15, 0x81, /* Logical Minimum -127 */
    0x25, 0x7F, /* Logical Maximum 127 */
    0x75, 0x08, /* Report Size 8 */
    0x95, 0x02, /* Report Count 2 */
    0x81, 0x06, /* Input (Data, Var, Rel) */
    0xC0,       /* End Collection */
    0xC0,       /* End Collection */
};

I have recompiled this through a HID compiler and the analysis seems correct.
So we are not describing a Z axis anywhere at all there..



This one passes a parse test and should give X & Y as 0->FFFF ABS while leaving 
Z as 8 bit relative.

static const uint8_t qemu_mouse_hid_report_descriptor[] = {
    0x05, 0x01, /* Usage Page Generic Desktop */
    0x09, 0x02, /* Usage Mouse */
    0xA1, 0x01  /* Collection Application */
    0x09, 0x01, /* Usage Pointer */
    0xA1, 0x00, /* Collection Physical */
    0x05, 0x09, /* Usage Page Button */
    0x19, 0x01, /* Usage Minimum Button 1 */
    0x29, 0x03, /* Usage Maximum Button 3 */
    0x15, 0x00, /* Logical Minimum 0 */
    0x25, 0x01, /* Logical Maximum 1 */
    0x95, 0x03, /* Report Count 3 */
    0x75, 0x01, /* Report Size 1 */
    0x81, 0x02, /* Input (Data, Var, Abs) */
    0x95, 0x01, /* Report Count 1 */
    0x75, 0x05, /* Report Size 5 */
    0x81, 0x01, /* Input (Cnst, Var, Abs) */
    0x05, 0x01, /* Usage Page Generic Desktop */
    0x09, 0x30, /* Usage X */
    0x09, 0x31, /* Usage Y */
    0x15, 0x00, /* Logical Minimum 0 */
    0x27, 0xFF, 0xFF, 0x00, 0x00, /* Logical Maximum 0xffff */
    0x75, 0x32, /* Report Size 32 */
    0x95, 0x02, /* Report Count 2 */
    0x81, 0x06, /* Input (Data, Var, Rel) */
    0x09, 0x32, /* Usage Z */
    0x15, 0x81, /* Logical Minimum -127 */
    0x25, 0x7F, /* Logical Maximum 127 */
    0x75, 0x08, /* Report Size 8 */
    0x95, 0x01, /* Report Count 1 */
    0xC0,       /* End Collection */
    0xC0,       /* End Collection */
};


I'm beginning to rate HID right up there with ACPI for complete brain melting 
factor..

(Not even compile tested yet.. still trying to fix the 1st one!)

--
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams




reply via email to

[Prev in Thread] Current Thread [Next in Thread]