From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MizJd-000816-W4 for qemu-devel@nongnu.org; Wed, 02 Sep 2009 19:32:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MizJY-00080d-Bo for qemu-devel@nongnu.org; Wed, 02 Sep 2009 19:32:36 -0400 Received: from [199.232.76.173] (port=54348 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MizJY-00080T-22 for qemu-devel@nongnu.org; Wed, 02 Sep 2009 19:32:32 -0400 Received: from smtp-out.google.com ([216.239.33.17]:13295) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MizJX-0008Rt-8m for qemu-devel@nongnu.org; Wed, 02 Sep 2009 19:32:31 -0400 Received: from zps78.corp.google.com (zps78.corp.google.com [172.25.146.78]) by smtp-out.google.com with ESMTP id n82NWPgs010728 for ; Thu, 3 Sep 2009 00:32:26 +0100 Received: from fxm4 (fxm4.prod.google.com [10.184.13.4]) by zps78.corp.google.com with ESMTP id n82NWM0K030525 for ; Wed, 2 Sep 2009 16:32:23 -0700 Received: by fxm4 with SMTP id 4so1151315fxm.16 for ; Wed, 02 Sep 2009 16:32:22 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1600c7720909020555i3a16970eq35e753b33ebf3f78@mail.gmail.com> References: <1600c7720909020555i3a16970eq35e753b33ebf3f78@mail.gmail.com> Date: Wed, 2 Sep 2009 16:32:21 -0700 Message-ID: <60cad3f0909021632n6e7528cam479720b74bb61c67@mail.gmail.com> Subject: Re: [Qemu-devel] How does QEMU kernel receive any input events from host OS From: David Turner Content-Type: multipart/alternative; boundary=001485f6c76abc163a0472a0adc4 List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amey Moghe Cc: qemu-devel@nongnu.org --001485f6c76abc163a0472a0adc4 Content-Type: text/plain; charset=ISO-8859-1 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 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? --001485f6c76abc163a0472a0adc4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable the QEMU frontend (e.g. the VNC server or the SDL window) is in charge of t= ranslating user events
into emulated hardware ones. Most generally, this= will mean emulating a keyboard or mouse IRQ
and the associated i/o prot= ocol. 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 i= n 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 th= e VNC keycode/state into
    a different key scancode.
  • kbd_put_keycode() is defined in vl.c and calls the hardware-specific ke= ycode 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 r= aising an IRQ.

  • The guest kernel responds to the IRQ by runn= ing its keyboard driver code, the latter
    will try to read data from the PS/2 queue

The SDL front-end re= ceives 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 di= ffer.

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 even= ts 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?

--001485f6c76abc163a0472a0adc4--