From patchwork Thu Jan 4 15:01:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10144893 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5963160329 for ; Thu, 4 Jan 2018 15:02:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C129286BF for ; Thu, 4 Jan 2018 15:02:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40DDD286CA; Thu, 4 Jan 2018 15:02:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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 mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C7E09286FB for ; Thu, 4 Jan 2018 15:02:58 +0000 (UTC) Received: from localhost ([::1]:41295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eX72n-00085x-ED for patchwork-qemu-devel@patchwork.kernel.org; Thu, 04 Jan 2018 10:02:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eX71k-0007DM-VN for qemu-devel@nongnu.org; Thu, 04 Jan 2018 10:02:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eX71O-0003MD-PP for qemu-devel@nongnu.org; Thu, 04 Jan 2018 10:01:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45154) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eX71O-0003Kx-K8 for qemu-devel@nongnu.org; Thu, 04 Jan 2018 10:01:30 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A142725BB2; Thu, 4 Jan 2018 15:01:29 +0000 (UTC) Received: from [10.33.192.189] (dhcp-192-189.str.redhat.com [10.33.192.189]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F7335DA5B; Thu, 4 Jan 2018 15:01:25 +0000 (UTC) To: Samuel Thibault References: <1515068847-20311-1-git-send-email-thuth@redhat.com> <20180104132600.ikr4migzznhantmt@var.youpi.perso.aquilenet.fr> <8590ff50-6b1a-c85f-c9fb-a70ebf8132b5@redhat.com> <20180104142356.6hoar52jcoxrobgn@var.youpi.perso.aquilenet.fr> From: Thomas Huth Message-ID: Date: Thu, 4 Jan 2018 16:01:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180104142356.6hoar52jcoxrobgn@var.youpi.perso.aquilenet.fr> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 04 Jan 2018 15:01:29 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [PATCH] usb: Remove legacy -usbdevice option 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: Paolo Bonzini , kraxel@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 04.01.2018 15:23, Samuel Thibault wrote: > Thomas Huth, on jeu. 04 janv. 2018 15:22:25 +0100, wrote: >> On 04.01.2018 14:26, Samuel Thibault wrote: >> I think it's more common to not do any magic default setup with >> "-device", but if you think this should be the case here, it can >> certainly be added again > > Yes, please: it will almost never be used differently than with just a > fresh braille chardev. It's pretty much untested, but would a patch like this help? Thomas diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -556,6 +556,19 @@ static const TypeInfo serial_info = { .class_init = usb_serial_class_initfn, }; +static void usb_braille_realize(USBDevice *dev, Error **errp) +{ + USBSerialState *uss = USB_SERIAL_DEV(dev); + + if (!qemu_chr_fe_backend_connected(&uss->cs)) { + /* Create a default braille chardev if user did not specify one */ + Chardev *cdrv = qemu_chr_new("braille", "braille"); + qdev_prop_set_chr(&dev->qdev, "chardev", cdrv); + } + + usb_serial_realize(dev, errp); +} + static Property braille_properties[] = { DEFINE_PROP_CHR("chardev", USBSerialState, cs), DEFINE_PROP_END_OF_LIST(), @@ -568,6 +581,7 @@ static void usb_braille_class_initfn(ObjectClass *klass, void *data) uc->product_desc = "QEMU USB Braille"; uc->usb_desc = &desc_braille; + uc->realize = usb_braille_realize; dc->props = braille_properties; }