qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] quick pointer on adding a new chardev


From: Peter Maydell
Subject: Re: [Qemu-discuss] quick pointer on adding a new chardev
Date: Tue, 21 Feb 2017 09:55:34 +0000

On 20 February 2017 at 23:21, Herb Peyerl <address@hidden> wrote:
> Thanks for the explanation.  I was away for the weekend so I’m back digging 
> into this now.  I think I understand better now.
>
> Based on your explanation, this seems to do something though I’m not quite 
> sure if it’s the right thing:
>
>         -chardev socket,host=192.168.1.1,port=4555,id=foo0 \
>         -global myfoo.chardev=foo0

This command line is saying "command line processing code,
please create the chardev"...

> In my code I did:
>
> s->chr=qemu_chr_alloc();

...but this allocation is creating a chardev itself
(and probably a weirdly unconfigured one).

(qemu_chr_alloc() doesn't exist in current QEMU.)


You need to create a property for your device which will say
"my property 'chardev' corresponds to s->chr in my struct".
(You probably already have this code or the command line above
wouldn't work I think.)

Then in your 'realize' function, if s->chr is NULL then the
user didn't specify the chardev on the command line. Otherwise
it should be a properly initialized chardev you can use
(add your receive handlers to, call functions to send on, etc).

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]