qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Leonardo E. Reiter" <lreiter@win4lin.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server)
Date: Sat, 08 Apr 2006 17:36:20 -0400	[thread overview]
Message-ID: <44382CD4.7040707@win4lin.com> (raw)
In-Reply-To: <4438299F.3010604@wasp.net.au>

Brad Campbell wrote:
> 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..
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.)

> 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

-- 
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

  reply	other threads:[~2006-04-08 21:36 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-08 16:20 [Qemu-devel] VNC terminal server? Samuel Hunt
2006-04-08 18:12 ` Brad Campbell
2006-04-21 15:31   ` Troy Benjegerdes
2006-04-21 15:58     ` WaxDragon
2006-04-08 18:24 ` Johannes Schindelin
2006-04-08 18:37   ` Leonardo E. Reiter
2006-04-08 19:04     ` Johannes Schindelin
2006-04-08 19:15       ` Leonardo E. Reiter
2006-04-09  2:54       ` Anthony Liguori
2006-04-08 20:19     ` Brad Campbell
2006-04-08 20:29       ` Leonardo E. Reiter
2006-04-08 21:06       ` [Qemu-devel] Absolute USB-HID device musings (was Re: VNC Terminal Server) Leonardo E. Reiter
2006-04-08 21:18         ` Leonardo E. Reiter
2006-04-08 21:22         ` Brad Campbell
2006-04-08 21:36           ` Leonardo E. Reiter [this message]
2006-04-09  4:36         ` Anthony Liguori
2006-04-09 15:14           ` Jim C. Brown
2006-04-09 16:03           ` Leonardo E. Reiter
2006-04-09 16:49             ` Brad Campbell
2006-04-09 18:07             ` andrzej zaborowski
2006-04-09 18:35         ` Brad Campbell
2006-04-09 18:41           ` Lonnie Mendez
2006-04-09 19:22             ` Brad Campbell
2006-04-09 20:27               ` [Qemu-devel] Gentlemen we have absolute movement! was:Absolute " Brad Campbell
2006-04-09 20:31                 ` Anthony Liguori
2006-04-09 20:57                 ` Anthony Liguori
2006-04-09 21:02                   ` Brad Campbell
2006-04-09 21:10                   ` Brad Campbell
2006-04-09 21:20                     ` Johannes Schindelin
2006-04-09 21:35                       ` Brad Campbell
2006-04-09 21:39                     ` Anthony Liguori
2006-04-09 22:01                       ` Brad Campbell
2006-04-09 22:08                         ` Anthony Liguori
2006-04-09 22:12                           ` Brad Campbell
2006-04-09 22:18                           ` Brad Campbell
2006-04-09 23:14                           ` Brad Campbell
2006-04-10  3:40                             ` [Qemu-devel] USB Tablet Emulation (was: Gentlemen we have absolute movement! was:Absolute USB-HID device musings (was Re: VNC Terminal Server)) Anthony Liguori
2006-04-10  8:23                               ` [Qemu-devel] USB Tablet Emulation Brad Campbell
2006-04-10  8:32                                 ` Johannes Schindelin
2006-04-10 10:27                                   ` Brad Campbell
2006-04-10 11:27                                     ` Johannes Schindelin
2006-04-19 17:18                                 ` [Qemu-devel] USB Tablet Emulation + VNC patch Troy Benjegerdes
2006-04-21 21:13                                   ` Brad Campbell
2006-04-26  0:55                                     ` Troy Benjegerdes
2006-04-26  7:37                                       ` Brad Campbell
2006-04-10 14:58                               ` [Qemu-devel] USB Tablet Emulation Leonardo E. Reiter
2006-04-10 15:27                                 ` Anthony Liguori
2006-04-10 15:39                                   ` Leonardo E. Reiter
2006-04-10 16:08                                     ` Brad Campbell
2006-04-10 19:28                                       ` Brad Campbell
2006-04-10 19:44                                         ` Brad Campbell
2006-04-10 21:27                                           ` Brad Campbell
2006-04-10 21:39                                             ` Brad Campbell
2006-04-08 18:38   ` [Qemu-devel] VNC terminal server? Mark Williamson
2006-04-08 18:53     ` Johannes Schindelin
2006-04-08 19:01   ` Jim C. Brown
2006-04-08 19:12     ` Johannes Schindelin
2006-04-08 19:30       ` Jim C. Brown
2006-04-08 19:40         ` Johannes Schindelin
2006-04-09  2:55       ` Anthony Liguori
2006-04-09  2:53     ` Anthony Liguori
2006-04-08 19:21   ` andrzej zaborowski
2006-04-08 19:33     ` Leonardo E. Reiter
2006-04-09  2:59       ` Anthony Liguori
2006-04-09 16:06         ` Leonardo E. Reiter
2006-04-09 16:40           ` Anthony Liguori
2006-04-09  2:57     ` Anthony Liguori
2006-04-09  2:52   ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44382CD4.7040707@win4lin.com \
    --to=lreiter@win4lin.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).