qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Turner <digit@google.com>
To: Amey Moghe <amey1288@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] How does QEMU kernel receive any input events from host OS
Date: Wed, 2 Sep 2009 16:32:21 -0700	[thread overview]
Message-ID: <60cad3f0909021632n6e7528cam479720b74bb61c67@mail.gmail.com> (raw)
In-Reply-To: <1600c7720909020555i3a16970eq35e753b33ebf3f78@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2292 bytes --]

the QEMU frontend (e.g. the VNC server or the SDL window) is in charge of
translating user events
into emulated hardware ones. Most generally, this will mean emulating a
keyboard or mouse IRQ
and the associated i/o protocol. Exact details depend on which hardware you
want to emulate.

For example, when emulating a PC with PS/2 keyboard and mouse, the code in
hw/ps2.c will be used.

Here's a concrete example:

   - The VNC server receives packets from the client (see
   protocol_client_msg in vnc.c).
   Some of them correspond to keyboard events (processed in key_event() in
   the same file),
   which end up calling kbd_put_keycode() after translating the VNC
   keycode/state into
   a different key scancode.


   - kbd_put_keycode() is defined in vl.c and calls the hardware-specific
   keycode translator.


   - For PC emulation, this happens to be ps2_put_keycode() defined in
   hw/ps2.c, and
   registered at startup by ps2_kbd_init() in the same file. It probably is
   a different function
   for different emulated hardware.


   - The implementation of ps2_put_keycode() will end up enqueue-ing a
   keycode into
   a queue then raising an IRQ.

   - The guest kernel responds to the IRQ by running its keyboard driver
   code, the latter
   will try to read data from the PS/2 queue


The SDL front-end receives user events differently, but still ends up
calling kbd_put_keycode().
Same thing happens for mouse events, and about anything that needs to
emulate hardware
(e.g. serial/usb/bluetooth/etc...) but implementations and specifics may
differ.

Hope this helps

On Wed, Sep 2, 2009 at 5:55 AM, Amey Moghe <amey1288@gmail.com> wrote:

> Hello all,
>
> I am new to QEMU.While reading about qemu , I came across one statement:
> "QEMU does not depend on the presence of graphical output methods on the
> host system. Instead, it allows one to access the screen of the guest OS via
> VNC. It can also use an emulated serial line, without any screen, with
> applicable operating systems." on following link :
>
> http://en.wikipedia.org/wiki/QEMU
>
> So please can anybodys tell me how does qemu use VNC server for receiving
> events and if yes then how does it receive events from host OS? Or is there
> any other way with which QEMU receives input events from host OS?

[-- Attachment #2: Type: text/html, Size: 2714 bytes --]

  reply	other threads:[~2009-09-02 23:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-02 12:55 [Qemu-devel] How does QEMU kernel receive any input events from host OS Amey Moghe
2009-09-02 23:32 ` David Turner [this message]
2009-09-04  9:58   ` Amey Moghe
2009-09-04 19:36     ` David Turner
2009-09-05 12:52       ` Amey Moghe

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=60cad3f0909021632n6e7528cam479720b74bb61c67@mail.gmail.com \
    --to=digit@google.com \
    --cc=amey1288@gmail.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).