qemu-devel
[Top][All Lists]
Advanced

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

Re: Difficulty making usb-serial device visible within the guest


From: Mark Cave-Ayland
Subject: Re: Difficulty making usb-serial device visible within the guest
Date: Thu, 20 Aug 2020 10:14:14 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 20/08/2020 09:15, Gerd Hoffmann wrote:

>> With auto-attach disabled this effectively prevents the device from
>> attaching to the USB unless the chardev is opened which feels odd.
> 
> Why?  It's not needed to connect at boot btw, the device will be
> hotplugged if the chardev is opened.

Yes, I see that - however...

>> I would expect that if I add a device to QEMU using -device then it is
>> immediately visible in the guest, and if the chardev isn't connected
>> then the device should report its status as disconnected as you would
>> expect with a real USB to RS232 adapter.
> 
> Huh?  How would that work?  You can do some guesswork using modem line
> status etc, but as far I know _reliable_ connected/disconnected
> reporting simply doesn't exist in the world of serial lines ...

I'm just comparing the behaviour with a real FTDI adapter: if I plug it in, it's
always visible on the guest USB regardless as to whether there is a cable 
attached -
the line status is returned as it is seen on the wire. Whether the guest OS has 
a
concept as to whether a cable is attached is something that is internal to the
driver, and completely separate from QEMU's notion as to whether a chardev is 
attached.

For someone who has a reasonable amount of QEMU development experience I was 
just
surprised that I ended up having to going through the source code to understand 
why
my usb-serial device wasn't appearing in the guest. Certainly there is no 
mention of
this requirement in the QEMU documentation.

Something else I noticed was that this behaviour is unique to USB: in-built 
serial
ports behave exactly as I described above which matches the real FTDI USB 
hardware.
And another question: if this behaviour is acceptable for USB, should it not be 
the
same for other hotplug buses, e.g. should a PCIe serial card plugged into a 
PCIe bus
plug and unplug itself as the chardev is attached/detached in a similar way?


ATB,

Mark.



reply via email to

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