From patchwork Wed Jul 12 15:41:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 787039 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x6rD62VqSz9s7g for ; Wed, 12 Jul 2017 17:28:54 +1000 (AEST) Received: from localhost ([::1]:50811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVC4q-0007CV-84 for incoming@patchwork.ozlabs.org; Wed, 12 Jul 2017 03:28:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVC4X-0007C4-4f for qemu-devel@nongnu.org; Wed, 12 Jul 2017 03:28:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVC4U-0003kd-1j for qemu-devel@nongnu.org; Wed, 12 Jul 2017 03:28:33 -0400 Received: from out1.zte.com.cn ([202.103.147.172]:47577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVC4T-0003Hy-BB for qemu-devel@nongnu.org; Wed, 12 Jul 2017 03:28:29 -0400 X-scanvirus: By SEG_CYREN AntiVirus Engine X-scanresult: CLEAN X-MAILFROM: X-RCPTTO: X-FROMIP: 10.30.3.20 X-SEG-Scaned: 1 X-Received: unknown,10.30.3.20,20170712152750 Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 12 Jul 2017 07:27:50 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v6C7Rei4015701; Wed, 12 Jul 2017 15:27:40 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017071215274415-3749814 ; Wed, 12 Jul 2017 15:27:44 +0800 From: Peng Hao To: pbonzini@redhat.com, marcandre.lureau@redhat.com Date: Wed, 12 Jul 2017 23:41:59 +0800 Message-Id: <1499874119-67558-1-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-07-12 15:27:44, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-07-12 15:27:32, Serialize complete at 2017-07-12 15:27:32 X-MAIL: mse01.zte.com.cn v6C7Rei4015701 X-HQIP: 127.0.0.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 202.103.147.172 Subject: [Qemu-devel] [PATCH V3] chardev: fix parallel device can't be reconnect X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jiang.biao2@zte.com.cn, Peng Hao , wang.yechao255@zte.com.cn, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Parallel device don't register be->chr_can_read function, but remote disconnect event is handled in chr_read.So connected parallel device can not detect remote disconnect event. The chardevs with chr_can_read=NULL has the same problem. Signed-off-by: Peng Hao Reviewed-by: Wang Yechao Reviewed-by: Jiang Biao --- hw/char/parallel.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/char/parallel.c b/hw/char/parallel.c index 75a1a2f..b33bbb8 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -503,6 +503,10 @@ static const VMStateDescription vmstate_parallel_isa = { } }; +static int parallel_can_receive(void *opaque) +{ + return 1; +} static void parallel_isa_realizefn(DeviceState *dev, Error **errp) { @@ -535,6 +539,8 @@ static void parallel_isa_realizefn(DeviceState *dev, Error **errp) isa_init_irq(isadev, &s->irq, isa->isairq); qemu_register_reset(parallel_reset, s); + qemu_chr_fe_set_handlers(&s->chr, parallel_can_receive, NULL, + NULL, s, NULL, true); if (qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_PP_READ_STATUS, &dummy) == 0) { s->hw_driver = 1; s->status = dummy;