All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] How does QEMU kernel receive any input events from host OS
@ 2009-09-02 12:55 Amey Moghe
  2009-09-02 23:32 ` David Turner
  0 siblings, 1 reply; 5+ messages in thread
From: Amey Moghe @ 2009-09-02 12:55 UTC (permalink / raw)
  To: qemu-devel

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

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: 702 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] How does QEMU kernel receive any input events from host OS
  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
  2009-09-04  9:58   ` Amey Moghe
  0 siblings, 1 reply; 5+ messages in thread
From: David Turner @ 2009-09-02 23:32 UTC (permalink / raw)
  To: Amey Moghe; +Cc: qemu-devel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] How does QEMU kernel receive any input events from host OS
  2009-09-02 23:32 ` David Turner
@ 2009-09-04  9:58   ` Amey Moghe
  2009-09-04 19:36     ` David Turner
  0 siblings, 1 reply; 5+ messages in thread
From: Amey Moghe @ 2009-09-04  9:58 UTC (permalink / raw)
  To: David Turner; +Cc: qemu-devel

Hello,

Thanks for the details.I understood how any input event is processed.
But if I pressed a key in guest OS environment 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? Does client through qemu,
recognise it either from X server running on host OS (e.g. linux ) or
directly from host OS's kernel ?


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] How does QEMU kernel receive any input events from host OS
  2009-09-04  9:58   ` Amey Moghe
@ 2009-09-04 19:36     ` David Turner
  2009-09-05 12:52       ` Amey Moghe
  0 siblings, 1 reply; 5+ messages in thread
From: David Turner @ 2009-09-04 19:36 UTC (permalink / raw)
  To: Amey Moghe; +Cc: qemu-devel

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

I think you are confused about what clients/servers are in VNC.

On Fri, Sep 4, 2009 at 2:58 AM, Amey Moghe <amey1288@gmail.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 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 <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. 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: 5728 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] How does QEMU kernel receive any input events from host OS
  2009-09-04 19:36     ` David Turner
@ 2009-09-05 12:52       ` Amey Moghe
  0 siblings, 0 replies; 5+ messages in thread
From: Amey Moghe @ 2009-09-05 12:52 UTC (permalink / raw)
  To: David Turner; +Cc: qemu-devel

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

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 <digit@google.com> wrote:

> I think you are confused about what clients/servers are in VNC.
>
>  On Fri, Sep 4, 2009 at 2:58 AM, Amey Moghe <amey1288@gmail.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 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 <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. 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: 6436 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-09-05 12:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2009-09-04  9:58   ` Amey Moghe
2009-09-04 19:36     ` David Turner
2009-09-05 12:52       ` Amey Moghe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.