|
From: | Mark Cave-Ayland |
Subject: | Re: [PATCH 6/9] dev-serial: add always-plugged property to ensure USB device is always attached |
Date: | Tue, 27 Oct 2020 13:23:17 +0000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 |
On 27/10/2020 08:09, Gerd Hoffmann wrote:
case CHR_EVENT_OPENED: - if (!s->dev.attached) { + if (!s->always_plugged && !s->dev.attached) { usb_device_attach(&s->dev, &error_abort); }Not needed (but doesn't hurt either).
Okay I'll leave this as-is for now.
break; case CHR_EVENT_CLOSED: - if (s->dev.attached) { + if (!s->always_plugged && s->dev.attached) { usb_device_detach(&s->dev); }Ok.- if (qemu_chr_fe_backend_open(&s->cs) && !dev->attached) { + if (s->always_plugged || (qemu_chr_fe_backend_open(&s->cs) && + !dev->attached)) {The dev->attached check should not be skipped, i.e. the logic should be ((always_plugged || open) && !attached).
Let me test this, and if it works I'll post a v2 shortly. ATB, Mark.
[Prev in Thread] | Current Thread | [Next in Thread] |