From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14DB9C2D0A3 for ; Mon, 26 Oct 2020 09:56:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8799522202 for ; Mon, 26 Oct 2020 09:56:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8799522202 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kWzF9-0000CK-GI for qemu-devel@archiver.kernel.org; Mon, 26 Oct 2020 05:56:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kWzDP-0007D2-0Q for qemu-devel@nongnu.org; Mon, 26 Oct 2020 05:55:00 -0400 Received: from hera.aquilenet.fr ([2a0c:e300::1]:56148) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kWzDM-0002Oh-SH for qemu-devel@nongnu.org; Mon, 26 Oct 2020 05:54:58 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id C2C5C4D8; Mon, 26 Oct 2020 10:54:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rPMM-2TPad2p; Mon, 26 Oct 2020 10:54:52 +0100 (CET) Received: from function (lfbn-bor-1-56-204.w90-50.abo.wanadoo.fr [90.50.148.204]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 0F7ABB8; Mon, 26 Oct 2020 10:54:52 +0100 (CET) Received: from samy by function with local (Exim 4.94) (envelope-from ) id 1kWzDG-006iJc-W1; Mon, 26 Oct 2020 10:54:51 +0100 Date: Mon, 26 Oct 2020 10:54:50 +0100 From: Samuel Thibault To: Mark Cave-Ayland , Aurelien Jarno , Jason Andryuk Subject: Re: [PATCH 8/9] dev-serial: fix FTDI_GET_MDM_ST response Message-ID: <20201026095450.ko6snc4dusk3pvnw@function> References: <20201026083401.13231-1-mark.cave-ayland@ilande.co.uk> <20201026083401.13231-9-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201026083401.13231-9-mark.cave-ayland@ilande.co.uk> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) Received-SPF: softfail client-ip=2a0c:e300::1; envelope-from=samuel.thibault@gnu.org; helo=hera.aquilenet.fr X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, kraxel@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Hello, (Cc-ing Aurelien who introduced the support for modem control, and Jason who added the missing THRE and TEMT flags). Mark Cave-Ayland, le lun. 26 oct. 2020 08:34:00 +0000, a ecrit: > The FTDI_GET_MDM_ST response should only return a single byte indicating the > modem status with bit 0 cleared (as documented in the Linux ftdi_sio.h header > file). > > Signed-off-by: Mark Cave-Ayland > --- > hw/usb/dev-serial.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c > index 4c374d0790..fa734bcf54 100644 > --- a/hw/usb/dev-serial.c > +++ b/hw/usb/dev-serial.c > @@ -360,9 +360,8 @@ static void usb_serial_handle_control(USBDevice *dev, USBPacket *p, > /* TODO: TX ON/OFF */ > break; > case VendorDeviceRequest | FTDI_GET_MDM_ST: > - data[0] = usb_get_modem_lines(s) | 1; > - data[1] = FTDI_THRE | FTDI_TEMT; > - p->actual_length = 2; > + data[0] = usb_get_modem_lines(s); > + p->actual_length = 1; Err, but Linux' drivers/usb/serial/ftdi_sio.c:ftdi_process_packet() contradicts this: if (len < 2) { dev_dbg(&port->dev, "malformed packet\n"); return 0; } status = buf[0] & FTDI_STATUS_B0_MASK; if (status != priv->prev_status) { char diff_status = status ^ priv->prev_status; if (diff_status & FTDI_RS0_CTS) port->icount.cts++; [...] /* save if the transmitter is empty or not */ if (buf[1] & FTDI_RS_TEMT) priv->transmit_empty = 1; else priv->transmit_empty = 0; Did you actually get an issue with seeing this packet contain two bytes? Samuel