From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mjuka-0004KK-Qr for qemu-devel@nongnu.org; Sat, 05 Sep 2009 08:52:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjukW-0004HL-Ru for qemu-devel@nongnu.org; Sat, 05 Sep 2009 08:52:16 -0400 Received: from [199.232.76.173] (port=42014 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjukW-0004H9-Ha for qemu-devel@nongnu.org; Sat, 05 Sep 2009 08:52:12 -0400 Received: from mail-pz0-f203.google.com ([209.85.222.203]:55069) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MjukV-0006li-Sl for qemu-devel@nongnu.org; Sat, 05 Sep 2009 08:52:12 -0400 Received: by pzk41 with SMTP id 41so1483956pzk.4 for ; Sat, 05 Sep 2009 05:52:09 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <60cad3f0909041236hd0463d3hfc28f4b2c32275a1@mail.gmail.com> References: <1600c7720909020555i3a16970eq35e753b33ebf3f78@mail.gmail.com> <60cad3f0909021632n6e7528cam479720b74bb61c67@mail.gmail.com> <1600c7720909040258i2fa51f31g72dafb308ef90c25@mail.gmail.com> <60cad3f0909041236hd0463d3hfc28f4b2c32275a1@mail.gmail.com> Date: Sat, 5 Sep 2009 18:22:09 +0530 Message-ID: <1600c7720909050552o79921f32q1c91acbf299ee78b@mail.gmail.com> Subject: Re: [Qemu-devel] How does QEMU kernel receive any input events from host OS From: Amey Moghe Content-Type: multipart/alternative; boundary=000e0cd2dfdeb5c3730472d41503 List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Turner Cc: qemu-devel --000e0cd2dfdeb5c3730472d41503 Content-Type: text/plain; charset=ISO-8859-1 Hello, I have a clearer picture about VNC client/server now thanks to your mail. But how do we get access to guest OS screen via VNC server? In case of input to guest OS screen by user, does VNC server running in QEMU recognize that input event directly from host OS kernel via Xserver or is it handled by VNC server on its own? On Sat, Sep 5, 2009 at 1:06 AM, David Turner wrote: > I think you are confused about what clients/servers are in VNC. > > On Fri, Sep 4, 2009 at 2:58 AM, Amey Moghe wrote: > >> Hello, >> >> Thanks for the details.I understood how any input event is processed. >> But if I pressed a key in guest OS environment > > > You never "press a key in a guest OS environment", the guest doesn't have > access > to a real keyboard. > > >> then how does client >> i.e. guest OS ( with reference to VNC server ) come to know that it >> has to send key_event to VNC server? > > > The guest OS is not a VNC client at all. The qemu program implements a VNC > server, > that can be accessed from VNC clients running on the host, or even from > different machines, > but that is totally oblivious to the guest OS. > > A VNC Client is a standalone application, which generally converts user > input into RFB > protocol messages, which are then sent to the VNC server (running in QEMU), > which translates > them into emulated hardware i/o. The guest OS doesn't know if the user is > really using a > VNC client, the qemu SDL frontend, or anything else, it just believes there > was some hardware > activity. > > >> Does client through qemu, >> recognise it either from X server running on host OS (e.g. linux ) or >> directly from host OS's kernel ? >> >> > I don't really understand this question, but if you want to know how a > typical VNC client > translates a real user event into a VNC message sent to the server, you > should read the > RFB protocol specification. Try http://en.wikipedia.org/wiki/RFB_protocolfor a start. > > >> >> Thanks, >> Amey. >> >> On 9/3/09, David Turner wrote: >> > 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? >> > >> >> >> > --000e0cd2dfdeb5c3730472d41503 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hello,
I have a clearer picture about VNC client/server now thanks to your ma= il. But how do we get access to guest OS screen via VNC server? In case of = input to guest OS screen by user, does VNC server=A0running in QEMU recogni= ze that input event=A0directly from host OS kernel via Xserver or is it han= dled by VNC server on its own?=A0

On Sat, Sep 5, 2009 at 1:06 AM, David Turner <digit@google.com= > wrote:
I think you are confused about w= hat clients/servers are in VNC.

On Fri, Sep 4, 2009 at 2:58 AM, Amey Moghe <amey1288@gm= ail.com> wrote:
Hello,

Thanks= for the details.I understood how any input event is processed.
But if I= pressed a key in guest OS environment

You never "press a key in a guest OS environment", the g= uest doesn't have access
to a real keyboard.
=A0
then how does client=
i.e. guest OS ( with reference to VNC server ) =A0 come to know that it=
has to send key_event to VNC server?

The guest OS is not a VNC client at all. The qemu program implemen= ts a VNC server,
that can be accessed from VNC clients running on the ho= st, or even from different machines,
but that is totally oblivious to th= e guest OS.

A VNC Client is a standalone application, which generally converts user= input into RFB
protocol messages, which are then sent to the VNC server= (running in QEMU), which translates
them into emulated hardware i/o. Th= e guest OS doesn't know if the user is really using a
VNC client, the qemu SDL frontend, or anything else, it just believes there= was some hardware
activity.
=A0
Does client through = qemu,
recognise it either from X server running on host OS (e.g. linux )= or
directly from host OS's kernel ?


I don't really understand this question, but if you want to kn= ow how a typical VNC client
translates a real user event into a VNC mess= age sent to the server, you should read the
RFB protocol specification. = Try http://en.wikipedia.org/wiki/RFB_protocol for a start.
=A0

Thanks,
Amey.

On 9/3/09, David Turner <digit@google.com> wrote:
> 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. Ex= act details depend on which hardware you
> want to emulate.
> > For example, when emulating a PC with PS/2 keyboard and mouse, the cod= e in
> hw/ps2.c will be used.
>
> Here's a concrete e= xample:
>
> =A0 =A0- The VNC server receives packets from the c= lient (see
> =A0 =A0protocol_client_msg in vnc.c).
> =A0 =A0Some of them corr= espond to keyboard events (processed in key_event() in
> =A0 =A0the s= ame file),
> =A0 =A0which end up calling kbd_put_keycode() after tran= slating the VNC
> =A0 =A0keycode/state into
> =A0 =A0a different key scancode.
= >
>
> =A0 =A0- kbd_put_keycode() is defined in vl.c and call= s the hardware-specific
> =A0 =A0keycode translator.
>
><= br>> =A0 =A0- For PC emulation, this happens to be ps2_put_keycode() def= ined in
> =A0 =A0hw/ps2.c, and
> =A0 =A0registered at startup by ps2_kbd_i= nit() in the same file. It probably is
> =A0 =A0a different function<= br>> =A0 =A0for different emulated hardware.
>
>
> =A0= =A0- The implementation of ps2_put_keycode() will end up enqueue-ing a
> =A0 =A0keycode into
> =A0 =A0a queue then raising an IRQ.
>= ;
> =A0 =A0- The guest kernel responds to the IRQ by running its keyb= oard driver
> =A0 =A0code, the latter
> =A0 =A0will try to read= data from the PS/2 queue
>
>
> The SDL front-end receives user events differently, bu= t still ends up
> calling kbd_put_keycode().
> Same thing happe= ns for mouse events, and about anything that needs to
> emulate hardw= are
> (e.g. serial/usb/bluetooth/etc...) but implementations and specifics m= ay
> 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 do= es 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<= br> >> via
>> VNC. It can also use an emulated serial line, with= out any screen, with
>> applicable operating systems." on fol= lowing link :
>>
>> http://en.wikipedia.org/wiki/QEMU
>>
>> So please can anybodys tell me how does qemu use VNC s= erver 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?
>




--000e0cd2dfdeb5c3730472d41503--