VNC terminal server?
It occurs to me that this program would make an excellent basis for a VNC terminal server.
What I'm basically after is something that I can have several clients connect into one server, and the server does all the work and just outputs the screen and stuff over the network and recieves the input over the network.
VNC does all the I/O that's needed, would it be possible to set Qemu up though so it works with VNC as the I/O and simply sits on something like Linux as a server, starting a new instance every time another client connects?
Thanks all!
Sam
Quoted 6 lines · Samuel Hunt
It occurs to me that this program would make an excellent basis for a VNC terminal server.
What I'm basically after is something that I can have several clients connect into one server, and the server does all the work and just outputs the screen and stuff over the network and recieves the input over the network.
VNC does all the I/O that's needed, would it be possible to set Qemu up though so it works with VNC as the I/O and simply sits on something like Linux as a server, starting a new instance every time another client connects?
If you use the vnc patch you kinda get a large part of this already. Major issue is still mouse synch, but to be honest if you turn of all acceleration in the guest it stays pretty well synced up now as it is. I use it all the time on my server to host a win2k session when I need to access windows only stuff.. Coupled with kqemu it makes for a pretty quick combination.
I *suspect* this is sort of how win4lin terminal server works, though they use funky additions to keep the mouse sync rock solid and other groovy bits to make life really easy to manage. I've been meaning to try and get my hands on an eval version to try it out.. as <plug here> the desktop version makes life dead easy for almost anyone to just install and go. (like it used to with the old win9x version)
Currently I run gentoo, freebsd-6 and win2k sessions on my server.. they just sit there idle until I connect to them with vnc.. works a treat.
(server is debian)
Brad
Signature · 3 lines
"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
Quoted 3 lines · Brad Campbell
Quoted 2 lines · Samuel Hunt
It occurs to me that this program would make an excellent basis for a VNC terminal server.
[...]
Quoted 6 lines
If you use the vnc patch you kinda get a large part of this already. Major issue is still mouse synch, but to be honest if you turn of all acceleration in the guest it stays pretty well synced up now as it is. I use it all the time on my server to host a win2k session when I need to access windows only stuff.. Coupled with kqemu it makes for a pretty quick combination.
[...]
Quoted 4 lines
Currently I run gentoo, freebsd-6 and win2k sessions on my server.. they just sit there idle until I connect to them with vnc.. works a treat.
(server is debian)
Have you tried the vnc patch with current CVS? I'm seeing some issues with -vnc-and-sdl, and with -vnc only, it looks like something is not getting initialized, and I only see the qemu console in the vnc window. It appears the guest is running, but no video is going to VNC.
Quoted 11 lines · Troy Benjegerdes
Have you tried the vnc patch with current CVS? I'm seeing some issues with -vnc-and-sdl, and with -vnc only, it looks like something is not getting initialized, and I only see the qemu console in the vnc window. It appears the guest is running, but no video is going to VNC.
_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
I'm using either 13 or my hacked 12 version of the rfb patch with current CVS. I can't tell which at the moment. Both -vnc-and-sdl and -vnc work for me, but I do see some initalization wierdness when using -S. Switching to the monitor and back seems to clear it. I haven't investigated why.
WD
--
ReactOS is a hub, follow the spokes and you'll immediately find absolutely everything you need to know about Windows. ReactOS is not just software, it's people.
kjk_hyperion
Hi,
Quoted 2 lines · Samuel Hunt
It occurs to me that this program would make an excellent basis for a VNC terminal server.
Yeah, something like that has been done already:
http://libvncserver.sourceforge.net/qemu/qemu-rfb13.patch.gz
There is a notable update since rfb12 (which is a bit out of date _cough_): Nis Jorgensen has sent a patch to support scroll mice.
IMHO the biggest obstacle to inclusion in mainline QEmu is that the mouse support is rather flakey: You have to disable mouse acceleration of the guest OS.
I had that cunning plan to write a virtual Wacom tablet, but I just don't find the time.
Ciao,
Dscho
Hi Dscho,
this virtual Wacom tablet you refer to... is there a [free or built-in] Windows 2000/XP driver associated with it that supports either no acceleration and/or absolute positioning? If so, perhaps I can look at implementing it in QEMU in my "spare" time ;) Do you have a link to documentation and/or drivers? If the guest OS can't be easily told to not do any acceleration and/or use absolute cursor positioning rather than relative moves, it's not that helpful to have a new type of input device. I suspect a tablet driver can be easily configured this way since design people who probably use these devices want perfect precision between pointer and screen - otherwise they'd probably just use a mouse/trackball. But you can never be sure how Microsoft (or Wacom) decided to implement the Windows version of the driver.
The mouse sync solution we have in Win4Lin Pro is okay, but it's a bit slow and I'd like to do something much cleaner. Of course if I do the wacom tablet implementation, it will be open source and part of QEMU itself.
Thanks!
- Leo Reiter
Quoted 4 lines · Johannes Schindelin
I had that cunning plan to write a virtual Wacom tablet, but I just don't find the time.
Ciao,
Dscho
Signature · 8 lines
Leonardo E. Reiter Vice President of Product Development, CTO Win4Lin, Inc. Virtual Computing from Desktop to Data Center Main: +1 512 339 7979 Fax: +1 512 532 6501 http://www.win4lin.com
Hi,
Quoted 3 lines · Leonardo E. Reiter
this virtual Wacom tablet you refer to... is there a [free or built-in] Windows 2000/XP driver associated with it that supports either no acceleration and/or absolute positioning?
Frankly, I do not know if they are free. But as nobody pays me to play with QEmu, I do not care about Windows so much. And the Wacom drivers for Linux are free.
BTW I prefer a virtual wacom tablet to Summagraphics, since kudzu (the hardware detection which is used in Knoppix) can detect it. Unfortunately just the USB version :-(
Quoted 2 lines
If so, perhaps I can look at implementing it in QEMU in my "spare" time
;) Do you have a link to documentation and/or drivers?
Wow! What an offer! I have some documentation somewhere, I just had a look, and only found the Summagraphics documentation. I will look harder.
Quoted 8 lines
If the guest OS can't be easily told to not do any acceleration and/or use absolute cursor positioning rather than relative moves, it's not that helpful to have a new type of input device. I suspect a tablet driver can be easily configured this way since design people who probably use these devices want perfect precision between pointer and screen - otherwise they'd probably just use a mouse/trackball. But you can never be sure how Microsoft (or Wacom) decided to implement the Windows version of the driver.
My favourite cartoonist, Jamiri, is very proud of his Wacom tablet. IIRC, it has an integrated LCD display. So, I assume absolute positioning is automatically switched on with that tablet.
Quoted 6 lines
The mouse sync solution we have in Win4Lin Pro is okay, but it's a bit slow and I'd like to do something much cleaner. Of course if I do the wacom tablet implementation, it will be open source and part of QEMU itself.
Thanks!
Thank you!
Ciao,
Dscho
Quoted 1 line · Johannes Schindelin
Frankly, I do not know if they are free. But as nobody pays me to play with QEmu, I do not care about Windows so much. And the Wacom drivers for Linux are free.
Yes, I understand. I've been looking at the XFree86 version of the driver already. Unfortunately any time I spend on this will have to apply to Windows guests as well, as you can imagine. My company sells Windows-on-Linux software that uses QEMU, so it has to play with Windows guests ;) In fact, there was a recent PS/2 mouse patch on this list and a hack for XFree86 which was very simple. I didn't try it, but if you are using Linux guests you can probably get absolute positioning very easily. I don't recall who posted the patch - it was recent. The fix for the guest X server is very simple as well.
Quoted 2 lines
BTW I prefer a virtual wacom tablet to Summagraphics, since kudzu (the hardware detection which is used in Knoppix) can detect it. Unfortunately just the USB version :-(
Yes, given the state of USB in QEMU it's probably best to stick to serial for now if you want something that works very reliably and soon.
Serial would be my intention. The only issue may be how this plays
with Windows guests - again, this is very important to me.
Quoted 1 line
Wow! What an offer! I have some documentation somewhere, I just had a look, and only found the Summagraphics documentation. I will look harder.
Thanks!
Quoted 1 line
My favourite cartoonist, Jamiri, is very proud of his Wacom tablet. IIRC, it has an integrated LCD display. So, I assume absolute positioning is automatically switched on with that tablet.
I would think so too. But, in looking at the XFree86 version of the driver, it's apparently configurable and my fear is that Windows will flick it to relative mode so it can play acceleration tricks. But anyway, it's worth investigating.
Actually Jim C. Brown just posted a note that there is an existing patch, but I can't seem to find it. Jim, I'd be glad to look at it even though you are saying that it is still flaky - perhaps it can be fixed.
Thanks,
Leo Reiter
Signature · 8 lines
Leonardo E. Reiter Vice President of Product Development, CTO Win4Lin, Inc. Virtual Computing from Desktop to Data Center Main: +1 512 339 7979 Fax: +1 512 532 6501 http://www.win4lin.com
Quoted 5 lines · Johannes Schindelin
Hi,
On Sat, 8 Apr 2006, Leonardo E. Reiter wrote:
Quoted 7 lines
Quoted 2 lines
this virtual Wacom tablet you refer to... is there a [free or built-in] Windows 2000/XP driver associated with it that supports either no acceleration and/or absolute positioning?
Frankly, I do not know if they are free. But as nobody pays me to play with QEmu, I do not care about Windows so much. And the Wacom drivers for Linux are free.
BTW I prefer a virtual wacom tablet to Summagraphics, since kudzu (the hardware detection which is used in Knoppix) can detect it. Unfortunately just the USB version :-(
The USB version of the wacom tablet is not documented. Only the older serial tablets are.
Regards,
Anthony Liguori
Quoted 30 lines
Quoted 3 lines
If so, perhaps I can look at implementing it in QEMU in my "spare" time
;) Do you have a link to documentation and/or drivers?Wow! What an offer! I have some documentation somewhere, I just had a look, and only found the Summagraphics documentation. I will look harder.
Quoted 2 lines
If the guest OS can't be easily told to not do any acceleration and/or use absolute cursor positioning rather than relative moves, it's not that helpful to have a new type of input device. I suspect a tablet driver can be easily configured this way since design people who probably use these devices want perfect precision between pointer and screen - otherwise they'd probably just use a mouse/trackball. But you can never be sure how Microsoft (or Wacom) decided to implement the Windows version of the driver.
My favourite cartoonist, Jamiri, is very proud of his Wacom tablet. IIRC, it has an integrated LCD display. So, I assume absolute positioning is automatically switched on with that tablet.
Quoted 4 lines
The mouse sync solution we have in Win4Lin Pro is okay, but it's a bit slow and I'd like to do something much cleaner. Of course if I do the wacom tablet implementation, it will be open source and part of QEMU itself.
Thanks!
Thank you!
Ciao,
Dscho_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Quoted 2 lines · Leonardo E. Reiter
The mouse sync solution we have in Win4Lin Pro is okay, but it's a bit slow and I'd like to do something much cleaner. Of course if I do the wacom tablet implementation, it will be open source and part of QEMU itself.
This link might or might not be intersting
Apparently USB HID supports absolute input devices natively. Given we have a HID mouse driver of sorts in qemu I wonder if that is another avenue perhaps ?
Signature · 3 lines
"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
I saw something like this once but dismissed it for some reason (like it was questionable whether or not Windows supported these types of devices)... it's quite interesting.
Thanks,
- Leo Reiter
Quoted 8 lines · Brad Campbell
This link might or might not be intersting
Apparently USB HID supports absolute input devices natively. Given we have a HID mouse driver of sorts in qemu I wonder if that is another avenue perhaps ?
Signature · 8 lines
Leonardo E. Reiter Vice President of Product Development, CTO Win4Lin, Inc. Virtual Computing from Desktop to Data Center Main: +1 512 339 7979 Fax: +1 512 532 6501 http://www.win4lin.com
[Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
In reply to Brad CampbellThis 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
usb-hid.c 8 Apr 2006 20:56:02 -0000 renamed from usb-hid.c 5 Nov 2005 16:57:08 -0000 1.1 +1 -1
@@ -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, };
I'm still trying to figure out how the logical min/max apply if we are to report absolute (unsigned) positions in 16-bits. Obviously 8-bits is not enough for absolute coordinates. You could theoretically use only 12-bits per coordinate but that would make life difficult I think, and probably unnecessarily frugal in a software emulation.
It's not clear to me [yet] how the scroll wheel comes into play, and whether or not it (the dz coordinate) can be kept relative for ease of implementation. Also the code would need to be changed to report coordinates in 16-bits rather than 8, and of course made to report absolute coordinates (like from sdl.c, etc.) Still it looks fairly easy to implement - the USB spec is pretty simple.
So to reiterate, my patch does virtually nothing - in fact it will break usb-hid.c so please don't use it. I was just illustrating how to get it to report the device as providing 16-bit absolute coordinates instead of 8-bit relative ones. If anyone wants to chime in with more info, I'd be glad to make this a discussion. *If* using the USB HID device only, not any real USB devices, can be done without slowing down QEMU, then I think this is a great way to get a tablet emulated without having to deal with drivers on either side. Plus, in the long run, it probably means other neat stuff like being able to get away from ISA bus emulation, and also it's portable to other targets (for example, OS-X on PPC would talk to the USB HID device the same way theoretically), so it's likely the most portable and cleanest option.
Regards,
Leo Reiter
Quoted 3 lines · Brad Campbell
Apparently USB HID supports absolute input devices natively. Given we have a HID mouse driver of sorts in qemu I wonder if that is another avenue perhaps ?
Signature · 8 lines
Leonardo E. Reiter Vice President of Product Development, CTO Win4Lin, Inc. Virtual Computing from Desktop to Data Center Main: +1 512 339 7979 Fax: +1 512 532 6501 http://www.win4lin.com
Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
Sorry, the patch is not only incomplete, but totally wrong :( The 0x16 should be 0x10, like this:
Review
Quoted 2 lines
(quoted diff) +1
-1- 0x25, 0x7F, 0x75, 0x08, 0x95, 0x02, 0x81, 0x06, + 0x25, 0x7F, 0x75, 0x10, 0x95, 0x02, 0x81, 0x02,
I must have had a momentary lapse of [radix] reason :)
- Leo Reiter
Signature · 8 lines
Leonardo E. Reiter Vice President of Product Development, CTO Win4Lin, Inc. Virtual Computing from Desktop to Data Center Main: +1 512 339 7979 Fax: +1 512 532 6501 http://www.win4lin.com
Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
In reply to Leonardo E. ReiterQuoted 21 lines · Leonardo E. Reiter
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 inusb-hid.cto 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.1usb-hid.cusb-hid.c 8 Apr 2006 20:56:02 -0000 renamed from usb-hid.c 5 Nov 2005 16:57:08 -0000 1.1 +1
-1@@ -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, };
Quoted 1 line
I'm still trying to figure out how the logical min/max apply if we are to report absolute (unsigned) positions in 16-bits. Obviously 8-bits is not enough for absolute coordinates. You could theoretically use only 12-bits per coordinate but that would make life difficult I think, and probably unnecessarily frugal in a software emulation.
From what I have managed to read up on thus far, the absolute coordinates are pretty much fed directly to the application as mouse move events.
Now it's a long time since I've hacked on it but I wrote a userspace touch screen driver for win9x years ago that did just this.. I seem to recall having to scale the real touchscreen values to between 0x0 and 0xffff before feeding them in to the windows message queue. From memory 0,0 was top left and ffff,ffff was bottom right.. as applied to the current screen resolution. Windows worked the rest out itself.. Like I said.. very hazy memory..
I'll have a look in the morning and see if I can dig that code out to figure out what I did, but given the way windows mouse events work that seems logical and would be relatively easy to do in qemu. As for the wheel.. I have no idea. An idea I had a while back was to feed the wheel and buttons to the ps2 port and get the positioning info in some other fashion. Ugly.. very ugly..
Signature · 3 lines
"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
Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
Quoted 3 lines · Brad Campbell
Now it's a long time since I've hacked on it but I wrote a userspace touch screen driver for win9x years ago that did just this.. I seem to recall having to scale the real touchscreen values to between
0x0and0xffffbefore feeding them in to the windows message queue.
From memory 0,0 was top left and ffff,ffff was bottom right.. as
applied to the current screen resolution. Windows worked the rest out itself.. Like I said.. very hazy memory..
There's actually a GDI call you can make if you are in user space that will allow you to do absolute cursor addressing. The problem is that you have be in user space, and you have to be able to talk to the display. By the time this happens, it's way too late in general - for example, you already got past the Windows login screen, etc. It's basically what we do on Win4Lin Pro now, but it's not really adequate for the long run and it's not too fast. Ideally, a USB HID device would "just work" with the Windows HID "class" driver, and the rest will be history. HID device drivers are ubiquotous and work on every major OS, not just Windows obviously (Linux, *BSD, OS-X, etc.), so it truly would be the most universal solution. And, keeping with the spirit of QEMU, this solution would mean not having to modify anything in the guest either. Not too mention how it's 100 times easier (at least) to hack QEMU than to code a Windows device driver of any sort (IMHO anyway.)
Quoted 1 line
I'll have a look in the morning and see if I can dig that code out to figure out what I did, but given the way windows mouse events work that seems logical and would be relatively easy to do in qemu. As for the wheel.. I have no idea. An idea I had a while back was to feed the wheel and buttons to the ps2 port and get the positioning info in some other fashion. Ugly.. very ugly..
Actually the usb-hid.c already seems to be sending Z axis events (the wheel most likely)... it's just not clear, from reading the USB HID spec, how this relates to the data, or how this event is described. I admit I'm pretty new to deciphering USB, and also I haven't actually played with QEMU's usb-hid device either. As for the X and Y coordinate, they would have to be sent in some precision greater than 8-bits because screen resolutions are so high. A touchscreen is an ideal example of the type of device we need, even more so than a tablet.
Thankfully USB makes us not really care what type of physical device
it actually is, as long as we can describe it properly to the consumer (Windows/etc.). But anyway, we would want to be able to describe coordinates up to at least 1600x1200 since that is the max that cirrus_vga accepts, and that would require at least 11 bits per axis. You'd have to add 2 padding bits in the descriptor if you did it that way - easier would be 12-bits per axis. Then [I assume], when you send the motion packet, you would need to send the 24-bits packed rather than 8 and 8 as is done now. I just am not sure what happens to the dz part, since it's not really described anywhere that I can see. The code I'm referring to is in hw/usb-hid.c, in the function usb_mouse_poll(). It looks like the VM requests the Z axis value selectively, and the code handles this. I'm starting to believe that your dual-device idea makes good sense, because for example, a touchscreen doesn't have a Z axis. It will take some trial and error I suspect.
- Leo
Signature · 8 lines
Leonardo E. Reiter Vice President of Product Development, CTO Win4Lin, Inc. Virtual Computing from Desktop to Data Center Main: +1 512 339 7979 Fax: +1 512 532 6501 http://www.win4lin.com
Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
In reply to Leonardo E. ReiterI was looking through the Xorg evdev driver and it doesn't appear to support absolute coordinate reporting. evdev is how the USB mouse would show up to userspace. A little googling confirmed it for me:
http://lists.freedesktop.org/archives/xorg/2005-September/010140.html
USB wacom still seems the most promising to me but I fear getting it to work under Windows will be a pain.
Regards,
Anthony Liguori
Quoted 36 lines · Leonardo E. Reiter
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 inusb-hid.cto 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.1usb-hid.cusb-hid.c 8 Apr 2006 20:56:02 -0000 renamed from usb-hid.c 5 Nov 2005 16:57:08 -0000 1.1 +1
-1@@ -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, };I'm still trying to figure out how the logical min/max apply if we are to report absolute (unsigned) positions in 16-bits. Obviously 8-bits is not enough for absolute coordinates. You could theoretically use only 12-bits per coordinate but that would make life difficult I think, and probably unnecessarily frugal in a software emulation.
It's not clear to me [yet] how the scroll wheel comes into play, and whether or not it (the dz coordinate) can be kept relative for ease of implementation. Also the code would need to be changed to report coordinates in 16-bits rather than 8, and of course made to report absolute coordinates (like from
sdl.c, etc.) Still it looks fairly easy to implement - the USB spec is pretty simple.So to reiterate, my patch does virtually nothing - in fact it will break
usb-hid.cso please don't use it. I was just illustrating how to get it to report the device as providing 16-bit absolute coordinates instead of 8-bit relative ones. If anyone wants to chime in with more info, I'd be glad to make this a discussion. *If* using the USB HID device only, not any real USB devices, can be done without slowing down QEMU, then I think this is a great way to get a tablet emulated without having to deal with drivers on either side. Plus, in the long run, it probably means other neat stuff like being able to get away from ISA bus emulation, and also it's portable to other targets (for example, OS-X on PPC would talk to the USB HID device the same way theoretically), so it's likely the most portable and cleanest option.Regards,
Leo Reiter
Quoted 3 lines · Brad Campbell
Apparently USB HID supports absolute input devices natively. Given we have a HID mouse driver of sorts in qemu I wonder if that is another avenue perhaps ?
Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
Quoted 3 lines · Anthony Liguori
I was looking through the Xorg evdev driver and it doesn't appear to support absolute coordinate reporting. evdev is how the USB mouse would show up to userspace. A little googling confirmed it for me:
Doesn't look like a major issue. Sounds like someone is working on making evdev support absolute coordinates, and in the worse case it would be really trival to use something like malc_'s patch in order to make it work.
As long as the closed source OSes support it, I think we should go for it.
Quoted 5 lines
Regards,
Anthony Liguori
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
In reply to Anthony LiguoriYeah, the min/max value thing would be a pain for sure. The X server config method seems to be the best bet.
On another note, I am trying to imagine what would make logical sense for say, a touch screen. For example, an LCD panel has a native resolution, say 1024x768. It would then emulate (or transparently expand) other VESA resolutions, such as 640x480, on the fly. I would think that if it had touchscreen capabilities, the coordinates would always be reported in native mode. So the guest OS must have to scale them down... especially if the device reports the range early on in the identification process.
If this were done in QEMU, we'd have to pick an arbitrary "native" resolution - for example, 1600x1200, the max the cirrus device can go. We would then have to scale it down automatically based on the set resolution, so that the guest OS can scale it up.
I'm just thinking out loud. The good news is that making changes to the open source bits on guests (like Xorg) is trivial... it's, as been said, the closed source guests that would be the most problematic. So sticking to the HID protocol to make this happen would be best.
- Leo
Quoted 57 lines · Anthony Liguori
I was looking through the Xorg evdev driver and it doesn't appear to support absolute coordinate reporting. evdev is how the USB mouse would show up to userspace. A little googling confirmed it for me:
http://lists.freedesktop.org/archives/xorg/2005-September/010140.html
USB wacom still seems the most promising to me but I fear getting it to work under Windows will be a pain.
Regards,
Anthony Liguori
Quoted 25 lines · Leonardo E. Reiter
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 inusb-hid.cto 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.1usb-hid.cusb-hid.c 8 Apr 2006 20:56:02 -0000 renamed from usb-hid.c 5 Nov 2005 16:57:08 -0000 1.1 +1
-1@@ -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, };I'm still trying to figure out how the logical min/max apply if we are to report absolute (unsigned) positions in 16-bits. Obviously 8-bits is not enough for absolute coordinates. You could theoretically use only 12-bits per coordinate but that would make life difficult I think, and probably unnecessarily frugal in a software emulation.
It's not clear to me [yet] how the scroll wheel comes into play, and whether or not it (the dz coordinate) can be kept relative for ease of implementation. Also the code would need to be changed to report coordinates in 16-bits rather than 8, and of course made to report absolute coordinates (like from
sdl.c, etc.) Still it looks fairly easy to implement - the USB spec is pretty simple.Quoted 12 lines
So to reiterate, my patch does virtually nothing - in fact it will break
usb-hid.cso please don't use it. I was just illustrating how to get it to report the device as providing 16-bit absolute coordinates instead of 8-bit relative ones. If anyone wants to chime in with more info, I'd be glad to make this a discussion. *If* using the USB HID device only, not any real USB devices, can be done without slowing down QEMU, then I think this is a great way to get a tablet emulated without having to deal with drivers on either side. Plus, in the long run, it probably means other neat stuff like being able to get away from ISA bus emulation, and also it's portable to other targets (for example, OS-X on PPC would talk to the USB HID device the same way theoretically), so it's likely the most portable and cleanest option.Regards,
Leo Reiter
Quoted 3 lines · Brad Campbell
Apparently USB HID supports absolute input devices natively. Given we have a HID mouse driver of sorts in qemu I wonder if that is another avenue perhaps ?
_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Signature · 8 lines
Leonardo E. Reiter Vice President of Product Development, CTO Win4Lin, Inc. Virtual Computing from Desktop to Data Center Main: +1 512 339 7979 Fax: +1 512 532 6501 http://www.win4lin.com
Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
Quoted 3 lines · Leonardo E. Reiter
Yeah, the min/max value thing would be a pain for sure. The X server config method seems to be the best bet.
On another note, I am trying to imagine what would make logical sense for say, a touch screen. For example, an LCD panel has a native resolution, say 1024x768. It would then emulate (or transparently expand) other VESA resolutions, such as 640x480, on the fly. I would think that if it had touchscreen capabilities, the coordinates would always be reported in native mode. So the guest OS must have to scale them down... especially if the device reports the range early on in the identification process.
Every touchscreen I've ever used (which would be serial and USB Intellitouch and serial MicroTouch) used to report fixed absolute positions and the driver scaled them after a simple 2 or 5 point calibration routine. So they were indexed to the position on the monitor glass, not what was underneath it. We never changed screen resolutions so that was never an issue itself..
On LCD's it worked great and never needed recalibrating as the pixels don't move. On CRT's we needed to recalibrate every time some donkey fiddled with the H&V pos/scale knobs.
Interestingly enough the Intellitouch reports z axis as well. It delivers an 8 bit force value.
From what I've been able to figure thus far, the min/max thing seems to be the device telling the OS what it's minimum and maximum values are on each axis. It's then up to the OS to relate that to the current screen resolution.
And after finding my old code buried under many TB of other garbage.. I note my memory failed me partially. The mouse events were poked directly into the windows message queue with MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE and the X and Y values were calculated from the touchscreen calibration values, scaled to be 0x0->0xffff and poked in as dwords.
This was all cool as I had the cursor turned off. If the cursor needed to be displayed/moved also then it was set with SetCursorPos() which of course uses resolution dependent coordinates. Nice of windows to be consistent!
Time to do some 'sperimenting I guess..
Signature · 3 lines
"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
Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
In reply to Leonardo E. ReiterQuoted 12 lines · Leonardo E. Reiter
Yeah, the min/max value thing would be a pain for sure. The X server config method seems to be the best bet.
On another note, I am trying to imagine what would make logical sense for say, a touch screen. For example, an LCD panel has a native resolution, say 1024x768. It would then emulate (or transparently expand) other VESA resolutions, such as 640x480, on the fly. I would think that if it had touchscreen capabilities, the coordinates would always be reported in native mode. So the guest OS must have to scale them down... especially if the device reports the range early on in the identification process.
As Brad Campbell noted, touchscreens always report absolute coordinates that need to be scaled by the OS. I have a working emulation for the TSC2301 touchscreen controller (used in PDAs) in QEMU and what this chipset does is simply report raw voltage values from the three wires that connect the touchscreen device and chipset (through a configurable 12-bit A/D converter). These three signals (X, Y and pressure) usually take values in the range from about 300 to about 4000 (while the LCD resolution is 320x320) and contain some noise, but still the resolution of the touchscreen is much higher than the LCD's.
Under Linux, userspace can read these values using either evdev or tsdev (deprecated), both of which report only absolute coordinates. X compiled with tslib support works really nice with this touchscreen (both in QEMU and on real devices). Tslib performs the calibration, noise reduction (averaging) and other tricks.
In QEMU I use parts of Anthony Liguori's WACOM patch for absolute coordinates, except the cursor hiding, because the guest doesn't know where the cursor is until it receives the pen-down event (i.e until you click on QEMU window).
Quoted 111 lines
If this were done in QEMU, we'd have to pick an arbitrary "native" resolution - for example, 1600x1200, the max the cirrus device can go. We would then have to scale it down automatically based on the set resolution, so that the guest OS can scale it up.
I'm just thinking out loud. The good news is that making changes to the open source bits on guests (like Xorg) is trivial... it's, as been said, the closed source guests that would be the most problematic. So sticking to the HID protocol to make this happen would be best.
- Leo
Quoted 82 lines · Anthony Liguori
I was looking through the Xorg evdev driver and it doesn't appear to support absolute coordinate reporting. evdev is how the USB mouse would show up to userspace. A little googling confirmed it for me:
http://lists.freedesktop.org/archives/xorg/2005-September/010140.html
USB wacom still seems the most promising to me but I fear getting it to work under Windows will be a pain.
Regards,
Anthony Liguori
Quoted 51 lines · Leonardo E. Reiter
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 inusb-hid.cto 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.1usb-hid.cusb-hid.c 8 Apr 2006 20:56:02 -0000 renamed from usb-hid.c 5 Nov 2005 16:57:08 -0000 1.1 +1
-1@@ -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, };I'm still trying to figure out how the logical min/max apply if we are to report absolute (unsigned) positions in 16-bits. Obviously 8-bits is not enough for absolute coordinates. You could theoretically use only 12-bits per coordinate but that would make life difficult I think, and probably unnecessarily frugal in a software emulation.
It's not clear to me [yet] how the scroll wheel comes into play, and whether or not it (the dz coordinate) can be kept relative for ease of implementation. Also the code would need to be changed to report coordinates in 16-bits rather than 8, and of course made to report absolute coordinates (like from
sdl.c, etc.) Still it looks fairly easy to implement - the USB spec is pretty simple.So to reiterate, my patch does virtually nothing - in fact it will break
usb-hid.cso please don't use it. I was just illustrating how to get it to report the device as providing 16-bit absolute coordinates instead of 8-bit relative ones. If anyone wants to chime in with more info, I'd be glad to make this a discussion. *If* using the USB HID device only, not any real USB devices, can be done without slowing down QEMU, then I think this is a great way to get a tablet emulated without having to deal with drivers on either side. Plus, in the long run, it probably means other neat stuff like being able to get away from ISA bus emulation, and also it's portable to other targets (for example, OS-X on PPC would talk to the USB HID device the same way theoretically), so it's likely the most portable and cleanest option.Quoted 12 lines
Regards,
Leo Reiter
Quoted 5 lines · Brad Campbell
Apparently USB HID supports absolute input devices natively. Given we have a HID mouse driver of sorts in qemu I wonder if that is another avenue perhaps ?
Quoted 4 lines
_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel--
Leonardo E. Reiter
Vice President of Product Development, CTOWin4Lin, Inc.
Virtual Computing from Desktop to Data Center
Main: +1 512 339 7979
Fax: +1 512 532 6501
http://www.win4lin.com
Quoted 5 lines
_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Regards,
Andrew
--
balrog 2oo6
Dear Outlook users: Please remove me from your address books
http://www.newsforge.com/article.pl?sid=03/08/21/143258
Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
In reply to Leonardo E. ReiterQuoted 18 lines · Leonardo E. Reiter
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 inusb-hid.cto 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.1usb-hid.cusb-hid.c 8 Apr 2006 20:56:02 -0000 renamed from usb-hid.c 5 Nov 2005 16:57:08 -0000 1.1 +1
-1@@ -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, };
Quoted 2 lines
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
Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
Quoted 26 lines · Brad Campbell
Quoted 18 lines · Leonardo E. Reiter
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 inusb-hid.cto 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.1usb-hid.cusb-hid.c 8 Apr 2006 20:56:02 -0000 renamed from usb-hid.c 5 Nov 2005 16:57:08 -0000 1.1 +1
-1@@ -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, };Quoted 2 lines
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()
Quoted 3 lines
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.
Please see the patch posted yesterday to this mailing list:
Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
Quoted 3 lines · Lonnie Mendez
Please see the patch posted yesterday to this mailing list:
Ta for that.. not sure how I missed it.
Now to try and get it to work..
Sprinkling printf's around the place it inits the usb controller and mouse, registers that mouse as the mouse handler.. then promptly registers the ps2 mouse over the top.. so it's not working in any case. Having disabled the ps2 mouse in windows.. I need to get friendly with keyboard navigation of the device manager again ;)
Signature · 3 lines
"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
[Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
Quoted 9 lines · Brad Campbell
Quoted 3 lines · Lonnie Mendez
Please see the patch posted yesterday to this mailing list:
Ta for that.. not sure how I missed it.
Now to try and get it to work..
Ok.. 1st cut.. it's not great, and it's not hooked up to anything at the moment (the mouse just tootles around the screen on a timer) BUT! we have absolute movement.
The *stunning* news is it's resolution independent.. 640x480 - 800x600 - 1024x768 0,0 is top left and 7fff.7fff is bottom right.. no client scaling required..
Think I've figured out the Z axis thing also.. and we are good for relative movement on that still (The Z axis below is way wrong, but I think I have figured it out)
static const uint8_t qemu_mouse_hid_report_descriptor[] = {
0x05, 0x01, /* Usage Page Generic Desktop */
0x09, 0x01, /* 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, 0x10, /* Report Size 32 */
0x95, 0x02, /* Report Count 2 */
0x81, 0x02, /* Input (Data, Var, Abs) */
// 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 */
};#endif
static int usb_mouse_poll(USBMouseState *s, uint8_t *buf, int len)
{
int dx, dy, dz, b, l, aa, bb, cc, dd;
dx = int_clamp(s->dx, -128, 127);
dy = int_clamp(s->dy, -128, 127);
dz = int_clamp(s->dz, -128, 127);
s->dx -= dx;
s->dy -= dy;
s->dz -= dz;
b = 0;
if (s->buttons_state & MOUSE_EVENT_LBUTTON)
b |= 0x01;
if (s->buttons_state & MOUSE_EVENT_RBUTTON)
b |= 0x02;
if (s->buttons_state & MOUSE_EVENT_MBUTTON)
b |= 0x04;
buf[0] = b;
buf[1] = s->X & 0xff;
buf[2] = s->X >> 8;
buf[3] = s->Y & 0xff;
buf[4] = s->Y >> 8;
aa=buf[1];
bb=buf[2];
cc=buf[3];
dd=buf[4];
l = 5;
return l;
}Signature · 3 lines
"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
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
That's absolutely awesome Brad!
Good job! I'll see how it works with the new Xorg driver.
Regards,
Anthony Liguori
Quoted 88 lines · Brad Campbell
Quoted 9 lines · Brad Campbell
Quoted 3 lines · Lonnie Mendez
Please see the patch posted yesterday to this mailing list:
Ta for that.. not sure how I missed it.
Now to try and get it to work..Ok.. 1st cut.. it's not great, and it's not hooked up to anything at the moment (the mouse just tootles around the screen on a timer) BUT! we have absolute movement.
The *stunning* news is it's resolution independent.. 640x480 - 800x600
- 1024x768
0,0 is top left and 7fff.7fff is bottom right.. no client scaling required..Think I've figured out the Z axis thing also.. and we are good for relative movement on that still (The Z axis below is way wrong, but I think I have figured it out)
static const uint8_t qemu_mouse_hid_report_descriptor[] = { 0x05, 0x01, /* Usage Page Generic Desktop */ 0x09, 0x01, /* 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, 0x10, /* Report Size 32 */ 0x95, 0x02, /* Report Count 2 */ 0x81, 0x02, /* Input (Data, Var, Abs) */ // 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 */ };#endif
static int
usb_mouse_poll(USBMouseState *s, uint8_t *buf, int len){ int dx, dy, dz, b, l, aa, bb, cc, dd; dx = int_clamp(s->dx, -128, 127); dy = int_clamp(s->dy, -128, 127); dz = int_clamp(s->dz, -128, 127); s->dx -= dx; s->dy -= dy; s->dz -= dz; b = 0; if (s->buttons_state & MOUSE_EVENT_LBUTTON) b |= 0x01; if (s->buttons_state & MOUSE_EVENT_RBUTTON) b |= 0x02; if (s->buttons_state & MOUSE_EVENT_MBUTTON) b |= 0x04; buf[0] = b; buf[1] = s->X & 0xff; buf[2] = s->X >> 8; buf[3] = s->Y & 0xff; buf[4] = s->Y >> 8; aa=buf[1]; bb=buf[2]; cc=buf[3]; dd=buf[4]; l = 5; return l; }
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
In reply to Brad CampbellHi Brad,
I have your patch applied and the previous one and it doesn't seem to work under win2k. Can you post a patch of what you have?
I've got what I have attached. I did a little bit of SDL plumbing based on my touchscreen patch.
Regards,
Anthony Liguori
Quoted 79 lines · Brad Campbell
Quoted 9 lines · Brad Campbell
Quoted 3 lines · Lonnie Mendez
Please see the patch posted yesterday to this mailing list:
Ta for that.. not sure how I missed it.
Now to try and get it to work..Ok.. 1st cut.. it's not great, and it's not hooked up to anything at the moment (the mouse just tootles around the screen on a timer) BUT! we have absolute movement.
The *stunning* news is it's resolution independent.. 640x480 - 800x600
- 1024x768
0,0 is top left and 7fff.7fff is bottom right.. no client scaling required..Think I've figured out the Z axis thing also.. and we are good for relative movement on that still (The Z axis below is way wrong, but I think I have figured it out)
static const uint8_t qemu_mouse_hid_report_descriptor[] = { 0x05, 0x01, /* Usage Page Generic Desktop */ 0x09, 0x01, /* 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, 0x10, /* Report Size 32 */ 0x95, 0x02, /* Report Count 2 */ 0x81, 0x02, /* Input (Data, Var, Abs) */ // 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 */ };#endif
static int
usb_mouse_poll(USBMouseState *s, uint8_t *buf, int len){ int dx, dy, dz, b, l, aa, bb, cc, dd; dx = int_clamp(s->dx, -128, 127); dy = int_clamp(s->dy, -128, 127); dz = int_clamp(s->dz, -128, 127); s->dx -= dx; s->dy -= dy; s->dz -= dz; b = 0; if (s->buttons_state & MOUSE_EVENT_LBUTTON) b |= 0x01; if (s->buttons_state & MOUSE_EVENT_RBUTTON) b |= 0x02; if (s->buttons_state & MOUSE_EVENT_MBUTTON) b |= 0x04; buf[0] = b; buf[1] = s->X & 0xff; buf[2] = s->X >> 8; buf[3] = s->Y & 0xff; buf[4] = s->Y >> 8;
Quoted 9 lines
aa=buf[1];
bb=buf[2];
cc=buf[3];
dd=buf[4];
l = 5;
return l;
}hw/usb-hid.c +83 -9
@@ -33,6 +33,7 @@typedef struct USBMouseState {USBDevice dev;int dx, dy, dz, buttons_state; +int X, Y; }USBMouseState ;/* mostly the same values as the Bochs USB Mouse device */
@@ -92,14 +93,6 @@0x01 ,/* u8 if_bInterfaceSubClass; */ 0x02 ,/* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ 0x05 ,/* u8 if_iInterface; */ - -/* one endpoint (status change endpoint) */ -0x07 ,/* u8 ep_bLength; */ -0x05 ,/* u8 ep_bDescriptorType; Endpoint */ -0x81 ,/* u8 ep_bEndpointAddress; IN Endpoint 1 */ -0x03 ,/* u8 ep_bmAttributes; Interrupt */ -0x03 ,0x00 ,/* u16 ep_wMaxPacketSize; */ -0x0a ,/* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ /* HID descriptor */ 0x09, /* u8 bLength; */
@@ -109,8 +102,17 @@0x01 ,/* u8 num_descriptors */ 0x22 ,/* u8 type; Report */ 50 ,0 ,/* u16 len */ + +/* one endpoint (status change endpoint) */ +0x07 ,/* u8 ep_bLength; */ +0x05 ,/* u8 ep_bDescriptorType; Endpoint */ +0x81 ,/* u8 ep_bEndpointAddress; IN Endpoint 1 */ +0x03 ,/* u8 ep_bmAttributes; Interrupt */ +0x03 ,0x00 ,/* u16 ep_wMaxPacketSize; */ + 0x0a, /* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ }; +#if 0 static const uint8_t qemu_mouse_hid_report_descriptor[] = {0x05 ,0x01 ,0x09 ,0x02 ,0xA1 ,0x01 ,0x09 ,0x01 , 0xA1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03,
@@ -120,6 +122,41 @@0x25 ,0x7F ,0x75 ,0x08 ,0x95 ,0x02 ,0x81 ,0x06 , 0xC0, 0xC0, }; +#else +static const uint8_t qemu_mouse_hid_report_descriptor[] = { +0x05 ,0x01 ,/* Usage Page Generic Desktop */ +0x09 ,0x01 ,/* 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 ,0x10 ,/* Report Size 32 */ +0x95 ,0x02 ,/* Report Count 2 */ +0x81 ,0x02 ,/* Input (Data, Var, Abs) */ +// 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 */ +}; +#endif static void usb_mouse_event (void *opaque,int dx1,int dy1,int dz1,int buttons_state)
@@ -129,6 +166,8 @@ s->dx += dx1; s->dy += dy1; s->dz += dz1; + s->X = dx1; + s->Y = dy1; s->buttons_state = buttons_state; }
@@ -142,6 +181,7 @@return val; } +#if 0 static int usb_mouse_poll (USBMouseState *s,uint8_t *buf,int len) {int dx, dy, dz, b, l;
@@ -172,6 +212,37 @@ }return l; } +#else + +static int usb_mouse_poll (USBMouseState *s,uint8_t *buf,int len) +{ +int dx, dy, dz, b, l; + + dx =int_clamp (s->dx,-128 ,127 ); + dy =int_clamp (s->dy,-128 ,127 ); + dz =int_clamp (s->dz,-128 ,127 ); + + s->dx -= dx; + s->dy -= dy; + s->dz -= dz; + b =0 ; +if (s->buttons_state &MOUSE_EVENT_LBUTTON ) + b |=0x01 ; +if (s->buttons_state &MOUSE_EVENT_RBUTTON ) + b |=0x02 ; +if (s->buttons_state &MOUSE_EVENT_MBUTTON ) + b |=0x04 ; + + buf[0 ] = b; + buf[1 ] = s->X &0xff ; + buf[2 ] = s->X >>8 ; + buf[3 ] = s->Y &0xff ; + buf[4 ] = s->Y >>8 ; + l =5 ; + +return l; +} +#endif static void usb_mouse_handle_reset (USBDevice *dev) {
@@ -180,6 +251,8 @@ s->dx =0 ; s->dy =0 ; s->dz =0 ; + s->X =0 ; + s->Y =0 ; s->buttons_state =0 ; }
@@ -341,7 +414,8 @@ s->dev.handle_control = usb_mouse_handle_control; s->dev.handle_data = usb_mouse_handle_data; -qemu_add_mouse_event_handler (usb_mouse_event, s); +qemu_add_mouse_event_handler (NULL ,NULL ); +qemu_add_mouse_abs_event_handler (usb_mouse_event, s);return (USBDevice *)s; }
sdl.c +3 -0
@@ -301,6 +301,9 @@if (state &SDL_BUTTON (SDL_BUTTON_MIDDLE )) buttons |=MOUSE_EVENT_MBUTTON ;kbd_mouse_event (dx, dy, dz, buttons); + +SDL_GetMouseState (&dx, &dy); +kbd_mouse_abs_event (dx, dy, dz, buttons); }static void toggle_full_screen (DisplayState *ds)
vl.c +17 -1
@@ -475,6 +475,8 @@static void *qemu_put_kbd_event_opaque;static QEMUPutMouseEvent *qemu_put_mouse_event;static void *qemu_put_mouse_event_opaque; +static QEMUPutMouseAbsEvent *qemu_put_mouse_abs_event; +static void *qemu_put_mouse_abs_event_opaque;void qemu_add_kbd_event_handler (QEMUPutKBDEvent *func,void *opaque) {
@@ -486,6 +488,12 @@ { qemu_put_mouse_event_opaque = opaque; qemu_put_mouse_event = func; +} + +void qemu_add_mouse_abs_event_handler (QEMUPutMouseAbsEvent *func,void *opaque) +{ + qemu_put_mouse_abs_event_opaque = opaque; + qemu_put_mouse_abs_event = func; }void kbd_put_keycode (int keycode)
@@ -500,6 +508,14 @@if (qemu_put_mouse_event) {qemu_put_mouse_event (qemu_put_mouse_event_opaque, dx, dy, dz, buttons_state); + } +} + +void kbd_mouse_abs_event (int x,int y,int dz,int buttons_state) +{ +if (qemu_put_mouse_abs_event) { +qemu_put_mouse_abs_event (qemu_put_mouse_abs_event_opaque, + x, y, dz, buttons_state); } }
@@ -1308,7 +1324,7 @@/* for STDIO, we handle the case where several clients use it (nographic mode) */ -#define TERM_ESCAPE 0x01/* ctrl-a is used for escape */ +#define TERM_ESCAPE 0x1d/* ctrl-a is used for escape */ #define TERM_FIFO_MAX_SIZE 1
vl.h +3 -0
@@ -156,12 +156,15 @@typedef void QEMUPutKBDEvent (void *opaque,int keycode);typedef void QEMUPutMouseEvent (void *opaque,int dx,int dy,int dz,int buttons_state); +typedef void QEMUPutMouseAbsEvent (void *opaque,int x,int y,int dz,int buttons_state);void qemu_add_kbd_event_handler (QEMUPutKBDEvent *func,void *opaque);void qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque); +void qemu_add_mouse_abs_event_handler (QEMUPutMouseAbsEvent *func,void *opaque);void kbd_put_keycode (int keycode);void kbd_mouse_event (int dx,int dy,int dz,int buttons_state); +void kbd_mouse_abs_event (int x,int y,int dz,int buttons_state);/* keysym is a unicode code except for special keys (see QEMU_KEY_xxx constants) */
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
Quoted 5 lines · Anthony Liguori
Hi Brad,
I have your patch applied and the previous one and it doesn't seem to work under win2k. Can you post a patch of what you have?
I've got what I have attached. I did a little bit of SDL plumbing based on my touchscreen patch.
Really sorry about that.. it was not a patch as just an indicator of what I was doing..
here is what I have against latest cvs.. I've applied malc's grabless patch also and hacked around just to get it to work.. try to pretend it's not 1am here and I've not just left crap all over the place :)
http://fnarfbargle.dyndns.org:81/qemu/hid-grabless-001.patch
Signature · 3 lines
"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
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
In reply to Anthony LiguoriQuoted 6 lines · Anthony Liguori
Hi Brad,
I have your patch applied and the previous one and it doesn't seem to work under win2k. Can you post a patch of what you have?
I've got what I have attached. I did a little bit of SDL plumbing based on my touchscreen patch.
Ok.. now I've embarrassed myself by publicly releasing my spaghetti, I've had a look at what you are up to..
The VNC patch extends the existing mouse handler by passing it abs coordinates as well, (this is the basis of what I used) so there are no additional routines.. I figure if you pass both relative (faked if need be) and abs to the routine then the mouse can use whatever it likes.
It looks like you are adding a completely separate handler there ?
I had to stop the ps2 mouse handler registering itself to let the usb one have a go. But now its working. I've left both cursors live so you can see how well it mates up. There is a minor elastic discrepancy toward the bottom right of the screen, but I'm *sure* its just due to my off the top of my head hacky position calculations and it can be refined further..
I figure a command line switch for usbmouse/usbabs/ps2 might be in order so you can change depending on your os. Hopefully the evdev patch in X gets up and running and we can just default to abs mode.
I'll get hold of a wheel mouse tomorrow (my trackpad does not have a Z) and see if I can get the Z axis going..
Tested under win2k-SP4. How cool is it to be grabless and change resolutions on the fly.. I'll clean it up tomorrow and graft it into the vnc patch also.. virtual servers here we come!
Brad
Signature · 3 lines
"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
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
Hi,
Quoted 4 lines · Brad Campbell
The VNC patch extends the existing mouse handler by passing it abs coordinates as well, (this is the basis of what I used) so there are no additional routines.. I figure if you pass both relative (faked if need be) and abs to the routine then the mouse can use whatever it likes.
That was a kludge. I always meant to do some cleanup there as soon as I got Summagraphics to work with win98 (which has not yet happened :-( ).
I'd rather have two calls, one for absolute and one for relative, where relative checks if the current active mouse is relative or absolute, and in the latter case just calls absolute and vice versa.
Ciao,
Dscho
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
Quoted 7 lines · Johannes Schindelin
Hi,
Quoted 1 line · Brad Campbell
The VNC patch extends the existing mouse handler by passing it abs coordinates as well, (this is the basis of what I used) so there are no additional routines.. I figure if you pass both relative (faked if need be) and abs to the routine then the mouse can use whatever it likes.
That was a kludge. I always meant to do some cleanup there as soon as I got Summagraphics to work with win98 (which has not yet happened :-( ).
Ok, well I'll look at the work that Anthony has put in already and see what we come up with.
Speaking of Win98. I just tried this under win98, and after it installed its usb kit and the HID driver it kinda works.. looks like win98 expects 0x0-0xffff while 2k expects 0x0-0x7fff for the position information.. buttons are ok and tracking is good, just the target pointer only moves half the distance.
A problem perhaps, but one that could be worked around in a pinch..
Signature · 3 lines
"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
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
In reply to Brad CampbellQuoted 10 lines · Brad Campbell
Quoted 6 lines · Anthony Liguori
Hi Brad,
I have your patch applied and the previous one and it doesn't seem to work under win2k. Can you post a patch of what you have?
I've got what I have attached. I did a little bit of SDL plumbing based on my touchscreen patch.
Ok.. now I've embarrassed myself by publicly releasing my spaghetti, I've had a look at what you are up to..
The VNC patch extends the existing mouse handler by passing it abs coordinates as well, (this is the basis of what I used) so there are no additional routines.. I figure if you pass both relative (faked if need be) and abs to the routine then the mouse can use whatever it likes.
I don't really like that myself.
Quoted 2 lines
It looks like you are adding a completely separate handler there ?
Yeah, I figure if a device is interested only in relative movements (like the PS/2 mouse), that's all it should get.
Quoted 1 line
I had to stop the ps2 mouse handler registering itself to let the usb one have a go. But now its working. I've left both cursors live so you can see how well it mates up. There is a minor elastic discrepancy toward the bottom right of the screen, but I'm *sure* its just due to my off the top of my head hacky position calculations and it can be refined further..
Everything seems to work fine for me. Both mice get their own coordinates and the guest choices which one it wants. In Windows, once you log in the first time, it detects the mouse and switches over to the USB mouse.
I've added the necessary stuff to SDL so that the switch over occurs gracefully. Once the USB mouse starts being used, SDL no longer triggers grab on left click (but still on ctrl-alt) and always reports mouse movements. I also got rid of the ShowCursor() calls as that warps the host mouse.
Quoted 1 line
I figure a command line switch for usbmouse/usbabs/ps2 might be in order so you can change depending on your os. Hopefully the evdev patch in X gets up and running and we can just default to abs mode.
I'm not sure a command line switch is needed. I think we can have it automatically do the right thing. Attached is my latest patch. I did some awful things to SDL that I'd like to clean up. The only real "feature" I'd like to add is automatic breaking of grap when the USB mouse is detected.
Quoted 5 lines
I'll get hold of a wheel mouse tomorrow (my trackpad does not have a Z) and see if I can get the Z axis going..
Tested under win2k-SP4. How cool is it to be grabless and change resolutions on the fly.. I'll clean it up tomorrow and graft it into the vnc patch also.. virtual servers here we come!
Seriously, awesome job here :-)
Regards,
Anthony Liguori
Quoted 2 lines
Brad
hw/usb-hid.c +87 -10
@@ -33,6 +33,7 @@typedef struct USBMouseState {USBDevice dev;int dx, dy, dz, buttons_state; +int X, Y; }USBMouseState ;/* mostly the same values as the Bochs USB Mouse device */
@@ -92,14 +93,6 @@0x01 ,/* u8 if_bInterfaceSubClass; */ 0x02 ,/* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ 0x05 ,/* u8 if_iInterface; */ - -/* one endpoint (status change endpoint) */ -0x07 ,/* u8 ep_bLength; */ -0x05 ,/* u8 ep_bDescriptorType; Endpoint */ -0x81 ,/* u8 ep_bEndpointAddress; IN Endpoint 1 */ -0x03 ,/* u8 ep_bmAttributes; Interrupt */ -0x03 ,0x00 ,/* u16 ep_wMaxPacketSize; */ -0x0a ,/* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ /* HID descriptor */ 0x09, /* u8 bLength; */
@@ -108,9 +101,18 @@0x00 ,/* u8 country_code */ 0x01 ,/* u8 num_descriptors */ 0x22 ,/* u8 type; Report */ - 50, 0, /* u16 len */ +53 ,0 ,/* u16 len */ + +/* one endpoint (status change endpoint) */ +0x07 ,/* u8 ep_bLength; */ +0x05 ,/* u8 ep_bDescriptorType; Endpoint */ +0x81 ,/* u8 ep_bEndpointAddress; IN Endpoint 1 */ +0x03 ,/* u8 ep_bmAttributes; Interrupt */ +0x08 ,0x00 ,/* u16 ep_wMaxPacketSize; */ + 0x03, /* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ }; +#if 0 static const uint8_t qemu_mouse_hid_report_descriptor[] = {0x05 ,0x01 ,0x09 ,0x02 ,0xA1 ,0x01 ,0x09 ,0x01 , 0xA1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03,
@@ -120,6 +122,41 @@0x25 ,0x7F ,0x75 ,0x08 ,0x95 ,0x02 ,0x81 ,0x06 , 0xC0, 0xC0, }; +#else +static const uint8_t qemu_mouse_hid_report_descriptor[] = { +0x05 ,0x01 ,/* Usage Page Generic Desktop */ +0x09 ,0x01 ,/* 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 ,0x10 ,/* Report Size 32 */ +0x95 ,0x02 ,/* Report Count 2 */ +0x81 ,0x02 ,/* Input (Data, Var, Abs) */ +// 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 */ +}; +#endif static void usb_mouse_event (void *opaque,int dx1,int dy1,int dz1,int buttons_state)
@@ -129,6 +166,8 @@ s->dx += dx1; s->dy += dy1; s->dz += dz1; + s->X = dx1; + s->Y = dy1; s->buttons_state = buttons_state; }
@@ -142,6 +181,7 @@return val; } +#if 0 static int usb_mouse_poll (USBMouseState *s,uint8_t *buf,int len) {int dx, dy, dz, b, l;
@@ -172,6 +212,40 @@ }return l; } +#else + +static int usb_mouse_poll (USBMouseState *s,uint8_t *buf,int len) +{ +int dx, dy, dz, b, l; + +/* FIXME this is ugly */ + absolute_mouse =1 ; + + dx =int_clamp (s->dx,-128 ,127 ); + dy =int_clamp (s->dy,-128 ,127 ); + dz =int_clamp (s->dz,-128 ,127 ); + + s->dx -= dx; + s->dy -= dy; + s->dz -= dz; + b =0 ; +if (s->buttons_state &MOUSE_EVENT_LBUTTON ) + b |=0x01 ; +if (s->buttons_state &MOUSE_EVENT_RBUTTON ) + b |=0x02 ; +if (s->buttons_state &MOUSE_EVENT_MBUTTON ) + b |=0x04 ; + + buf[0 ] = b; + buf[1 ] = s->X &0xff ; + buf[2 ] = s->X >>8 ; + buf[3 ] = s->Y &0xff ; + buf[4 ] = s->Y >>8 ; + l =5 ; + +return l; +} +#endif static void usb_mouse_handle_reset (USBDevice *dev) {
@@ -180,6 +254,8 @@ s->dx =0 ; s->dy =0 ; s->dz =0 ; + s->X =0 ; + s->Y =0 ; s->buttons_state =0 ; }
@@ -341,7 +417,8 @@ s->dev.handle_control = usb_mouse_handle_control; s->dev.handle_data = usb_mouse_handle_data; -qemu_add_mouse_event_handler (usb_mouse_event, s); +qemu_add_mouse_event_handler (NULL ,NULL ); +qemu_add_mouse_abs_event_handler (usb_mouse_event, s);return (USBDevice *)s; }
sdl.c +30 -4
@@ -39,6 +39,10 @@static int gui_fullscreen_initial_grab;static int gui_grab_code =KMOD_LALT |KMOD_LCTRL ;static uint8_t modifiers_state[256 ]; +static int width, height; +static SDL_Cursor *sdl_cursor_normal; +static SDL_Cursor *sdl_cursor_hidden; +static int cursor_hidden =0 ;static void sdl_update (DisplayState *ds,int x,int y,int w,int h) {
@@ -55,6 +59,9 @@ flags =SDL_HWSURFACE |SDL_ASYNCBLIT |SDL_HWACCEL ;if (gui_fullscreen) flags |=SDL_FULLSCREEN ; + + width = w; + height = h; again: screen =SDL_SetVideoMode (w, h,0 , flags);
@@ -273,7 +280,9 @@static void sdl_grab_start (void ) { -SDL_ShowCursor (0 ); + sdl_cursor_normal =SDL_GetCursor (); +SDL_SetCursor (sdl_cursor_hidden); + cursor_hidden =1 ;SDL_WM_GrabInput (SDL_GRAB_ON );/* dummy read to avoid moving the mouse */ SDL_GetRelativeMouseState (NULL ,NULL );
@@ -284,7 +293,10 @@static void sdl_grab_end (void ) {SDL_WM_GrabInput (SDL_GRAB_OFF ); -SDL_ShowCursor (1 ); +if (!absolute_mouse) { +SDL_SetCursor (sdl_cursor_normal); + cursor_hidden =1 ; + } gui_grab =0 ;sdl_update_caption (); }
@@ -301,6 +313,17 @@if (state &SDL_BUTTON (SDL_BUTTON_MIDDLE )) buttons |=MOUSE_EVENT_MBUTTON ;kbd_mouse_event (dx, dy, dz, buttons); + +SDL_GetMouseState (&dx, &dy); +kbd_mouse_abs_event (dx *0x7FFF / width, + dy *0x7FFF / height, + dz, buttons); +if (absolute_mouse && !cursor_hidden) { + sdl_cursor_normal =SDL_GetCursor (); +SDL_SetCursor (sdl_cursor_hidden); + cursor_hidden =1 ; + } + }static void toggle_full_screen (DisplayState *ds)
@@ -427,7 +450,7 @@qemu_system_shutdown_request ();break ;case SDL_MOUSEMOTION : -if (gui_grab) { +if (gui_grab || absolute_mouse) {sdl_send_mouse_event (0 ); }break ;
@@ -435,7 +458,7 @@case SDL_MOUSEBUTTONUP : {SDL_MouseButtonEvent *bev = &ev->button; -if (!gui_grab) { +if (!gui_grab && !absolute_mouse) {if (ev->type ==SDL_MOUSEBUTTONDOWN && (bev->state &SDL_BUTTON_LMASK )) {/* start grabbing all events */
@@ -475,6 +498,7 @@void sdl_display_init (DisplayState *ds,int full_screen) {int flags; +uint8_t data =0 ;#if defined(__APPLE__)/* always use generic keymaps */
@@ -508,6 +532,8 @@SDL_EnableUNICODE (1 ); gui_grab =0 ; + sdl_cursor_hidden =SDL_CreateCursor (&data, &data,8 ,1 ,0 ,0 ); +atexit (sdl_cleanup);if (full_screen) { gui_fullscreen =1 ;
vl.c +17 -0
@@ -148,6 +148,7 @@USBDevice *vm_usb_hub;static VLANState *first_vlan;int smp_cpus =1 ; +int absolute_mouse =0 ;#if defined(TARGET_SPARC )#define MAX_CPUS 16#elif defined(TARGET_I386 )
@@ -475,6 +476,8 @@static void *qemu_put_kbd_event_opaque;static QEMUPutMouseEvent *qemu_put_mouse_event;static void *qemu_put_mouse_event_opaque; +static QEMUPutMouseAbsEvent *qemu_put_mouse_abs_event; +static void *qemu_put_mouse_abs_event_opaque;void qemu_add_kbd_event_handler (QEMUPutKBDEvent *func,void *opaque) {
@@ -486,6 +489,12 @@ { qemu_put_mouse_event_opaque = opaque; qemu_put_mouse_event = func; +} + +void qemu_add_mouse_abs_event_handler (QEMUPutMouseAbsEvent *func,void *opaque) +{ + qemu_put_mouse_abs_event_opaque = opaque; + qemu_put_mouse_abs_event = func; }void kbd_put_keycode (int keycode)
@@ -500,6 +509,14 @@if (qemu_put_mouse_event) {qemu_put_mouse_event (qemu_put_mouse_event_opaque, dx, dy, dz, buttons_state); + } +} + +void kbd_mouse_abs_event (int x,int y,int dz,int buttons_state) +{ +if (qemu_put_mouse_abs_event) { +qemu_put_mouse_abs_event (qemu_put_mouse_abs_event_opaque, + x, y, dz, buttons_state); } }
vl.h +4 -0
@@ -138,6 +138,7 @@extern int win2k_install_hack;extern int usb_enabled;extern int smp_cpus; +extern int absolute_mouse;/* XXX: make it dynamic */ #if defined (TARGET_PPC )
@@ -156,12 +157,15 @@typedef void QEMUPutKBDEvent (void *opaque,int keycode);typedef void QEMUPutMouseEvent (void *opaque,int dx,int dy,int dz,int buttons_state); +typedef void QEMUPutMouseAbsEvent (void *opaque,int x,int y,int dz,int buttons_state);void qemu_add_kbd_event_handler (QEMUPutKBDEvent *func,void *opaque);void qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque); +void qemu_add_mouse_abs_event_handler (QEMUPutMouseAbsEvent *func,void *opaque);void kbd_put_keycode (int keycode);void kbd_mouse_event (int dx,int dy,int dz,int buttons_state); +void kbd_mouse_abs_event (int x,int y,int dz,int buttons_state);/* keysym is a unicode code except for special keys (see QEMU_KEY_xxx constants) */
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
sdl.c line 319
Quoted 2 lines · Anthony Liguori
sdl.c +2
-0+ kbd_mouse_abs_event(dx * 0x7FFF / width, + dy * 0x7FFF / height,
I had just made that same mod to my tree.. solved the tracking problem perfectly.
Now if only it would work under win98 without modification..
Look what I just stumbled across.. irrelevant now I guess..
I wonder.. does windows switch over from ps2 to hid or just react to both and given hid is more positive about where it wants the mouse to go it wins ? I'm sure I've used a ps2 mouse and a usb mouse on windows before.. I'm thought they both worked at the same time.
Like what you have with the rest of the patch.. I'll clean up my tree and go with that I think..
That should work quite well for sdl, gtk and vnc displays.. I guess cocoa also.. Now all we need is X support. I guess as a temporary measure the wacom patch works with linux..
Do you find having usb enabled makes the windows session feel a bit less responsive or jerkier ?
I know the mouse tracking is not as smooth with usb.. perhaps having ps2 and usb on together will smooth that out a little.
Signature · 3 lines
"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
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
Quoted 9 lines · Brad Campbell
Review
Quoted 2 lines · Anthony Liguori
(quoted diff) +2
-0+ kbd_mouse_abs_event(dx * 0x7FFF / width, + dy * 0x7FFF / height,I had just made that same mod to my tree.. solved the tracking problem perfectly.
Now if only it would work under win98 without modification..
Quoted 7 lines
Look what I just stumbled across.. irrelevant now I guess..
I wonder.. does windows switch over from ps2 to hid or just react to both and given hid is more positive about where it wants the mouse to go it wins ? I'm sure I've used a ps2 mouse and a usb mouse on windows before.. I'm thought they both worked at the same time.
I think they do. I think the absolute movements just override the relative ones. However, this may just be a twist of fate so I think it's safer to disable relative reporting.
Quoted 1 line
Like what you have with the rest of the patch.. I'll clean up my tree and go with that I think..
Final one of the night. This patch disables relative mouse reporting and disables grab automatically the first time SDL detects that the absolute mouse was enabled. Needs a lot of cleanup but I'm very happy with the user experience on this one.
Quoted 2 lines
That should work quite well for sdl, gtk and vnc displays.. I guess cocoa also.. Now all we need is X support. I guess as a temporary measure the wacom patch works with linux..
Creating a VM right now to try out the latest Xorg driver. Wacom for older Linux guests is probably not a bad idea.
Quoted 2 lines
Do you find having usb enabled makes the windows session feel a bit less responsive or jerkier ?
I know the mouse tracking is not as smooth with usb.. perhaps having ps2 and usb on together will smooth that out a little.
I don't really see a difference. It actually seems a bit nicer with the USB mouse enabled (as the mouse moves with the same acceleration as under the host). One thing I noticed with the Wacom driver is that the PS/2 mouse tends to accelerate faster than the host mouse and that tends to give a feeling of a "snappier" interface. That may be what you're experiencing.
Regards,
Anthony Liguori
# HG changeset patch
# User Anthony Liguori <[email protected]>
# Node ID c2a6c24121b8a56622cafddf39812a37ab887600
# Parent 8937c657c23f99c8d352cc2b68a2e8a814243ec7
USB Mouse support for with absolute coordinates. The HID modifications are all from Brad Campbell <[email protected]>
hw/usb-hid.c +90 -10
@@ -33,6 +33,7 @@typedef struct USBMouseState {USBDevice dev;int dx, dy, dz, buttons_state; +int X, Y; }USBMouseState ;/* mostly the same values as the Bochs USB Mouse device */
@@ -92,14 +93,6 @@0x01 ,/* u8 if_bInterfaceSubClass; */ 0x02 ,/* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ 0x05 ,/* u8 if_iInterface; */ - -/* one endpoint (status change endpoint) */ -0x07 ,/* u8 ep_bLength; */ -0x05 ,/* u8 ep_bDescriptorType; Endpoint */ -0x81 ,/* u8 ep_bEndpointAddress; IN Endpoint 1 */ -0x03 ,/* u8 ep_bmAttributes; Interrupt */ -0x03 ,0x00 ,/* u16 ep_wMaxPacketSize; */ -0x0a ,/* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ /* HID descriptor */ 0x09, /* u8 bLength; */
@@ -108,9 +101,18 @@0x00 ,/* u8 country_code */ 0x01 ,/* u8 num_descriptors */ 0x22 ,/* u8 type; Report */ - 50, 0, /* u16 len */ +53 ,0 ,/* u16 len */ + +/* one endpoint (status change endpoint) */ +0x07 ,/* u8 ep_bLength; */ +0x05 ,/* u8 ep_bDescriptorType; Endpoint */ +0x81 ,/* u8 ep_bEndpointAddress; IN Endpoint 1 */ +0x03 ,/* u8 ep_bmAttributes; Interrupt */ +0x08 ,0x00 ,/* u16 ep_wMaxPacketSize; */ + 0x03, /* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ }; +#if 0 static const uint8_t qemu_mouse_hid_report_descriptor[] = {0x05 ,0x01 ,0x09 ,0x02 ,0xA1 ,0x01 ,0x09 ,0x01 , 0xA1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03,
@@ -120,6 +122,41 @@0x25 ,0x7F ,0x75 ,0x08 ,0x95 ,0x02 ,0x81 ,0x06 , 0xC0, 0xC0, }; +#else +static const uint8_t qemu_mouse_hid_report_descriptor[] = { +0x05 ,0x01 ,/* Usage Page Generic Desktop */ +0x09 ,0x01 ,/* 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 ,0x10 ,/* Report Size 32 */ +0x95 ,0x02 ,/* Report Count 2 */ +0x81 ,0x02 ,/* Input (Data, Var, Abs) */ +// 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 */ +}; +#endif static void usb_mouse_event (void *opaque,int dx1,int dy1,int dz1,int buttons_state)
@@ -129,6 +166,8 @@ s->dx += dx1; s->dy += dy1; s->dz += dz1; + s->X = dx1; + s->Y = dy1; s->buttons_state = buttons_state; }
@@ -142,6 +181,7 @@return val; } +#if 0 static int usb_mouse_poll (USBMouseState *s,uint8_t *buf,int len) {int dx, dy, dz, b, l;
@@ -172,6 +212,44 @@ }return l; } +#else + +static int usb_mouse_poll (USBMouseState *s,uint8_t *buf,int len) +{ +int dx, dy, dz, b, l; + +/* FIXME this is ugly */ +if (absolute_mouse ==0 ) { +/* disable the PS/2 mouse */ +qemu_add_mouse_event_handler (NULL ,NULL ); + absolute_mouse =1 ; + } + + dx =int_clamp (s->dx,-128 ,127 ); + dy =int_clamp (s->dy,-128 ,127 ); + dz =int_clamp (s->dz,-128 ,127 ); + + s->dx -= dx; + s->dy -= dy; + s->dz -= dz; + b =0 ; +if (s->buttons_state &MOUSE_EVENT_LBUTTON ) + b |=0x01 ; +if (s->buttons_state &MOUSE_EVENT_RBUTTON ) + b |=0x02 ; +if (s->buttons_state &MOUSE_EVENT_MBUTTON ) + b |=0x04 ; + + buf[0 ] = b; + buf[1 ] = s->X &0xff ; + buf[2 ] = s->X >>8 ; + buf[3 ] = s->Y &0xff ; + buf[4 ] = s->Y >>8 ; + l =5 ; + +return l; +} +#endif static void usb_mouse_handle_reset (USBDevice *dev) {
@@ -180,6 +258,8 @@ s->dx =0 ; s->dy =0 ; s->dz =0 ; + s->X =0 ; + s->Y =0 ; s->buttons_state =0 ; }
@@ -341,7 +421,7 @@ s->dev.handle_control = usb_mouse_handle_control; s->dev.handle_data = usb_mouse_handle_data; -qemu_add_mouse_event_handler (usb_mouse_event, s); +qemu_add_mouse_abs_event_handler (usb_mouse_event, s);return (USBDevice *)s; }
sdl.c +39 -4
97 lines not on this page · raw message
vl.c +17 -0
@@ -148,6 +148,7 @@USBDevice *vm_usb_hub;static VLANState *first_vlan;int smp_cpus =1 ; +int absolute_mouse =0 ;#if defined(TARGET_SPARC )#define MAX_CPUS 16#elif defined(TARGET_I386 )
@@ -475,6 +476,8 @@static void *qemu_put_kbd_event_opaque;static QEMUPutMouseEvent *qemu_put_mouse_event;static void *qemu_put_mouse_event_opaque; +static QEMUPutMouseAbsEvent *qemu_put_mouse_abs_event; +static void *qemu_put_mouse_abs_event_opaque;void qemu_add_kbd_event_handler (QEMUPutKBDEvent *func,void *opaque) {
@@ -486,6 +489,12 @@ { qemu_put_mouse_event_opaque = opaque; qemu_put_mouse_event = func; +} + +void qemu_add_mouse_abs_event_handler (QEMUPutMouseAbsEvent *func,void *opaque) +{ + qemu_put_mouse_abs_event_opaque = opaque; + qemu_put_mouse_abs_event = func; }void kbd_put_keycode (int keycode)
@@ -500,6 +509,14 @@if (qemu_put_mouse_event) {qemu_put_mouse_event (qemu_put_mouse_event_opaque, dx, dy, dz, buttons_state); + } +} + +void kbd_mouse_abs_event (int x,int y,int dz,int buttons_state) +{ +if (qemu_put_mouse_abs_event) { +qemu_put_mouse_abs_event (qemu_put_mouse_abs_event_opaque, + x, y, dz, buttons_state); } }
vl.h +4 -0
@@ -138,6 +138,7 @@extern int win2k_install_hack;extern int usb_enabled;extern int smp_cpus; +extern int absolute_mouse;/* XXX: make it dynamic */ #if defined (TARGET_PPC )
@@ -156,12 +157,15 @@typedef void QEMUPutKBDEvent (void *opaque,int keycode);typedef void QEMUPutMouseEvent (void *opaque,int dx,int dy,int dz,int buttons_state); +typedef void QEMUPutMouseAbsEvent (void *opaque,int x,int y,int dz,int buttons_state);void qemu_add_kbd_event_handler (QEMUPutKBDEvent *func,void *opaque);void qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque); +void qemu_add_mouse_abs_event_handler (QEMUPutMouseAbsEvent *func,void *opaque);void kbd_put_keycode (int keycode);void kbd_mouse_event (int dx,int dy,int dz,int buttons_state); +void kbd_mouse_abs_event (int x,int y,int dz,int buttons_state);/* keysym is a unicode code except for special keys (see QEMU_KEY_xxx constants) */
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
Quoted 5 lines · Anthony Liguori
Quoted 2 lines
I wonder.. does windows switch over from ps2 to hid or just react to both and given hid is more positive about where it wants the mouse to go it wins ? I'm sure I've used a ps2 mouse and a usb mouse on windows before.. I'm thought they both worked at the same time.
I think they do. I think the absolute movements just override the relative ones. However, this may just be a twist of fate so I think it's safer to disable relative reporting.
I think so.. I'm getting double clicks on every left button press here with your older patch. I'll try this revised one then I'm off to bed..
Good work!
Brad
Signature · 3 lines
"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
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
In reply to Anthony LiguoriQuoted 2 lines · Anthony Liguori
Final one of the night. This patch disables relative mouse reporting and disables grab automatically the first time SDL detects that the absolute mouse was enabled. Needs a lot of cleanup but I'm very happy with the user experience on this one.
Perfect with a capital *P*. Disabling the sdl cursor make it look that much smoother..
My biggest problem now is my motor memory is toast. I run a trackball here and I've just been used to giving it a whirl to let the pointer slam up against the edge of the window.. now it runs off the other side of the host screen :)
Signature · 3 lines
"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
Re: [Qemu-devel] Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)
In reply to Anthony LiguoriQuoted 3 lines · Anthony Liguori
Final one of the night. This patch disables relative mouse reporting and disables grab automatically the first time SDL detects that the absolute mouse was enabled. Needs a lot of cleanup but I'm very happy with the user experience on this one.
Wish I'd just gone to bed now..
Heres a patch against your last one to implement wheel support.
Brad
Signature · 3 lines
"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
hw/usb-hid.c +16 -10
@@ -101,7 +101,7 @@0x00 ,/* u8 country_code */ 0x01 ,/* u8 num_descriptors */ 0x22 ,/* u8 type; Report */ -53 ,0 ,/* u16 len */ +65 ,0 ,/* u16 len */ /* one endpoint (status change endpoint) */ 0x07, /* u8 ep_bLength; */
@@ -145,14 +145,15 @@0x09 ,0x31 ,/* Usage Y */ 0x15 ,0x00 ,/* Logical Minimum 0 */ 0x27 ,0xFF ,0xFF ,0x00 ,0x00 ,/* Logical Maximum 0xffff */ -0x75 ,0x10 ,/* Report Size 32 */ +0x75 ,0x10 ,/* Report Size 16 */ 0x95 ,0x02 ,/* Report Count 2 */ 0x81 ,0x02 ,/* Input (Data, Var, Abs) */ -// 0x09, 0x32, /* Usage Z */ -// 0x15, 0x81, /* Logical Minimum -127 */ -// 0x25, 0x7F, /* Logical Maximum 127 */ -// 0x75, 0x08, /* Report Size 8 */ -// 0x95, 0x01, /* Report Count 1 */ +0x09 ,0x38 ,/* Usage Wheel */ +0x15 ,0x81 ,/* Logical Minimum -127 */ +0x25 ,0x7F ,/* Logical Maximum 127 */ +0x75 ,0x08 ,/* Report Size 8 */ +0x95 ,0x01 ,/* Report Count 1 */ +0x81 ,0x02 ,/* Input (Data, Var, Rel) */ 0xC0 ,/* End Collection */ 0xC0, /* End Collection */ };
@@ -224,14 +225,18 @@qemu_add_mouse_event_handler (NULL ,NULL ); absolute_mouse =1 ; } - +/* dx = int_clamp(s->dx, -128, 127); dy = int_clamp(s->dy, -128, 127); - dz =int_clamp (s->dz,-128 ,127 );s->dx -= dx; s->dy -= dy; +*/ + + dz =int_clamp (s->dz,-128 ,127 ); s->dz -= dz; +/* Appears we have to invert the wheel direction */ + dz =0 - dz; b =0 ;if (s->buttons_state &MOUSE_EVENT_LBUTTON ) b |=0x01 ;
@@ -245,7 +250,8 @@ buf[2 ] = s->X >>8 ; buf[3 ] = s->Y &0xff ; buf[4 ] = s->Y >>8 ; - l =5 ; + buf[5 ] = dz; + l =6 ;return l; }
Re: [Qemu-devel] USB Tablet Emulation (was: Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server))
I spent some time cleaning this all up. The following integrates Brad's patches and the patch from http://gnome.dnsalias.net/patches/qemu-hidmousexp.patch
It adds a new emulated USB device that reports absolute coordinates. It also modifies SDL to operate in grabless mode when an absolute input device is enabled. I think it's pretty close to apply-able. To use, just specify: -usbdevice tablet
With Xorg from CVS, the evdev driver segfaults. This is apparently expected behavior. Hopefully it will be fixed soon. It works quite nicely under Win2k.
Regards,
Anthony Liguori
Quoted 79 lines · Brad Campbell
Quoted 3 lines · Anthony Liguori
Final one of the night. This patch disables relative mouse reporting and disables grab automatically the first time SDL detects that the absolute mouse was enabled. Needs a lot of cleanup but I'm very happy with the user experience on this one.
Wish I'd just gone to bed now..
Heres a patch against your last one to implement wheel support.Brad
------------------------------------------------------------------------diff -ur
qemu-clean/hw/usb-hid.cqemu/hw/usb-hid.chw/usb-hid.c +16
-11@@ -101,7 +101,7 @@0x00 ,/* u8 country_code */ 0x01 ,/* u8 num_descriptors */ 0x22 ,/* u8 type; Report */ -53 ,0 ,/* u16 len */ +65 ,0 ,/* u16 len */ /* one endpoint (status change endpoint) */ 0x07, /* u8 ep_bLength; */@@ -145,14 +145,15 @@0x09 ,0x31 ,/* Usage Y */ 0x15 ,0x00 ,/* Logical Minimum 0 */ 0x27 ,0xFF ,0xFF ,0x00 ,0x00 ,/* Logical Maximum 0xffff */ -0x75 ,0x10 ,/* Report Size 32 */ +0x75 ,0x10 ,/* Report Size 16 */ 0x95 ,0x02 ,/* Report Count 2 */ 0x81 ,0x02 ,/* Input (Data, Var, Abs) */ -// 0x09, 0x32, /* Usage Z */ -// 0x15, 0x81, /* Logical Minimum -127 */ -// 0x25, 0x7F, /* Logical Maximum 127 */ -// 0x75, 0x08, /* Report Size 8 */ -// 0x95, 0x01, /* Report Count 1 */ +0x09 ,0x38 ,/* Usage Wheel */ +0x15 ,0x81 ,/* Logical Minimum -127 */ +0x25 ,0x7F ,/* Logical Maximum 127 */ +0x75 ,0x08 ,/* Report Size 8 */ +0x95 ,0x01 ,/* Report Count 1 */ +0x81 ,0x02 ,/* Input (Data, Var, Rel) */ 0xC0 ,/* End Collection */ 0xC0, /* End Collection */ };@@ -224,14 +225,18 @@qemu_add_mouse_event_handler (NULL ,NULL ); absolute_mouse =1 ; } - +/* dx = int_clamp(s->dx, -128, 127); dy = int_clamp(s->dy, -128, 127); - dz =int_clamp (s->dz,-128 ,127 );s->dx -= dx; s->dy -= dy; +*/ + + dz =int_clamp (s->dz,-128 ,127 ); s->dz -= dz; +/* Appears we have to invert the wheel direction */ + dz =0 - dz; b =0 ;if (s->buttons_state &MOUSE_EVENT_LBUTTON ) b |=0x01 ;@@ -245,7 +250,8 @@ buf[2 ] = s->X >>8 ; buf[3 ] = s->Y &0xff ; buf[4 ] = s->Y >>8 ; - l =5 ; + buf[5 ] = dz; + l =6 ;return l; } ------------------------------------------------------------------------
Quoted 5 lines
_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
hw/ps2.c +1 -1
@@ -560,7 +560,7 @@ s->common.update_arg = update_arg;ps2_reset (&s->common);register_savevm ("ps2mouse" ,0 ,2 , ps2_mouse_save, ps2_mouse_load, s); -qemu_add_mouse_event_handler (ps2_mouse_event, s); +qemu_add_mouse_event_handler (ps2_mouse_event, s,0 );qemu_register_reset (ps2_reset, &s->common);return s; }
hw/usb-hid.c +209 -24
334 lines not on this page · raw message
hw/usb.h +1 -0
@@ -163,3 +163,4 @@/* usb-hid.c */ USBDevice *usb_mouse_init (void ); +USBDevice *usb_tablet_init (void );
sdl.c +42 -4
102 lines not on this page · raw message
vl.c +12 -1
@@ -474,6 +474,7 @@static void *qemu_put_kbd_event_opaque;static QEMUPutMouseEvent *qemu_put_mouse_event;static void *qemu_put_mouse_event_opaque; +static int qemu_put_mouse_event_absolute;void qemu_add_kbd_event_handler (QEMUPutKBDEvent *func,void *opaque) {
@@ -481,10 +482,11 @@ qemu_put_kbd_event = func; } -void qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque) +void qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque,int absolute) { qemu_put_mouse_event_opaque = opaque; qemu_put_mouse_event = func; + qemu_put_mouse_event_absolute = absolute; }void kbd_put_keycode (int keycode)
@@ -500,6 +502,11 @@qemu_put_mouse_event (qemu_put_mouse_event_opaque, dx, dy, dz, buttons_state); } +} + +int kbd_mouse_is_absolute (void ) +{ +return qemu_put_mouse_event_absolute; }/***********************************************************/
@@ -2855,6 +2862,10 @@ dev =usb_mouse_init ();if (!dev)return -1 ; + }else if (!strcmp (devname,"tablet" )) { + dev =usb_tablet_init (); +if (!dev) +return -1 ; }else {return -1 ; }
vl.h +2 -1
@@ -158,10 +158,11 @@typedef void QEMUPutMouseEvent (void *opaque,int dx,int dy,int dz,int buttons_state);void qemu_add_kbd_event_handler (QEMUPutKBDEvent *func,void *opaque); -void qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque); +void qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque,int absolute);void kbd_put_keycode (int keycode);void kbd_mouse_event (int dx,int dy,int dz,int buttons_state); +int kbd_mouse_is_absolute (void );/* keysym is a unicode code except for special keys (see QEMU_KEY_xxx constants) */
Re: [Qemu-devel] USB Tablet Emulation
Quoted 5 lines · Anthony Liguori
I spent some time cleaning this all up. The following integrates Brad's patches and the patch from http://gnome.dnsalias.net/patches/qemu-hidmousexp.patch
It adds a new emulated USB device that reports absolute coordinates. It also modifies SDL to operate in grabless mode when an absolute input device is enabled. I think it's pretty close to apply-able. To use, just specify: -usbdevice tablet
With Xorg from CVS, the evdev driver segfaults. This is apparently expected behavior. Hopefully it will be fixed soon. It works quite nicely under Win2k.
Here is the vnc patch to go on top of that and the latest cvs.
Signature · 3 lines
"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
configure +40 -1
@@ -181,6 +181,8 @@ ;; --disable-sdl) sdl="no" ;; + --disable-vnc) vnc="no" + ;; --enable-coreaudio) coreaudio="yes" ;; --enable-alsa) alsa="yes"
@@ -240,6 +242,8 @@ echo " --interp-prefix=PREFIX where to find shared libraries, etc." echo " use %M for cpu name [$interp_prefix]" echo " --target-list=LIST set target list [$target_list]" +echo " --disable-vnc disable vnc support (else configure checks" +echo " for libvncserver-config in your PATH)" echo "" echo "kqemu kernel acceleration support:" echo " --disable-kqemu disable kqemu support"
@@ -363,6 +367,19 @@ fi ########################################## +# VNC probe + +if test -z "$vnc"; then + +if libvncserver-config --version > /dev/null; then + vnc=yes +else + vnc=no +fi + +fi + +########################################## # SDL probe sdl_too_old=no
@@ -448,6 +465,7 @@ echo "gprof enabled $gprof" echo "profiler $profiler" echo "static build $static" +echo "VNC support $vnc" if test "$darwin" = "yes" ; then echo "Cocoa support $cocoa" fi
@@ -561,6 +579,8 @@ if test "$darwin" = "yes" ; then echo "CONFIG_DARWIN=yes" >> $config_mak echo "#define CONFIG_DARWIN 1" >> $config_h + echo "#define socklen_t int" >> $config_h + echo "#define sqrtf sqrt" >> $config_h fi if test "$gdbstub" = "yes" ; then echo "CONFIG_GDBSTUB=yes" >> $config_mak
@@ -624,6 +644,16 @@ echo "#define _BSD 1" >> $config_h fi +if test "$vnc" = "yes"; then + echo "CONFIG_VNC=yes" >> $config_mak + echo "VNC_CFLAGS=`libvncserver-config --cflags`" >> $config_mak +fi + +if test "$sdl" = "yes"; then + echo "CONFIG_SDL=yes" >> $config_mak + echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak +fi + for target in $target_list; do target_dir="$target"
@@ -735,13 +765,22 @@ echo "#define CONFIG_USER_ONLY 1" >> $config_h fi +if test "$target_user_only" = "no"; then + if test "$vnc" = "yes"; then + echo "#define CONFIG_VNC 1" >> $config_h + echo "CONFIG_VNC=yes" >> $config_mak + echo "VNC_CFLAGS=`libvncserver-config --cflags`" >> $config_mak + echo "VNC_LIBS=`libvncserver-config --libs`" >> $config_mak + fi +fi + if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then echo "CONFIG_SOFTFLOAT=yes" >> $config_mak echo "#define CONFIG_SOFTFLOAT 1" >> $config_h fi # sdl defines -if test "$target_user_only" = "no"; then +if test "$sdl" = "yes" -a "$target_user_only" = "no"; then if test "$target_softmmu" = "no" -o "$static" = "yes"; then sdl1=$sdl_static else
hw/pckbd.c +5 -1
@@ -333,7 +333,11 @@static void kbd_save (QEMUFile * f,void * opaque) {KBDState *s = (KBDState *)opaque; - + +/* release alt, ctrl */ +kbd_put_keycode (0x38 |0x80 );/* alt */ +kbd_put_keycode (0x1d |0x80 );/* ctrl */ +qemu_put_8s (f, &s->write_cmd);qemu_put_8s (f, &s->status);qemu_put_8s (f, &s->mode);
keymaps.c +6 -0
@@ -93,6 +93,12 @@if (keysym <MAX_NORMAL_KEYCODE ) {//fprintf(stderr,"Setting keysym %s (%d) to %d\n",line,keysym,keycode); k->keysym2keycode[keysym] = keycode; +#ifdef KEYBOARD_HANDLE_UPPER_CASE + line[0 ]=toupper (line[0 ]); + keysym=get_keysym (line); +if (keysym) + k->keysym2keycode[keysym]=keycode; +#endif }else {if (k->extra_count >=MAX_EXTRA_COUNT ) { fprintf(stderr,
Makefile.target +10 -1
@@ -345,6 +345,9 @@ ifdef CONFIG_GDBSTUB VL_OBJS+=gdbstub.o endif +ifdef CONFIG_VNC +VL_OBJS+=vnc.o +endif ifdef CONFIG_SDL VL_OBJS+=sdl.o endif
@@ -390,7 +393,10 @@ endif $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a - $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS) + $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VNC_LIBS) $(VL_LIBS) + +vnc.o: vnc.c keymaps.c vnc_keysym.h + $(CC) $(CFLAGS) $(DEFINES) $(VNC_CFLAGS) $(SDL_CFLAGS) -c -o $@ $< cocoa.o: cocoa.m $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
@@ -401,6 +407,9 @@ sdlaudio.o: sdlaudio.c $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $< +vl.o: vl.c + $(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $< + depend: $(SRCS) $(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
monitor.c +3 -0
@@ -69,7 +69,10 @@void term_flush (void ) {if (term_outbuf_index >0 ) { +if (monitor_hd)qemu_chr_write (monitor_hd, term_outbuf, term_outbuf_index); +else +fwrite (term_outbuf, term_outbuf_index,1 , stderr); term_outbuf_index =0 ; } }
sdl.c +4 -0
@@ -44,6 +44,10 @@static SDL_Cursor *sdl_cursor_hidden;static int absolute_enabled =0 ; +SDL_PixelFormat *sdl_get_format () { +return screen->format; +} +static void sdl_update (DisplayState *ds,int x,int y,int w,int h) {// printf("updating x=%d y=%d w=%d h=%d\n", x, y, w, h);
slirp/main.h +2 -0
@@ -9,6 +9,8 @@#include <sys/select.h> #endif +#include <inttypes.h> +#define TOWRITEMAX 512extern struct timeval tt;
vl.c +46 -1
109 lines not on this page · raw message
vl.h +4 -0
@@ -684,6 +684,9 @@ unsigned long vga_ram_offset, int vga_ram_size, unsigned long vga_bios_offset, int vga_bios_size); +/* vnc.c */ +void vnc_display_init (DisplayState *ds,int useAlsoSDL); +/* cirrus_vga.c */ void pci_cirrus_vga_init (PCIBus *bus,DisplayState *ds,uint8_t *vga_ram_base,unsigned long vga_ram_offset,int vga_ram_size);
@@ -757,6 +760,7 @@/* pckbd.c */ void kbd_init (void ); +extern const char * keyboard_layout;/* mc146818rtc.c */
vnc.c +600 -0
600 lines not on this page · raw message
vnc_keysym.h +278 -0
278 lines not on this page · raw message
Re: [Qemu-devel] USB Tablet Emulation
Hi,
Quoted 10 lines · Brad Campbell
Quoted 9 lines · Anthony Liguori
I spent some time cleaning this all up. The following integrates Brad's patches and the patch from
http://gnome.dnsalias.net/patches/qemu-hidmousexp.patchIt adds a new emulated USB device that reports absolute coordinates. It also modifies SDL to operate in grabless mode when an absolute input device is enabled. I think it's pretty close to apply-able. To use, just specify:
-usbdevice tablet
Quoted 5 lines
Quoted 3 lines
With Xorg from CVS, the evdev driver segfaults. This is apparently expected behavior. Hopefully it will be fixed soon. It works quite nicely under Win2k.
Here is the vnc patch to go on top of that and the latest cvs.
Before anybody complains: vnc.c needs a major cleanup (what with all that magic mouse stuff), and there are more things in the patch, like releasing Ctrl+Alt just before savevm'ing.
I will do the cleanup this week if nobody else is faster...
Also note that I got a patch to implement "-vnclisten <localhost | any>" to possibly restrict access from anywhere but localhost.
Ciao,
Dscho
Re: [Qemu-devel] USB Tablet Emulation
Quoted 6 lines · Johannes Schindelin
Quoted 4 lines
Quoted 3 lines
With Xorg from CVS, the evdev driver segfaults. This is apparently expected behavior. Hopefully it will be fixed soon. It works quite nicely under Win2k.
Here is the vnc patch to go on top of that and the latest cvs.
Before anybody complains:
vnc.cneeds a major cleanup (what with all that magic mouse stuff), and there are more things in the patch, like releasing Ctrl+Alt just before savevm'ing.
Not complaining at all. I was looking at removing the magic mouse stuff but that would then remove functionality for clients that currently can't use the hid-abs support. So I left it there and patched it up to work.
My feeling is with the current functionality for mice, vnc is probably reaching the point where it could be merged.
Signature · 3 lines
"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
Re: [Qemu-devel] USB Tablet Emulation
Hi,
Quoted 3 lines · Brad Campbell
Not complaining at all. I was looking at removing the magic mouse stuff but that would then remove functionality for clients that currently can't use the hid-abs support. So I left it there and patched it up to work.
Good! I'll give it a try tonight.
Quoted 2 lines
My feeling is with the current functionality for mice, vnc is probably reaching the point where it could be merged.
I'd like Wacom to work with Win98 first... Something like Beos is much more likely to work if that stage is already reached.
Ciao,
Dscho
[Qemu-devel] USB Tablet Emulation + VNC patch..
In reply to Brad CampbellQuoted 10 lines · Brad Campbell
Quoted 9 lines · Anthony Liguori
I spent some time cleaning this all up. The following integrates Brad's patches and the patch from
http://gnome.dnsalias.net/patches/qemu-hidmousexp.patchIt adds a new emulated USB device that reports absolute coordinates. It also modifies SDL to operate in grabless mode when an absolute input device is enabled. I think it's pretty close to apply-able. To use, just specify: -usbdevice tablet
Quoted 5 lines
Quoted 3 lines
With Xorg from CVS, the evdev driver segfaults. This is apparently expected behavior. Hopefully it will be fixed soon. It works quite nicely under Win2k.
Here is the vnc patch to go on top of that and the latest cvs.
This works beautifully so far.. I applied the VNC patch to the latest qemu CVS (which has the usb tablet emulation already).
Now, does anyone have instructions on how to get Win2k installed and updated to the latest set of security patches? I can get service pack 4 installed, but running windowsupdate seems to never work right.
Re: [Qemu-devel] USB Tablet Emulation + VNC patch..
Quoted 7 lines · Troy Benjegerdes
Quoted 6 lines · Brad Campbell
Quoted 5 lines · Anthony Liguori
I spent some time cleaning this all up. The following integrates Brad's patches and the patch from http://gnome.dnsalias.net/patches/qemu-hidmousexp.patch
It adds a new emulated USB device that reports absolute coordinates. It also modifies SDL to operate in grabless mode when an absolute input device is enabled. I think it's pretty close to apply-able. To use, just specify: -usbdevice tablet
With Xorg from CVS, the evdev driver segfaults. This is apparently expected behavior. Hopefully it will be fixed soon. It works quite nicely under Win2k.
Quoted 8 lines
Quoted 1 line
Here is the vnc patch to go on top of that and the latest cvs.
This works beautifully so far.. I applied the VNC patch to the latest qemu CVS (which has the usb tablet emulation already).
Now, does anyone have instructions on how to get Win2k installed and updated to the latest set of security patches? I can get service pack 4 installed, but running windowsupdate seems to never work right.
If I run it up with -win2k-hack then windowsupdate works fine.. Here is what I did though (although variants have worked)
Install win2k-sp4
run windowsupdate and ignore the warning about ie6, let it install the updated windows-update component. Reboot, install ie6, reboot, then run windows-update and install all the patches.
All of this with win2k-hack enabled or it won't work.. and the updated win2k-hack from Leo so it works with dma..
Signature · 3 lines
"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
Re: [Qemu-devel] USB Tablet Emulation + VNC patch..
Quoted 7 lines
Quoted 3 lines
Now, does anyone have instructions on how to get Win2k installed and updated to the latest set of security patches? I can get service pack 4 installed, but running windowsupdate seems to never work right.
If I run it up with -win2k-hack then windowsupdate works fine.. Here is what I did though (although variants have worked)
Quoted 7 lines
Install win2k-sp4
run windowsupdate and ignore the warning about ie6, let it install the updated windows-update component. Reboot, install ie6, reboot, then run windows-update and install all the patches.All of this with win2k-hack enabled or it won't work.. and the updated win2k-hack from Leo so it works with dma..
I'm still stuck with windowsupdate not working..
I am finding now that after I go through installing win2k, and running ie5, I can see it has 56 bit encryption. But after installing service pack 3 and service pack 4, IE says '0-bit encryption'.
I think this means there is a DLL or something corrupted somewhere, but I have no idea how to find out where. I am wondering if delaying the interrupt every time instead of every 16th time really is needed..
Is there any good way to detect the behavior that needs to have the delay in qemu and print out a warning on the console?
I have also found that haveing '-usbdevice tablet' enabled during the install sometimes results in the mouse stopping working halfway through the install, although it's never consistent when it stops.
Re: [Qemu-devel] USB Tablet Emulation + VNC patch..
Quoted 9 lines · Troy Benjegerdes
Quoted 9 lines
Quoted 3 lines
Now, does anyone have instructions on how to get Win2k installed and updated to the latest set of security patches? I can get service pack 4 installed, but running windowsupdate seems to never work right.
If I run it up with -win2k-hack then windowsupdate works fine.. Here is what I did though (although variants have worked)
Install win2k-sp4
run windowsupdate and ignore the warning about ie6, let it install the updated windows-update component. Reboot, install ie6, reboot, then run windows-update and install all the patches.
Quoted 7 lines
Quoted 1 line
All of this with win2k-hack enabled or it won't work.. and the updated win2k-hack from Leo so it works with dma..
I'm still stuck with windowsupdate not working..
I am finding now that after I go through installing win2k, and running ie5, I can see it has 56 bit encryption. But after installing service pack 3 and service pack 4, IE says '0-bit encryption'.
Better to download SP4 complete.. don't use windows update to install the service packs, just install and load SP4 without interracting with the net at all.. sp3 does strange things..
Signature · 3 lines
"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
Re: [Qemu-devel] USB Tablet Emulation
In reply to Anthony LiguoriAnthony,
your patch works perfectly, even with Windows XP as well. The transition from the boot-time PS/2 mouse is perfect, and the way the cursor grab logic is handled is seamless. I haven't been able to test the scroll wheel because I have some hardware restrictions today (laptop only for a while)... does that still work as well?
I also tested it as a normal X11 application on top of an Xvnc server, and that works great, even with -full-screen set.
Thank you,
Leo Reiter
Quoted 659 lines · Anthony Liguori
I spent some time cleaning this all up. The following integrates Brad's patches and the patch from http://gnome.dnsalias.net/patches/qemu-hidmousexp.patch
It adds a new emulated USB device that reports absolute coordinates. It also modifies SDL to operate in grabless mode when an absolute input device is enabled. I think it's pretty close to apply-able. To use, just specify: -usbdevice tablet
With Xorg from CVS, the evdev driver segfaults. This is apparently expected behavior. Hopefully it will be fixed soon. It works quite nicely under Win2k.
Regards,
Anthony Liguori
Quoted 80 lines · Brad Campbell
Quoted 3 lines · Anthony Liguori
Final one of the night. This patch disables relative mouse reporting and disables grab automatically the first time SDL detects that the absolute mouse was enabled. Needs a lot of cleanup but I'm very happy with the user experience on this one.
Wish I'd just gone to bed now..
Heres a patch against your last one to implement wheel support.Brad
------------------------------------------------------------------------diff -ur
qemu-clean/hw/usb-hid.cqemu/hw/usb-hid.chw/usb-hid.c 2006-04-10 03:11:58.000000000 +0400 renamed from hw/usb-hid.c 2006-04-10 02:57:46.000000000 +0400 +16
-11@@ -101,7 +101,7 @@ 0x00, /* u8 country_code */ 0x01, /* u8 num_descriptors */ 0x22, /* u8 type; Report */ - 53, 0, /* u16 len */ + 65, 0, /* u16 len */ /* one endpoint (status change endpoint) */ 0x07, /* u8 ep_bLength; */@@ -145,14 +145,15 @@ 0x09, 0x31, /* Usage Y */ 0x15, 0x00, /* Logical Minimum 0 */ 0x27, 0xFF, 0xFF, 0x00, 0x00, /* Logical Maximum 0xffff */ - 0x75, 0x10, /* Report Size 32 */ + 0x75, 0x10, /* Report Size 16 */ 0x95, 0x02, /* Report Count 2 */ 0x81, 0x02, /* Input (Data, Var, Abs) */ -// 0x09, 0x32, /* Usage Z */ -// 0x15, 0x81, /* Logical Minimum -127 */ -// 0x25, 0x7F, /* Logical Maximum 127 */ -// 0x75, 0x08, /* Report Size 8 */ -// 0x95, 0x01, /* Report Count 1 */ + 0x09, 0x38, /* Usage Wheel */ + 0x15, 0x81, /* Logical Minimum -127 */ + 0x25, 0x7F, /* Logical Maximum 127 */ + 0x75, 0x08, /* Report Size 8 */ + 0x95, 0x01, /* Report Count 1 */ + 0x81, 0x02, /* Input (Data, Var, Rel) */ 0xC0, /* End Collection */ 0xC0, /* End Collection */ };@@ -224,14 +225,18 @@ qemu_add_mouse_event_handler(NULL, NULL); absolute_mouse = 1; } - +/* dx = int_clamp(s->dx, -128, 127); dy = int_clamp(s->dy, -128, 127); - dz = int_clamp(s->dz, -128, 127); s->dx -= dx; s->dy -= dy; +*/ + + dz = int_clamp(s->dz, -128, 127); s->dz -= dz; +/* Appears we have to invert the wheel direction */ + dz = 0 - dz; b = 0; if (s->buttons_state & MOUSE_EVENT_LBUTTON) b |= 0x01;@@ -245,7 +250,8 @@ buf[2] = s->X >> 8; buf[3] = s->Y & 0xff; buf[4] = s->Y >> 8; - l = 5; + buf[5] = dz; + l = 6; return l; } ------------------------------------------------------------------------Quoted 5 lines
_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel------------------------------------------------------------------------
diff -r
6a786a97b822hw/ps2.chw/ps2.c +1
-1@@ -560,7 +560,7 @@ s->common.update_arg = update_arg;ps2_reset (&s->common);register_savevm ("ps2mouse" ,0 ,2 , ps2_mouse_save, ps2_mouse_load, s); -qemu_add_mouse_event_handler (ps2_mouse_event, s); +qemu_add_mouse_event_handler (ps2_mouse_event, s,0 );qemu_register_reset (ps2_reset, &s->common);return s; }diff -r
6a786a97b822hw/usb-hid.chw/usb-hid.c +209
-24@@ -30,9 +30,15 @@#define SET_IDLE 0x210a#define SET_PROTOCOL 0x210b +#define USB_MOUSE 1 +#define USB_TABLET 2 +typedef struct USBMouseState {USBDevice dev;int dx, dy, dz, buttons_state; +int x, y; +int kind; +int mouse_grabbed; }USBMouseState ;/* mostly the same values as the Bochs USB Mouse device */ @@ -93,14 +99,6 @@0x02 ,/* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ 0x05 ,/* u8 if_iInterface; */ -/* one endpoint (status change endpoint) */ -0x07 ,/* u8 ep_bLength; */ -0x05 ,/* u8 ep_bDescriptorType; Endpoint */ -0x81 ,/* u8 ep_bEndpointAddress; IN Endpoint 1 */ -0x03 ,/* u8 ep_bmAttributes; Interrupt */ -0x03 ,0x00 ,/* u16 ep_wMaxPacketSize; */ -0x0a ,/* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ -/* HID descriptor */ 0x09 ,/* u8 bLength; */ 0x21, /* u8 bDescriptorType; */@@ -109,6 +107,69 @@0x01 ,/* u8 num_descriptors */ 0x22 ,/* u8 type; Report */ 50 ,0 ,/* u16 len */ + +/* one endpoint (status change endpoint) */ +0x07 ,/* u8 ep_bLength; */ +0x05 ,/* u8 ep_bDescriptorType; Endpoint */ +0x81 ,/* u8 ep_bEndpointAddress; IN Endpoint 1 */ +0x03 ,/* u8 ep_bmAttributes; Interrupt */ +0x03 ,0x00 ,/* u16 ep_wMaxPacketSize; */ + 0x0a, /* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ +}; + +static const uint8_t qemu_tablet_config_descriptor[] = { +/* one configuration */ +0x09 ,/* u8 bLength; */ +0x02 ,/* u8 bDescriptorType; Configuration */ +0x22 ,0x00 ,/* u16 wTotalLength; */ +0x01 ,/* u8 bNumInterfaces; (1) */ +0x01 ,/* u8 bConfigurationValue; */ +0x04 ,/* u8 iConfiguration; */ +0xa0 ,/* u8 bmAttributes; +Bit 7: must be set, +6: Self-powered, +5: Remote wakeup, +4..0: resvd */ +50 ,/* u8 MaxPower; */ + +/* USB 1.1: +* USB 2.0, single TT organization (mandatory): +* one interface, protocol 0 +* +* USB 2.0, multiple TT organization (optional): +* two interfaces, protocols 1 (like single TT) +* and 2 (multiple TT mode) ... config is +* sometimes settable +* NOT IMPLEMENTED +*/ + +/* one interface */ +0x09 ,/* u8 if_bLength; */ +0x04 ,/* u8 if_bDescriptorType; Interface */ +0x00 ,/* u8 if_bInterfaceNumber; */ +0x00 ,/* u8 if_bAlternateSetting; */ +0x01 ,/* u8 if_bNumEndpoints; */ +0x03 ,/* u8 if_bInterfaceClass; */ +0x01 ,/* u8 if_bInterfaceSubClass; */ +0x02 ,/* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ +0x05 ,/* u8 if_iInterface; */ + +/* HID descriptor */ +0x09 ,/* u8 bLength; */ +0x21 ,/* u8 bDescriptorType; */ +0x01 ,0x00 ,/* u16 HID_class */ +0x00 ,/* u8 country_code */ +0x01 ,/* u8 num_descriptors */ +0x22 ,/* u8 type; Report */ +65 ,0 ,/* u16 len */ + +/* one endpoint (status change endpoint) */ +0x07 ,/* u8 ep_bLength; */ +0x05 ,/* u8 ep_bDescriptorType; Endpoint */ +0x81 ,/* u8 ep_bEndpointAddress; IN Endpoint 1 */ +0x03 ,/* u8 ep_bmAttributes; Interrupt */ +0x08 ,0x00 ,/* u16 ep_wMaxPacketSize; */ +0x03 ,/* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ }; static const uint8_t qemu_mouse_hid_report_descriptor[] = {@@ -121,6 +182,41 @@ 0xC0, 0xC0, }; +static const uint8_t qemu_tablet_hid_report_descriptor[] = { +0x05 ,0x01 ,/* Usage Page Generic Desktop */ +0x09 ,0x01 ,/* 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 ,0x10 ,/* Report Size 16 */ +0x95 ,0x02 ,/* Report Count 2 */ +0x81 ,0x02 ,/* Input (Data, Var, Abs) */ +0x09 ,0x38 ,/* Usage Wheel */ +0x15 ,0x81 ,/* Logical Minimum -127 */ +0x25 ,0x7F ,/* Logical Maximum 127 */ +0x75 ,0x08 ,/* Report Size 8 */ +0x95 ,0x01 ,/* Report Count 1 */ +0x81 ,0x02 ,/* Input (Data, Var, Rel) */ +0xC0 ,/* End Collection */ +0xC0 ,/* End Collection */ +}; +static void usb_mouse_event (void *opaque,int dx1,int dy1,int dz1,int buttons_state) {@@ -129,6 +225,17 @@ s->dx += dx1; s->dy += dy1; s->dz += dz1; + s->buttons_state = buttons_state; +} + +static void usb_tablet_event (void *opaque, +int x,int y,int dz,int buttons_state) +{ +USBMouseState *s = opaque; + + s->x = x; + s->y = y; + s->dz += dz; s->buttons_state = buttons_state; }@@ -146,6 +253,11 @@ {int dx, dy, dz, b, l; +if (!s->mouse_grabbed) { +qemu_add_mouse_event_handler (usb_mouse_event, s,0 ); + s->mouse_grabbed =1 ; + } + dx =int_clamp (s->dx,-128 ,127 ); dy =int_clamp (s->dy,-128 ,127 ); dz =int_clamp (s->dz,-128 ,127 );@@ -173,6 +285,39 @@return l; } +static int usb_tablet_poll (USBMouseState *s,uint8_t *buf,int len) +{ +int dz, b, l; + +if (!s->mouse_grabbed) { +qemu_add_mouse_event_handler (usb_tablet_event, s,1 ); + s->mouse_grabbed =1 ; + } + + dz =int_clamp (s->dz,-128 ,127 ); + s->dz -= dz; + +/* Appears we have to invert the wheel direction */ + dz =0 - dz; + b =0 ; +if (s->buttons_state &MOUSE_EVENT_LBUTTON ) + b |=0x01 ; +if (s->buttons_state &MOUSE_EVENT_RBUTTON ) + b |=0x02 ; +if (s->buttons_state &MOUSE_EVENT_MBUTTON ) + b |=0x04 ; + + buf[0 ] = b; + buf[1 ] = s->x &0xff ; + buf[2 ] = s->x >>8 ; + buf[3 ] = s->y &0xff ; + buf[4 ] = s->y >>8 ; + buf[5 ] = dz; + l =6 ; + +return l; +} +static void usb_mouse_handle_reset (USBDevice *dev) {USBMouseState *s = (USBMouseState *)dev;@@ -180,6 +325,8 @@ s->dx =0 ; s->dy =0 ; s->dz =0 ; + s->x =0 ; + s->y =0 ; s->buttons_state =0 ; }@@ -187,7 +334,7 @@ int index, int length, uint8_t *data) { USBMouseState *s = (USBMouseState *)dev; -int ret; +int ret =0 ;switch (request) {case DeviceRequest |USB_REQ_GET_STATUS :@@ -224,9 +371,15 @@ ret =sizeof (qemu_mouse_dev_descriptor);break ;case USB_DT_CONFIG : -memcpy (data, qemu_mouse_config_descriptor, -sizeof (qemu_mouse_config_descriptor)); - ret =sizeof (qemu_mouse_config_descriptor); +if (s->kind ==USB_MOUSE ) { +memcpy (data, qemu_mouse_config_descriptor, +sizeof (qemu_mouse_config_descriptor)); + ret =sizeof (qemu_mouse_config_descriptor); + }else if (s->kind ==USB_TABLET ) { +memcpy (data, qemu_tablet_config_descriptor, +sizeof (qemu_tablet_config_descriptor)); + ret =sizeof (qemu_tablet_config_descriptor); + }break ;case USB_DT_STRING :switch (value &0xff ) {@@ -244,7 +397,10 @@break ;case 2 :/* product description */ - ret =set_usb_string (data,"QEMU USB Mouse" ); +if (s->kind ==USB_MOUSE ) + ret =set_usb_string (data,"QEMU USB Mouse" ); +else if (s->kind ==USB_TABLET ) + ret =set_usb_string (data,"QEMU USB Tablet" );break ;case 3 :/* vendor description */ @@ -282,16 +438,25 @@case InterfaceRequest |USB_REQ_GET_DESCRIPTOR :switch (value >>8 ) {case 0x22 : -memcpy (data, qemu_mouse_hid_report_descriptor, -sizeof (qemu_mouse_hid_report_descriptor)); - ret =sizeof (qemu_mouse_hid_report_descriptor); -break ; +if (s->kind ==USB_MOUSE ) { +memcpy (data, qemu_mouse_hid_report_descriptor, +sizeof (qemu_mouse_hid_report_descriptor)); + ret =sizeof (qemu_mouse_hid_report_descriptor); + }else if (s->kind ==USB_TABLET ) { +memcpy (data, qemu_tablet_hid_report_descriptor, +sizeof (qemu_tablet_hid_report_descriptor)); + ret =sizeof (qemu_tablet_hid_report_descriptor); + } +break ;default : goto fail; }break ;case GET_REPORT : - ret =usb_mouse_poll (s, data, length); +if (s->kind ==USB_MOUSE ) + ret =usb_mouse_poll (s, data, length); +else if (s->kind ==USB_TABLET ) + ret =usb_tablet_poll (s, data, length);break ;case SET_IDLE : ret =0 ;@@ -308,12 +473,15 @@ uint8_t devep, uint8_t *data, int len) { USBMouseState *s = (USBMouseState *)dev; -int ret; +int ret =0 ;switch (pid) {case USB_TOKEN_IN :if (devep ==1 ) { - ret =usb_mouse_poll (s, data, len); +if (s->kind ==USB_MOUSE ) + ret =usb_mouse_poll (s, data, len); +else if (s->kind ==USB_TABLET ) + ret =usb_tablet_poll (s, data, len); }else { goto fail; }@@ -327,7 +495,7 @@return ret; } -USBDevice *usb_mouse_init (void ) +USBDevice *usb_tablet_init (void ) {USBMouseState *s;@@ -340,8 +508,25 @@ s->dev.handle_reset = usb_mouse_handle_reset; s->dev.handle_control = usb_mouse_handle_control; s->dev.handle_data = usb_mouse_handle_data; - -qemu_add_mouse_event_handler (usb_mouse_event, s); - + s->kind =USB_TABLET ; +return (USBDevice *)s; } + +USBDevice *usb_mouse_init (void ) +{ +USBMouseState *s; + + s =qemu_mallocz (sizeof (USBMouseState)); +if (!s) +return NULL ; + s->dev.speed =USB_SPEED_FULL ; + s->dev.handle_packet = usb_generic_handle_packet; + + s->dev.handle_reset = usb_mouse_handle_reset; + s->dev.handle_control = usb_mouse_handle_control; + s->dev.handle_data = usb_mouse_handle_data; + s->kind =USB_MOUSE ; + +return (USBDevice *)s; +}diff -r
6a786a97b822hw/usb.hhw/usb.h +1
-0@@ -163,3 +163,4 @@/* usb-hid.c */ USBDevice *usb_mouse_init (void ); +USBDevice *usb_tablet_init (void );diff -r
6a786a97b822sdl.csdl.c +42
-4@@ -39,6 +39,10 @@static int gui_fullscreen_initial_grab;static int gui_grab_code =KMOD_LALT |KMOD_LCTRL ;static uint8_t modifiers_state[256 ]; +static int width, height; +static SDL_Cursor *sdl_cursor_normal; +static SDL_Cursor *sdl_cursor_hidden; +static int absolute_enabled =0 ;static void sdl_update (DisplayState *ds,int x,int y,int w,int h) {@@ -55,6 +59,9 @@ flags =SDL_HWSURFACE |SDL_ASYNCBLIT |SDL_HWACCEL ;if (gui_fullscreen) flags |=SDL_FULLSCREEN ; + + width = w; + height = h; again: screen =SDL_SetVideoMode (w, h,0 , flags);@@ -271,9 +278,21 @@SDL_WM_SetCaption (buf,"QEMU" ); } +static void sdl_hide_cursor (void ) +{ +SDL_SetCursor (sdl_cursor_hidden); +} + +static void sdl_show_cursor (void ) +{ +if (!kbd_mouse_is_absolute ()) { +SDL_SetCursor (sdl_cursor_normal); + } +} +static void sdl_grab_start (void ) { -SDL_ShowCursor (0 ); +sdl_hide_cursor ();SDL_WM_GrabInput (SDL_GRAB_ON );/* dummy read to avoid moving the mouse */ SDL_GetRelativeMouseState (NULL ,NULL );@@ -284,7 +303,7 @@static void sdl_grab_end (void ) {SDL_WM_GrabInput (SDL_GRAB_OFF ); -SDL_ShowCursor (1 ); +sdl_show_cursor (); gui_grab =0 ;sdl_update_caption (); }@@ -300,6 +319,21 @@ buttons |=MOUSE_EVENT_RBUTTON ;if (state &SDL_BUTTON (SDL_BUTTON_MIDDLE )) buttons |=MOUSE_EVENT_MBUTTON ; + +if (kbd_mouse_is_absolute ()) { +if (!absolute_enabled) { +sdl_hide_cursor (); +if (gui_grab) { +sdl_grab_end (); + } + absolute_enabled =1 ; + } + +SDL_GetMouseState (&dx, &dy); + dx = dx *0x7FFF / width; + dy = dy *0x7FFF / height; + } +kbd_mouse_event (dx, dy, dz, buttons); }@@ -423,7 +457,7 @@qemu_system_shutdown_request ();break ;case SDL_MOUSEMOTION : -if (gui_grab) { +if (gui_grab ||kbd_mouse_is_absolute ()) {sdl_send_mouse_event (0 ); }break ;@@ -431,7 +465,7 @@case SDL_MOUSEBUTTONUP : {SDL_MouseButtonEvent *bev = &ev->button; -if (!gui_grab) { +if (!gui_grab && !kbd_mouse_is_absolute ()) {if (ev->type ==SDL_MOUSEBUTTONDOWN && (bev->state &SDL_BUTTON_LMASK )) {/* start grabbing all events */ @@ -471,6 +505,7 @@void sdl_display_init (DisplayState *ds,int full_screen) {int flags; +uint8_t data =0 ;#if defined(__APPLE__)/* always use generic keymaps */ @@ -504,6 +539,9 @@SDL_EnableUNICODE (1 ); gui_grab =0 ; + sdl_cursor_hidden =SDL_CreateCursor (&data, &data,8 ,1 ,0 ,0 ); + sdl_cursor_normal =SDL_GetCursor (); +atexit (sdl_cleanup);if (full_screen) { gui_fullscreen =1 ;diff -r
6a786a97b822vl.cvl.c +12
-1@@ -474,6 +474,7 @@static void *qemu_put_kbd_event_opaque;static QEMUPutMouseEvent *qemu_put_mouse_event;static void *qemu_put_mouse_event_opaque; +static int qemu_put_mouse_event_absolute;void qemu_add_kbd_event_handler (QEMUPutKBDEvent *func,void *opaque) {@@ -481,10 +482,11 @@ qemu_put_kbd_event = func; } -void qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque) +void qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque,int absolute) { qemu_put_mouse_event_opaque = opaque; qemu_put_mouse_event = func; + qemu_put_mouse_event_absolute = absolute; }void kbd_put_keycode (int keycode)@@ -500,6 +502,11 @@qemu_put_mouse_event (qemu_put_mouse_event_opaque, dx, dy, dz, buttons_state); } +} + +int kbd_mouse_is_absolute (void ) +{ +return qemu_put_mouse_event_absolute; }/***********************************************************/ @@ -2855,6 +2862,10 @@ dev =usb_mouse_init ();if (!dev)return -1 ; + }else if (!strcmp (devname,"tablet" )) { + dev =usb_tablet_init (); +if (!dev) +return -1 ; }else {return -1 ; }diff -r
6a786a97b822vl.hvl.h +2
-2@@ -158,10 +158,11 @@typedef void QEMUPutMouseEvent (void *opaque,int dx,int dy,int dz,int buttons_state);void qemu_add_kbd_event_handler (QEMUPutKBDEvent *func,void *opaque); -void qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque); +void qemu_add_mouse_event_handler (QEMUPutMouseEvent *func,void *opaque,int absolute);void kbd_put_keycode (int keycode);void kbd_mouse_event (int dx,int dy,int dz,int buttons_state); +int kbd_mouse_is_absolute (void );/* keysym is a unicode code except for special keys (see QEMU_KEY_xxx constants) */ ------------------------------------------------------------------------_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Signature · 8 lines
Leonardo E. Reiter Vice President of Product Development, CTO Win4Lin, Inc. Virtual Computing from Desktop to Data Center Main: +1 512 339 7979 Fax: +1 512 532 6501 http://www.win4lin.com
Re: [Qemu-devel] USB Tablet Emulation
Quoted 3 lines · Leonardo E. Reiter
Anthony,
your patch works perfectly, even with Windows XP as well.
Make sure to give credit where credit's due. Brad Campbell figured out the hard stuff :-)
Quoted 2 lines
The transition from the boot-time PS/2 mouse is perfect, and the way
the cursor grab logic is handled is seamless. I haven't been able to test the scroll wheel because I have some hardware restrictions today (laptop only for a while)... does that still work as well?
I haven't tried it but Brad has. Perhaps he can comment here.
Regards,
Anthony Liguori
Quoted 671 lines
I also tested it as a normal X11 application on top of an Xvnc server, and that works great, even with -full-screen set.
Thank you,
Leo Reiter
Quoted 663 lines · Anthony Liguori
I spent some time cleaning this all up. The following integrates Brad's patches and the patch from http://gnome.dnsalias.net/patches/qemu-hidmousexp.patch
It adds a new emulated USB device that reports absolute coordinates. It also modifies SDL to operate in grabless mode when an absolute input device is enabled. I think it's pretty close to apply-able. To use, just specify: -usbdevice tablet
With Xorg from CVS, the evdev driver segfaults. This is apparently expected behavior. Hopefully it will be fixed soon. It works quite nicely under Win2k.
Regards,
Anthony Liguori
Quoted 82 lines · Brad Campbell
Quoted 3 lines · Anthony Liguori
Final one of the night. This patch disables relative mouse reporting and disables grab automatically the first time SDL detects that the absolute mouse was enabled. Needs a lot of cleanup but I'm very happy with the user experience on this one.
Wish I'd just gone to bed now..
Heres a patch against your last one to implement wheel support.Brad
------------------------------------------------------------------------diff -ur
qemu-clean/hw/usb-hid.cqemu/hw/usb-hid.chw/usb-hid.c 2006-04-10 03:11:58.000000000 +0400 renamed from hw/usb-hid.c 2006-04-10 02:57:46.000000000 +0400 +16
-11@@ -101,7 +101,7 @@ 0x00, /* u8 country_code */ 0x01, /* u8 num_descriptors */ 0x22, /* u8 type; Report */ - 53, 0, /* u16 len */ + 65, 0, /* u16 len */ /* one endpoint (status change endpoint) */ 0x07, /* u8 ep_bLength; */@@ -145,14 +145,15 @@ 0x09, 0x31, /* Usage Y */ 0x15, 0x00, /* Logical Minimum 0 */ 0x27, 0xFF, 0xFF, 0x00, 0x00, /* Logical Maximum 0xffff */ - 0x75, 0x10, /* Report Size 32 */ + 0x75, 0x10, /* Report Size 16 */ 0x95, 0x02, /* Report Count 2 */ 0x81, 0x02, /* Input (Data, Var, Abs) */ -// 0x09, 0x32, /* Usage Z */ -// 0x15, 0x81, /* Logical Minimum -127 */ -// 0x25, 0x7F, /* Logical Maximum 127 */ -// 0x75, 0x08, /* Report Size 8 */ -// 0x95, 0x01, /* Report Count 1 */ + 0x09, 0x38, /* Usage Wheel */ + 0x15, 0x81, /* Logical Minimum -127 */ + 0x25, 0x7F, /* Logical Maximum 127 */ + 0x75, 0x08, /* Report Size 8 */ + 0x95, 0x01, /* Report Count 1 */ + 0x81, 0x02, /* Input (Data, Var, Rel) */ 0xC0, /* End Collection */ 0xC0, /* End Collection */ };@@ -224,14 +225,18 @@ qemu_add_mouse_event_handler(NULL, NULL); absolute_mouse = 1; } - +/* dx = int_clamp(s->dx, -128, 127); dy = int_clamp(s->dy, -128, 127); - dz = int_clamp(s->dz, -128, 127); s->dx -= dx; s->dy -= dy; +*/ + + dz = int_clamp(s->dz, -128, 127); s->dz -= dz; +/* Appears we have to invert the wheel direction */ + dz = 0 - dz; b = 0; if (s->buttons_state & MOUSE_EVENT_LBUTTON) b |= 0x01;@@ -245,7 +250,8 @@ buf[2] = s->X >> 8; buf[3] = s->Y & 0xff; buf[4] = s->Y >> 8; - l = 5; + buf[5] = dz; + l = 6; return l; } ------------------------------------------------------------------------Quoted 5 lines
_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel------------------------------------------------------------------------
diff -r
6a786a97b822hw/ps2.chw/ps2.c Sun Apr 9 22:34:20 2006 -0500 renamed from hw/ps2.c Mon Apr 10 01:47:35 2006 +0000 +1
-1@@ -560,7 +560,7 @@ s->common.update_arg = update_arg; ps2_reset(&s->common); register_savevm("ps2mouse", 0, 2, ps2_mouse_save, ps2_mouse_load, s); - qemu_add_mouse_event_handler(ps2_mouse_event, s); + qemu_add_mouse_event_handler(ps2_mouse_event, s, 0); qemu_register_reset(ps2_reset, &s->common); return s;}
diff -r6a786a97b822hw/usb-hid.chw/usb-hid.c Sun Apr 9 22:34:20 2006 -0500 renamed from hw/usb-hid.c Mon Apr 10 01:47:35 2006 +0000 +102
-7@@ -30,9 +30,15 @@ #define SET_IDLE 0x210a #define SET_PROTOCOL 0x210b +#define USB_MOUSE 1 +#define USB_TABLET 2 + typedef struct USBMouseState { USBDevice dev; int dx, dy, dz, buttons_state; + int x, y; + int kind; + int mouse_grabbed; } USBMouseState; /* mostly the same values as the Bochs USB Mouse device */@@ -93,14 +99,6 @@ 0x02, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ 0x05, /* u8 if_iInterface; */ - /* one endpoint (status change endpoint) */ - 0x07, /* u8 ep_bLength; */ - 0x05, /* u8 ep_bDescriptorType; Endpoint */ - 0x81, /* u8 ep_bEndpointAddress; IN Endpoint 1 */ - 0x03, /* u8 ep_bmAttributes; Interrupt */ - 0x03, 0x00, /* u16 ep_wMaxPacketSize; */ - 0x0a, /* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ - /* HID descriptor */ 0x09, /* u8 bLength; */ 0x21, /* u8 bDescriptorType; */@@ -109,6 +107,69 @@ 0x01, /* u8 num_descriptors */ 0x22, /* u8 type; Report */ 50, 0, /* u16 len */ + + /* one endpoint (status change endpoint) */ + 0x07, /* u8 ep_bLength; */ + 0x05, /* u8 ep_bDescriptorType; Endpoint */ + 0x81, /* u8 ep_bEndpointAddress; IN Endpoint 1 */ + 0x03, /* u8 ep_bmAttributes; Interrupt */ + 0x03, 0x00, /* u16 ep_wMaxPacketSize; */ + 0x0a, /* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ +}; + +static const uint8_t qemu_tablet_config_descriptor[] = { + /* one configuration */ + 0x09, /* u8 bLength; */ + 0x02, /* u8 bDescriptorType; Configuration */ + 0x22, 0x00, /* u16 wTotalLength; */ + 0x01, /* u8 bNumInterfaces; (1) */ + 0x01, /* u8 bConfigurationValue; */ + 0x04, /* u8 iConfiguration; */ + 0xa0, /* u8 bmAttributes; + Bit 7: must be set, + 6: Self-powered, + 5: Remote wakeup, + 4..0: resvd */ + 50, /* u8 MaxPower; */ + + /* USB 1.1: + * USB 2.0, single TT organization (mandatory): + * one interface, protocol 0 + * + * USB 2.0, multiple TT organization (optional): + * two interfaces, protocols 1 (like single TT) + * and 2 (multiple TT mode) ... config is + * sometimes settable + * NOT IMPLEMENTED + */ + + /* one interface */ + 0x09, /* u8 if_bLength; */ + 0x04, /* u8 if_bDescriptorType; Interface */ + 0x00, /* u8 if_bInterfaceNumber; */ + 0x00, /* u8 if_bAlternateSetting; */ + 0x01, /* u8 if_bNumEndpoints; */ + 0x03, /* u8 if_bInterfaceClass; */ + 0x01, /* u8 if_bInterfaceSubClass; */ + 0x02, /* u8 if_bInterfaceProtocol; [usb1.1 or single tt] */ + 0x05, /* u8 if_iInterface; */ + + /* HID descriptor */ + 0x09, /* u8 bLength; */ + 0x21, /* u8 bDescriptorType; */ + 0x01, 0x00, /* u16 HID_class */ + 0x00, /* u8 country_code */ + 0x01, /* u8 num_descriptors */ + 0x22, /* u8 type; Report */ + 65, 0, /* u16 len */ + + /* one endpoint (status change endpoint) */ + 0x07, /* u8 ep_bLength; */ + 0x05, /* u8 ep_bDescriptorType; Endpoint */ + 0x81, /* u8 ep_bEndpointAddress; IN Endpoint 1 */ + 0x03, /* u8 ep_bmAttributes; Interrupt */ + 0x08, 0x00, /* u16 ep_wMaxPacketSize; */ + 0x03, /* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ }; static const uint8_t qemu_mouse_hid_report_descriptor[] = {@@ -121,6 +182,41 @@ 0xC0, 0xC0, }; +static const uint8_t qemu_tablet_hid_report_descriptor[] = { + 0x05, 0x01, /* Usage Page Generic Desktop */ + 0x09, 0x01, /* 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, 0x10, /* Report Size 16 */ + 0x95, 0x02, /* Report Count 2 */ + 0x81, 0x02, /* Input (Data, Var, Abs) */ + 0x09, 0x38, /* Usage Wheel */ + 0x15, 0x81, /* Logical Minimum -127 */ + 0x25, 0x7F, /* Logical Maximum 127 */ + 0x75, 0x08, /* Report Size 8 */ + 0x95, 0x01, /* Report Count 1 */ + 0x81, 0x02, /* Input (Data, Var, Rel) */ + 0xC0, /* End Collection */ + 0xC0, /* End Collection */ +}; + static void usb_mouse_event(void *opaque, int dx1, int dy1, int dz1, int buttons_state){
hw/usb-hid.c Sun Apr 9 22:34:20 2006 -0500 renamed from hw/usb-hid.c Mon Apr 10 01:47:35 2006 +0000 +101
-16@@ -129,6 +225,17 @@ s->dx += dx1; s->dy += dy1; s->dz += dz1; + s->buttons_state = buttons_state; +} + +static void usb_tablet_event(void *opaque, + int x, int y, int dz, int buttons_state) +{ + USBMouseState *s = opaque; + + s->x = x; + s->y = y; + s->dz += dz; s->buttons_state = buttons_state; }@@ -146,6 +253,11 @@ { int dx, dy, dz, b, l; + if (!s->mouse_grabbed) { + qemu_add_mouse_event_handler(usb_mouse_event, s, 0); + s->mouse_grabbed = 1; + } + dx = int_clamp(s->dx, -128, 127); dy = int_clamp(s->dy, -128, 127); dz = int_clamp(s->dz, -128, 127);@@ -173,6 +285,39 @@ return l; } +static int usb_tablet_poll(USBMouseState *s, uint8_t *buf, int len) +{ + int dz, b, l; + + if (!s->mouse_grabbed) { + qemu_add_mouse_event_handler(usb_tablet_event, s, 1); + s->mouse_grabbed = 1; + } + + dz = int_clamp(s->dz, -128, 127); + s->dz -= dz; + + /* Appears we have to invert the wheel direction */ + dz = 0 - dz; + b = 0; + if (s->buttons_state & MOUSE_EVENT_LBUTTON) + b |= 0x01; + if (s->buttons_state & MOUSE_EVENT_RBUTTON) + b |= 0x02; + if (s->buttons_state & MOUSE_EVENT_MBUTTON) + b |= 0x04; + + buf[0] = b; + buf[1] = s->x & 0xff; + buf[2] = s->x >> 8; + buf[3] = s->y & 0xff; + buf[4] = s->y >> 8; + buf[5] = dz; + l = 6; + + return l; +} + static void usb_mouse_handle_reset(USBDevice *dev) { USBMouseState *s = (USBMouseState *)dev;@@ -180,6 +325,8 @@ s->dx = 0; s->dy = 0; s->dz = 0; + s->x = 0; + s->y = 0; s->buttons_state = 0; }@@ -187,7 +334,7 @@ int index, int length, uint8_t *data) { USBMouseState *s = (USBMouseState *)dev; - int ret; + int ret = 0; switch(request) { case DeviceRequest | USB_REQ_GET_STATUS:@@ -224,9 +371,15 @@ ret = sizeof(qemu_mouse_dev_descriptor); break; case USB_DT_CONFIG: - memcpy(data, qemu_mouse_config_descriptor, - sizeof(qemu_mouse_config_descriptor)); - ret = sizeof(qemu_mouse_config_descriptor); + if (s->kind == USB_MOUSE) { + memcpy(data, qemu_mouse_config_descriptor, + sizeof(qemu_mouse_config_descriptor)); + ret = sizeof(qemu_mouse_config_descriptor); + } else if (s->kind == USB_TABLET) { + memcpy(data, qemu_tablet_config_descriptor, + sizeof(qemu_tablet_config_descriptor)); + ret = sizeof(qemu_tablet_config_descriptor); + } break; case USB_DT_STRING: switch(value & 0xff) {@@ -244,7 +397,10 @@ break; case 2: /* product description */ - ret = set_usb_string(data, "QEMU USB Mouse"); + if (s->kind == USB_MOUSE) + ret = set_usb_string(data, "QEMU USB Mouse"); + else if (s->kind == USB_TABLET) + ret = set_usb_string(data, "QEMU USB Tablet"); break; case 3: /* vendor description */@@ -282,16 +438,25 @@ case InterfaceRequest | USB_REQ_GET_DESCRIPTOR: switch(value >> 8) { case 0x22: - memcpy(data, qemu_mouse_hid_report_descriptor, - sizeof(qemu_mouse_hid_report_descriptor)); - ret = sizeof(qemu_mouse_hid_report_descriptor); - break; + if (s->kind == USB_MOUSE) { + memcpy(data, qemu_mouse_hid_report_descriptor, + sizeof(qemu_mouse_hid_report_descriptor)); + ret = sizeof(qemu_mouse_hid_report_descriptor); + } else if (s->kind == USB_TABLET) { + memcpy(data, qemu_tablet_hid_report_descriptor, + sizeof(qemu_tablet_hid_report_descriptor)); + ret = sizeof(qemu_tablet_hid_report_descriptor); + } + break; default: goto fail; } break; case GET_REPORT: - ret = usb_mouse_poll(s, data, length); + if (s->kind == USB_MOUSE) + ret = usb_mouse_poll(s, data, length); + else if (s->kind == USB_TABLET) + ret = usb_tablet_poll(s, data, length); break; case SET_IDLE: ret = 0;@@ -308,12 +473,15 @@ uint8_t devep, uint8_t *data, int len) { USBMouseState *s = (USBMouseState *)dev; - int ret; + int ret = 0; switch(pid) { case USB_TOKEN_IN: if (devep == 1) { - ret = usb_mouse_poll(s, data, len); + if (s->kind == USB_MOUSE) + ret = usb_mouse_poll(s, data, len); + else if (s->kind == USB_TABLET) + ret = usb_tablet_poll(s, data, len); } else { goto fail; }@@ -327,7 +495,7 @@ return ret; } -USBDevice *usb_mouse_init(void) +USBDevice *usb_tablet_init(void) { USBMouseState *s;@@ -340,8 +508,25 @@ s->dev.handle_reset = usb_mouse_handle_reset; s->dev.handle_control = usb_mouse_handle_control; s->dev.handle_data = usb_mouse_handle_data; - - qemu_add_mouse_event_handler(usb_mouse_event, s); - + s->kind = USB_TABLET; + return (USBDevice *)s; } + +USBDevice *usb_mouse_init(void) +{ + USBMouseState *s; + + s = qemu_mallocz(sizeof(USBMouseState)); + if (!s) + return NULL; + s->dev.speed = USB_SPEED_FULL; + s->dev.handle_packet = usb_generic_handle_packet; + + s->dev.handle_reset = usb_mouse_handle_reset; + s->dev.handle_control = usb_mouse_handle_control; + s->dev.handle_data = usb_mouse_handle_data; + s->kind = USB_MOUSE; + + return (USBDevice *)s; +}diff -r
6a786a97b822hw/usb.hhw/usb.h Sun Apr 9 22:34:20 2006 -0500 renamed from hw/usb.h Mon Apr 10 01:47:35 2006 +0000 +1
-0@@ -163,3 +163,4 @@ /* usb-hid.c */ USBDevice *usb_mouse_init(void); +USBDevice *usb_tablet_init(void);diff -r
6a786a97b822sdl.csdl.c Sun Apr 9 22:34:20 2006 -0500 renamed from sdl.c Mon Apr 10 01:47:35 2006 +0000 +42
-4@@ -39,6 +39,10 @@ static int gui_fullscreen_initial_grab; static int gui_grab_code = KMOD_LALT | KMOD_LCTRL; static uint8_t modifiers_state[256]; +static int width, height; +static SDL_Cursor *sdl_cursor_normal; +static SDL_Cursor *sdl_cursor_hidden; +static int absolute_enabled = 0; static void sdl_update(DisplayState *ds, int x, int y, int w, int h) {@@ -55,6 +59,9 @@ flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL; if (gui_fullscreen) flags |= SDL_FULLSCREEN; + + width = w; + height = h; again: screen = SDL_SetVideoMode(w, h, 0, flags);@@ -271,9 +278,21 @@ SDL_WM_SetCaption(buf, "QEMU"); } +static void sdl_hide_cursor(void) +{ + SDL_SetCursor(sdl_cursor_hidden); +} + +static void sdl_show_cursor(void) +{ + if (!kbd_mouse_is_absolute()) { + SDL_SetCursor(sdl_cursor_normal); + } +} + static void sdl_grab_start(void) { - SDL_ShowCursor(0); + sdl_hide_cursor(); SDL_WM_GrabInput(SDL_GRAB_ON); /* dummy read to avoid moving the mouse */ SDL_GetRelativeMouseState(NULL, NULL);@@ -284,7 +303,7 @@ static void sdl_grab_end(void) { SDL_WM_GrabInput(SDL_GRAB_OFF); - SDL_ShowCursor(1); + sdl_show_cursor(); gui_grab = 0; sdl_update_caption(); }@@ -300,6 +319,21 @@ buttons |= MOUSE_EVENT_RBUTTON; if (state & SDL_BUTTON(SDL_BUTTON_MIDDLE)) buttons |= MOUSE_EVENT_MBUTTON; + + if (kbd_mouse_is_absolute()) { + if (!absolute_enabled) { + sdl_hide_cursor(); + if (gui_grab) { + sdl_grab_end(); + } + absolute_enabled = 1; + } + + SDL_GetMouseState(&dx, &dy); + dx = dx * 0x7FFF / width; + dy = dy * 0x7FFF / height; + } + kbd_mouse_event(dx, dy, dz, buttons); }@@ -423,7 +457,7 @@ qemu_system_shutdown_request(); break; case SDL_MOUSEMOTION: - if (gui_grab) { + if (gui_grab || kbd_mouse_is_absolute()) { sdl_send_mouse_event(0); } break;@@ -431,7 +465,7 @@ case SDL_MOUSEBUTTONUP: { SDL_MouseButtonEvent *bev = &ev->button; - if (!gui_grab) { + if (!gui_grab && !kbd_mouse_is_absolute()) { if (ev->type == SDL_MOUSEBUTTONDOWN && (bev->state & SDL_BUTTON_LMASK)) { /* start grabbing all events */@@ -471,6 +505,7 @@ void sdl_display_init(DisplayState *ds, int full_screen) { int flags; + uint8_t data = 0; #if defined(__APPLE__) /* always use generic keymaps */@@ -504,6 +539,9 @@ SDL_EnableUNICODE(1); gui_grab = 0; + sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0); + sdl_cursor_normal = SDL_GetCursor(); + atexit(sdl_cleanup); if (full_screen) { gui_fullscreen = 1;diff -r
6a786a97b822vl.cvl.c Sun Apr 9 22:34:20 2006 -0500 renamed from vl.c Mon Apr 10 01:47:35 2006 +0000 +3
-1@@ -474,6 +474,7 @@ static void *qemu_put_kbd_event_opaque; static QEMUPutMouseEvent *qemu_put_mouse_event; static void *qemu_put_mouse_event_opaque; +static int qemu_put_mouse_event_absolute; void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque) {@@ -481,10 +482,11 @@ qemu_put_kbd_event = func; } -void qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void *opaque) +void qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void *opaque, int absolute) { qemu_put_mouse_event_opaque = opaque; qemu_put_mouse_event = func; + qemu_put_mouse_event_absolute = absolute; }void
kbd_put_keycode(int keycode)vl.c Sun Apr 9 22:34:20 2006 -0500 renamed from vl.c Mon Apr 10 01:47:35 2006 +0000 +9
-0@@ -500,6 +502,11 @@ qemu_put_mouse_event(qemu_put_mouse_event_opaque, dx, dy, dz, buttons_state); } +} + +int kbd_mouse_is_absolute(void) +{ + return qemu_put_mouse_event_absolute; } /***********************************************************/@@ -2855,6 +2862,10 @@ dev = usb_mouse_init(); if (!dev) return -1; + } else if (!strcmp(devname, "tablet")) { + dev = usb_tablet_init(); + if (!dev) + return -1; } else { return -1; }diff -r
6a786a97b822vl.hvl.h Sun Apr 9 22:34:20 2006 -0500 renamed from vl.h Mon Apr 10 01:47:35 2006 +0000 +2
-1@@ -158,10 +158,11 @@ typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state); void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque); -void qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void *opaque); +void qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void *opaque, int absolute); void kbd_put_keycode(int keycode); void kbd_mouse_event(int dx, int dy, int dz, int buttons_state); +int kbd_mouse_is_absolute(void);/* keysym is a unicode code except for special keys (see
QEMU_KEY_xxx
constants) */------------------------------------------------------------------------
_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Re: [Qemu-devel] USB Tablet Emulation
Sorry about that... Brad, very well done!
On another note, I'm looking over the USB HID spec to better understand the boot-time device constraints. I doubt you can use an absolute coordinate tablet as a boot-time mouse that actually reports positions in absolute terms, but maybe it's possible. It's not a big deal, just cosmetic really - to be able to use the tablet at OS install/early boot time, before more complex drivers are loaded. I'm not sure how possible this is, but the USB HID spec seems to imply it.
- Leo Reiter
Quoted 2 lines · Anthony Liguori
Make sure to give credit where credit's due. Brad Campbell figured out the hard stuff :-)
Signature · 8 lines
Leonardo E. Reiter Vice President of Product Development, CTO Win4Lin, Inc. Virtual Computing from Desktop to Data Center Main: +1 512 339 7979 Fax: +1 512 532 6501 http://www.win4lin.com
Re: [Qemu-devel] USB Tablet Emulation
Quoted 1 line · Leonardo E. Reiter
Sorry about that... Brad, very well done!
Ta :)
Anthony did a great job doing the stuff I'm knaff at (making clean and mergable code) and the sdl hookups. I just hacked the hid stuff (about 150 win2k reboots in there).
It works with Win98 also, but Win98 seems to want a slightly different hid config or wants 0-ffff rather than 0-7fff. I'm playing with that..
The wheel works in SDL although there is currently a bug where it steps by 2 instead of 1.. so it's ok for scrolling, but scrolling through a selection box causes it to skip every second selection. I've not tested the wheel with the vnc patch yet. I'll get to those tonight..
Quoted 1 line
On another note, I'm looking over the USB HID spec to better understand the boot-time device constraints. I doubt you can use an absolute coordinate tablet as a boot-time mouse that actually reports positions in absolute terms, but maybe it's possible. It's not a big deal, just cosmetic really - to be able to use the tablet at OS install/early boot time, before more complex drivers are loaded. I'm not sure how possible this is, but the USB HID spec seems to imply it.
Yes, there are tight boot time constraints.. and no from what I can find the hid required to meet them won't work with abs coordinates. if you absolutely *had* to do that, perhaps there might be a way of switching mice on the fly.. virtual unplug mouse and replug tablet, or enable ps2 for boot and then some way of causing a tablet plug in at the appropriate time..
I'm not sure the bochs bios handles legacy usb though, so I feel its somewhat of a moot point, as you *need* the OS usb drivers loaded to even pick up a legacy usb mouse device.
Brad
Signature · 3 lines
"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
Re: [Qemu-devel] USB Tablet Emulation
Quoted 2 lines · Brad Campbell
The wheel works in SDL although there is currently a bug where it steps by 2 instead of 1.. so it's ok for scrolling, but scrolling through a selection box causes it to skip every second selection. I've not tested the wheel with the vnc patch yet. I'll get to those tonight..
Wheel works in VNC unmodified :) (yay)
I've been playing some more on the Win98 calibration issue and I'll keep looking at that, but for now it' still a no-go. And the 2 step wheel thing still needs fixing.
Brad
Signature · 3 lines
"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
Re: [Qemu-devel] USB Tablet Emulation
Quoted 8 lines · Brad Campbell
Quoted 2 lines · Brad Campbell
The wheel works in SDL although there is currently a bug where it steps by 2 instead of 1.. so it's ok for scrolling, but scrolling through a selection box causes it to skip every second selection. I've not tested the wheel with the vnc patch yet. I'll get to those tonight..
Wheel works in VNC unmodified :) (yay)
I've been playing some more on the Win98 calibration issue and I'll keep looking at that, but for now it' still a no-go. And the 2 step wheel thing still needs fixing.
Fixed the descriptor.. Now works perfectly in Win98, 2k and XP :)
Signature · 3 lines
"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
hw/usb-hid.c +5 -2
@@ -161,7 +161,7 @@0x00 ,/* u8 country_code */ 0x01 ,/* u8 num_descriptors */ 0x22 ,/* u8 type; Report */ -65 ,0 ,/* u16 len */ +70 ,0 ,/* u16 len */ /* one endpoint (status change endpoint) */ 0x07, /* u8 ep_bLength; */
@@ -203,10 +203,13 @@0x09 ,0x30 ,/* Usage X */ 0x09 ,0x31 ,/* Usage Y */ 0x15 ,0x00 ,/* Logical Minimum 0 */ -0x27 ,0xFF ,0xFF ,0x00 ,0x00 ,/* Logical Maximum 0xffff */ +0x26 ,0xFF ,0x7F ,/* Logical Maximum 0x7fff */ +0x35 ,0x00 ,/* Physical Minimum 0 */ +0x46 ,0xFF ,0x7F ,/* Physical Maximum 0x7fff */ 0x75 ,0x10 ,/* Report Size 16 */ 0x95 ,0x02 ,/* Report Count 2 */ 0x81 ,0x02 ,/* Input (Data, Var, Abs) */ +0x05 ,0x01 ,/* Usage Page Generic Desktop */ 0x09 ,0x38 ,/* Usage Wheel */ 0x15 ,0x81 ,/* Logical Minimum -127 */ 0x25, 0x7F, /* Logical Maximum 127 */
Re: [Qemu-devel] USB Tablet Emulation
Quoted 12 lines · Brad Campbell
Quoted 8 lines · Brad Campbell
Quoted 2 lines · Brad Campbell
The wheel works in SDL although there is currently a bug where it steps by 2 instead of 1.. so it's ok for scrolling, but scrolling through a selection box causes it to skip every second selection. I've not tested the wheel with the vnc patch yet. I'll get to those tonight..
Wheel works in VNC unmodified :) (yay)
I've been playing some more on the Win98 calibration issue and I'll keep looking at that, but for now it' still a no-go. And the 2 step wheel thing still needs fixing.
Fixed the descriptor.. Now works perfectly in Win98, 2k and XP :)
Spoke too soon.. revised patch that actually has been completely tested in all 3. For those thinking of going into a career of hid descriptor writing.. DON'T!
Win98 does not parse the descriptor properly.. and win2k/xp appear to adhere strictly to the specs. We should now be in a pretty compliant position with all bases covered.
Also attached a small patch to sdl.c which solves the double wheel messages.
The wheel is just 2 buttons.. up and down effectively, and we were sending a delta on both press and release of each button, where it should only be a press. This makes the double events go away and I can scroll line by line through any listbox or list.
For those that just want to play.
This is a rollup of Anthony's patch, Leo's win2k-hack patch and all my latest fixes plus the vnc patch. It applies directly over the latest cvs checkout and is enabled with -usb -usbdevice tablet.
http://fnarfbargle.dyndns.org:81/qemu/qemu-hid-rfb-ide.patch.gz
Brad
Signature · 3 lines
"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
hw/usb-hid.c +22 -11
@@ -161,7 +161,7 @@0x00 ,/* u8 country_code */ 0x01 ,/* u8 num_descriptors */ 0x22 ,/* u8 type; Report */ -65 ,0 ,/* u16 len */ +74 ,0 ,/* u16 len */ /* one endpoint (status change endpoint) */ 0x07, /* u8 ep_bLength; */
@@ -188,29 +188,40 @@0xA1 ,0x01 ,/* Collection Application */ 0x09 ,0x01 ,/* Usage Pointer */ 0xA1 ,0x00 ,/* Collection Physical */ -0x05 ,0x09 ,/* Usage Page Button */ + +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 */ + +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) */ + +0x81 ,0x01 ,/* Input (Cnst, Var, Abs) */ 0x05 ,0x01 ,/* Usage Page Generic Desktop */ -0x09 ,0x30 ,/* Usage X */ +0x09 ,0x30 ,/* Usage X */ 0x09 ,0x31 ,/* Usage Y */ 0x15 ,0x00 ,/* Logical Minimum 0 */ -0x27 ,0xFF ,0xFF ,0x00 ,0x00 ,/* Logical Maximum 0xffff */ -0x75 ,0x10 ,/* Report Size 16 */ -0x95 ,0x02 ,/* Report Count 2 */ -0x81 ,0x02 ,/* Input (Data, Var, Abs) */ + +0x26 ,0xFF ,0x7F ,/* Logical Maximum 0x7fff */ +0x35 ,0x00 ,/* Physical Minimum 0 */ +0x46 ,0xFE ,0x7F ,/* Physical Maximum 0x7fff */ +0x75 ,0x10 ,/* Report Size 16 */ + +0x95 ,0x02 ,/* Report Count 2 */ +0x81 ,0x02 ,/* Input (Data, Var, Abs) */ +0x05 ,0x01 ,/* Usage Page Generic Desktop */ 0x09 ,0x38 ,/* Usage Wheel */ 0x15 ,0x81 ,/* Logical Minimum -127 */ -0x25 ,0x7F ,/* Logical Maximum 127 */ -0x75 ,0x08 ,/* Report Size 8 */ + +0x25 ,0x7F ,/* Logical Maximum 127 */ +0x35 ,0x00 ,/* Physical Minimum 0 (same as logical) */ +0x45 ,0x00 ,/* Physical Maximum 0 (same as logical) */ +0x75 ,0x08 ,/* Report Size 8 */ 0x95 ,0x01 ,/* Report Count 1 */ 0x81 ,0x02 ,/* Input (Data, Var, Rel) */ 0xC0, /* End Collection */
sdl.c +2 -2
@@ -479,9 +479,9 @@int dz; dz =0 ;#ifdef SDL_BUTTON_WHEELUP -if (bev->button ==SDL_BUTTON_WHEELUP ) { +if (bev->button ==SDL_BUTTON_WHEELUP && ev->type ==SDL_MOUSEBUTTONDOWN ) { dz =-1 ; - }else if (bev->button ==SDL_BUTTON_WHEELDOWN ) { + }else if (bev->button ==SDL_BUTTON_WHEELDOWN && ev->type ==SDL_MOUSEBUTTONDOWN ) { dz =1 ; }#endif
Re: [Qemu-devel] USB Tablet Emulation
Ok.. and for my next trick.. one that is not whitespace damaged..
Functionally same as 002..
Brad (need caffeine or sleep)
Signature · 3 lines
"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
hw/usb-hid.c +7 -2
@@ -161,7 +161,7 @@0x00 ,/* u8 country_code */ 0x01 ,/* u8 num_descriptors */ 0x22 ,/* u8 type; Report */ -65 ,0 ,/* u16 len */ +74 ,0 ,/* u16 len */ /* one endpoint (status change endpoint) */ 0x07, /* u8 ep_bLength; */
@@ -203,13 +203,18 @@0x09 ,0x30 ,/* Usage X */ 0x09 ,0x31 ,/* Usage Y */ 0x15 ,0x00 ,/* Logical Minimum 0 */ -0x27 ,0xFF ,0xFF ,0x00 ,0x00 ,/* Logical Maximum 0xffff */ +0x26 ,0xFF ,0x7F ,/* Logical Maximum 0x7fff */ +0x35 ,0x00 ,/* Physical Minimum 0 */ +0x46 ,0xFE ,0x7F ,/* Physical Maximum 0x7fff */ 0x75 ,0x10 ,/* Report Size 16 */ 0x95 ,0x02 ,/* Report Count 2 */ 0x81 ,0x02 ,/* Input (Data, Var, Abs) */ +0x05 ,0x01 ,/* Usage Page Generic Desktop */ 0x09 ,0x38 ,/* Usage Wheel */ 0x15 ,0x81 ,/* Logical Minimum -127 */ 0x25 ,0x7F ,/* Logical Maximum 127 */ +0x35 ,0x00 ,/* Physical Minimum 0 (same as logical) */ +0x45 ,0x00 ,/* Physical Maximum 0 (same as logical) */ 0x75 ,0x08 ,/* Report Size 8 */ 0x95 ,0x01 ,/* Report Count 1 */ 0x81, 0x02, /* Input (Data, Var, Rel) */
Quoted 10 lines · Samuel Hunt
Quoted 2 lines
It occurs to me that this program would make an excellent basis for a VNC terminal server.
Yeah, something like that has been done already:
http://libvncserver.sourceforge.net/qemu/qemu-rfb13.patch.gzThere is a notable update since rfb12 (which is a bit out of date _cough_): Nis Jorgensen has sent a patch to support scroll mice.
Quoted 6 lines
IMHO the biggest obstacle to inclusion in mainline QEmu is that the mouse support is rather flakey: You have to disable mouse acceleration of the guest OS.
I had that cunning plan to write a virtual Wacom tablet, but I just don't find the time.
The Xen copy of pckbd.c includes a patch to emulate a Summagraphics tablet, in order to fix this problem. This is probably reusable for QEmu itself.
Cheers,
Mark
Signature · 4 lines
Dave: Just a question. What use is a unicyle with no seat? And no pedals! Mark: To answer a question with a question: What use is a skateboard? Dave: Skateboards have wheels. Mark: My wheel has a wheel!
Hi,
Quoted 3 lines · Mark Williamson
The Xen copy of
pckbd.cincludes a patch to emulate a Summagraphics tablet, in order to fix this problem. This is probably reusable for QEmu itself.
I even know who wrote it... Donald Dugger. He forwarded it to me also, and I even think it is part of the RFB patch (too lazy to check right now).
There are two problems:
- configuration is a bitch. For example, X and gpm do not play nice together. And there is no automatic detection for Summagraphics in kudzu (which is the automatic hardware detection of Knoppix).
- the patch modifies the PS/2 mouse of QEmu. However, there is no such thing as a PS/2 Summagraphics. Consequently, all win98 drivers I found did not detect a Summagraphics device.
Ciao,
Dscho
Quoted 10 lines · Johannes Schindelin
IMHO the biggest obstacle to inclusion in mainline QEmu is that the mouse support is rather flakey: You have to disable mouse acceleration of the guest OS.
I had that cunning plan to write a virtual Wacom tablet, but I just don't find the time.
Ciao,
Dscho
Anthony Ligouri has written a patch for wacom support.
However, when I combine this with the -no-sdl-grab patch I still see syncing issues.
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
Hi,
Quoted 8 lines · Jim C. Brown
Quoted 7 lines · Johannes Schindelin
IMHO the biggest obstacle to inclusion in mainline QEmu is that the mouse support is rather flakey: You have to disable mouse acceleration of the guest OS.
I had that cunning plan to write a virtual Wacom tablet, but I just don't find the time.
Quoted 8 lines
Quoted 3 lines
Ciao,
DschoAnthony Ligouri has written a patch for wacom support.
However, when I combine this with the -no-sdl-grab patch I still see syncing issues.
Where can I get it?
Ciao,
Dscho
Quoted 6 lines · Johannes Schindelin
Quoted 4 lines
Anthony Ligouri has written a patch for wacom support.
However, when I combine this with the -no-sdl-grab patch I still see syncing issues.
Where can I get it?
http://www.cs.utexas.edu/users/aliguori/qemu-wacom-2.tgz
Quoted 11 lines
Ciao,
Dscho_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Signature · 2 lines
Infinite complexity begets infinite beauty. Infinite precision begets infinite perfection.
Hi,
Quoted 9 lines · Jim C. Brown
Quoted 6 lines · Johannes Schindelin
Quoted 4 lines
Anthony Ligouri has written a patch for wacom support.
However, when I combine this with the -no-sdl-grab patch I still see syncing issues.
Where can I get it?
Thanks! I will play around a little.
Ciao,
Dscho
Quoted 15 lines · Johannes Schindelin
Hi,
Quoted 10 lines · Jim C. Brown
Quoted 8 lines · Johannes Schindelin
IMHO the biggest obstacle to inclusion in mainline QEmu is that the mouse support is rather flakey: You have to disable mouse acceleration of the guest OS.
I had that cunning plan to write a virtual Wacom tablet, but I just don't find the time.
Ciao,
Dscho
Quoted 8 lines
Quoted 5 lines
Anthony Ligouri has written a patch for wacom support.
However, when I combine this with the -no-sdl-grab patch I still see syncing issues.
Where can I get it?
http://www.cs.utexas.edu/users/aliguori/qemu-wacom-2.tgz but as I mentioned earlier, YMMV.
Regards,
Anthony Liguori
Quoted 10 lines
Ciao,
Dscho_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Quoted 4 lines · Jim C. Brown
Quoted 2 lines · Johannes Schindelin
IMHO the biggest obstacle to inclusion in mainline QEmu is that the mouse support is rather flakey: You have to disable mouse acceleration of the guest OS.
Quoted 9 lines
Quoted 6 lines
I had that cunning plan to write a virtual Wacom tablet, but I just don't find the time.
Ciao,
DschoAnthony Ligouri has written a patch for wacom support.
Docs are available for older Wacom tablets. I've not gotten the time to update my patches to actually implement the full protocol according to the docs. The version I wrote is based on a newer X driver so YMMV.
Regards,
ANthony Liguori
Quoted 4 lines
However, when I combine this with the -no-sdl-grab patch I still see syncing issues.
Hi,
Quoted 7 lines
IMHO the biggest obstacle to inclusion in mainline QEmu is that the mouse support is rather flakey: You have to disable mouse acceleration of the guest OS.
I had that cunning plan to write a virtual Wacom tablet, but I just don't find the time.
I thought Anthony Liguori had already written a Wacom tablet emulator for QEMU and that worked fine except it supports only one button. I don't remember if this support was complete and I don't have a link to the patch.
With this you don't need to disable mouse acceleration in the guest OS because it makes no sense to accelerate a tablet.
On the other hand writing a guest-side driver for QEMU would leave room for further improvements like hiding/showing or grabbing/releasing the mouse at specific moments. Or, possibly reusing tools from Win4Lin or VMtools from VMware.
Quoted 10 lines
Ciao,
Dscho_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
--
balrog 2oo6
Dear Outlook users: Please remove me from your address books
http://www.newsforge.com/article.pl?sid=03/08/21/143258
The Win4Lin Pro version is not a driver, but rather a high-priority Windows userspace thread. We try to avoid drivers as much as possible because they are a serious obstacle to supporting new Windows versions and service packs as they come out. I can't comment on VMware's approach to be honest.
I will say that using a device that has readily and/or publicly available drivers is probably ideal, such as a Wacom tablet. We are trying to move to more of a device model on Win4Lin Pro for performance reasons, which is why I am interested in this approach. But letting Microsoft maintain the guest driver, if it's built into Windows, is the best solution. It also guarantees the broadest possible guest support in general - whether it be Linux, Mac OS X, etc.
If anyone has a link to Anthony Liguori's driver, I'd be glad to look into fixing whatever may be wrong with it and posting the patches.
Thanks,
Leo Reiter
Quoted 12 lines · andrzej zaborowski
I thought Anthony Liguori had already written a Wacom tablet emulator for QEMU and that worked fine except it supports only one button. I don't remember if this support was complete and I don't have a link to the patch.
With this you don't need to disable mouse acceleration in the guest OS because it makes no sense to accelerate a tablet.
On the other hand writing a guest-side driver for QEMU would leave room for further improvements like hiding/showing or grabbing/releasing the mouse at specific moments. Or, possibly reusing tools from Win4Lin or VMtools from VMware.
Signature · 8 lines
Leonardo E. Reiter Vice President of Product Development, CTO Win4Lin, Inc. Virtual Computing from Desktop to Data Center Main: +1 512 339 7979 Fax: +1 512 532 6501 http://www.win4lin.com
Quoted 3 lines · Leonardo E. Reiter
The Win4Lin Pro version is not a driver, but rather a high-priority Windows userspace thread. We try to avoid drivers as much as possible because they are a serious obstacle to supporting new Windows versions and service packs as they come out. I can't comment on VMware's approach to be honest.
I will say that using a device that has readily and/or publicly available drivers is probably ideal, such as a Wacom tablet. We are trying to move to more of a device model on Win4Lin Pro for performance reasons, which is why I am interested in this approach. But letting Microsoft maintain the guest driver, if it's built into Windows, is the best solution. It also guarantees the broadest possible guest support in general - whether it be Linux, Mac OS X, etc.
The driver isn't built into Windows. It's pretty easy to install though and the way my patch works, the PS/2 mouse is used until it detects the tablet has been enabled.
The Windows driver uses quite a bit more of the features of the tablet than the X driver so there's a bit more work to do but nothing extraordinary.
Regards,
Anthony Liguori
Quoted 21 lines
If anyone has a link to Anthony Liguori's driver, I'd be glad to look into fixing whatever may be wrong with it and posting the patches.
Thanks,
Leo Reiter
Quoted 12 lines · andrzej zaborowski
I thought Anthony Liguori had already written a Wacom tablet emulator for QEMU and that worked fine except it supports only one button. I don't remember if this support was complete and I don't have a link to the patch.
With this you don't need to disable mouse acceleration in the guest OS because it makes no sense to accelerate a tablet.
On the other hand writing a guest-side driver for QEMU would leave room for further improvements like hiding/showing or grabbing/releasing the mouse at specific moments. Or, possibly reusing tools from Win4Lin or VMtools from VMware.
Hi Anthony,
I noticed that the Windows driver does not work... it does send a bunch of commands to the tablet, mostly resets, but then claims that it can't discover it. I downloaded the latest driver from wacom.com. I did not try this with a Linux guest yet.... maybe that should be my next thing, and see what it will take to make it work without the SDL grab altogether (and sync up). If that can work reliably, then adding the bits to the protocol that Windows expects would be worth the work.
I'm thinking that this device would be a good complementary option to an absolute USB HID device. Having both in the long run won't hurt, especially if certain OS's prefer serial over USB absolute pointers, and vice versa.
- Leo Reiter
Quoted 7 lines · Anthony Liguori
The driver isn't built into Windows. It's pretty easy to install though and the way my patch works, the PS/2 mouse is used until it detects the tablet has been enabled.
The Windows driver uses quite a bit more of the features of the tablet than the X driver so there's a bit more work to do but nothing extraordinary.
Regards,
Anthony Liguori
Signature · 8 lines
Leonardo E. Reiter Vice President of Product Development, CTO Win4Lin, Inc. Virtual Computing from Desktop to Data Center Main: +1 512 339 7979 Fax: +1 512 532 6501 http://www.win4lin.com
Quoted 3 lines · Leonardo E. Reiter
Hi Anthony,
I noticed that the Windows driver does not work... it does send a bunch of commands to the tablet, mostly resets, but then claims that it can't discover it. I downloaded the latest driver from wacom.com.
Yes, this is what I said. The Windows driver uses a bunch more commands than the Linux driver that I have not implemented (which is why I haven't submitted to this list yet).
Quoted 3 lines
I did not try this with a Linux guest yet.... maybe that should be my next thing, and see what it will take to make it work without the SDL grab altogether (and sync up). If that can work reliably, then adding the bits to the protocol that Windows expects would be worth the work.
I'm thinking that this device would be a good complementary option to an absolute USB HID device. Having both in the long run won't hurt, especially if certain OS's prefer serial over USB absolute pointers, and vice versa.
Xorg CVS has initial support for absolute USB devices so I think this is the best route for the future.
Regards,
Anthony Liguori
Quoted 11 lines
- Leo Reiter
Quoted 7 lines · Anthony Liguori
The driver isn't built into Windows. It's pretty easy to install though and the way my patch works, the PS/2 mouse is used until it detects the tablet has been enabled.
The Windows driver uses quite a bit more of the features of the tablet than the X driver so there's a bit more work to do but nothing extraordinary.
Regards,
Anthony Liguori
Quoted 8 lines · andrzej zaborowski
Hi,
Quoted 4 lines
IMHO the biggest obstacle to inclusion in mainline QEmu is that the mouse support is rather flakey: You have to disable mouse acceleration of the guest OS.
Quoted 9 lines
Quoted 4 lines
I had that cunning plan to write a virtual Wacom tablet, but I just don't find the time.
I thought Anthony Liguori had already written a Wacom tablet emulator for QEMU and that worked fine except it supports only one button. I don't remember if this support was complete and I don't have a link to the patch.
No, it supports all three. Works quite well for new X drivers. If you search the wacom-devel archives you'll find a link to the docs for the Wacom driver.
It does kind of suck though that you have to manually configure your X server. I looked at a number of tablets and they all seem to be serial or undocumented.
Regards,
Anthony Liguori
Quoted 34 lines
With this you don't need to disable mouse acceleration in the guest OS because it makes no sense to accelerate a tablet.
On the other hand writing a guest-side driver for QEMU would leave room for further improvements like hiding/showing or grabbing/releasing the mouse at specific moments. Or, possibly reusing tools from Win4Lin or VMtools from VMware.
Quoted 11 lines
Ciao,
Dscho_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel--
balrog 2oo6Dear Outlook users: Please remove me from your address books
http://www.newsforge.com/article.pl?sid=03/08/21/143258------------------------------------------------------------------------
_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Quoted 9 lines · Johannes Schindelin
Hi,
Quoted 3 lines · Samuel Hunt
It occurs to me that this program would make an excellent basis for a VNC terminal server.
Quoted 8 lines
Yeah, something like that has been done already: http://libvncserver.sourceforge.net/qemu/qemu-rfb13.patch.gz
There is a notable update since rfb12 (which is a bit out of date _cough_): Nis Jorgensen has sent a patch to support scroll mice.
IMHO the biggest obstacle to inclusion in mainline QEmu is that the mouse support is rather flakey: You have to disable mouse acceleration of the guest OS.
I had that cunning plan to write a virtual Wacom tablet, but I just don't find the time.
Someone posted a virtual Synaptic tablet on xen-devel recently (Xen uses qemu for VT support). If someone wants to pick it up and submit it to qemu, that would solve this problem.
Regards,
Anthony Liguori
Quoted 10 lines
Ciao,
Dscho_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel