Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2264699pxb; Fri, 8 Oct 2021 04:30:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdUj9G3CFXSr3cPMO9onFZelBqGwOkeO8dg89swn2uumfm9mvKx7JBYSu3TWzqoAzMSNZK X-Received: by 2002:a17:902:b18b:b0:13a:354a:3e9d with SMTP id s11-20020a170902b18b00b0013a354a3e9dmr9001748plr.36.1633692634731; Fri, 08 Oct 2021 04:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633692634; cv=none; d=google.com; s=arc-20160816; b=zmA5gyDaD5w64nuR2n+KB+EaI49zAX+jaDt/Nn3s/qzNDxdiEzPr8qBa6/wVB5UGi3 bf9h++cHVabM0OsguAsQxj+ljwS8oeFZMcauRJuH/S/9ulOouB8tqVIgnmyjhdbXGO0+ VQB+qTyKw5TDgWPpN0HdqXRE4N0DFMGpYkT+GVsqdAvqDI9zv40EaRGof9HfipAAg9Cw kE8CcQ/aeeniCE9xMydr2b7haDl1zoLL0pTV1orXKuuKhV8RVgZRWyZ5yQWVX/8Ca6n8 5F9qrvONMVgQJ6GNCRNOnA11zKkAObvo/cX/psPm3hahhQpfDM/UI80nVUB8CxcblENr 95ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h74lz8O+UnuX14wbUC3zRpk+OOaHIl6aelYIbhrSD9U=; b=FT6s61p88iOqGZEfisolSKm6ksLxnSEqfm1Xp4FRDdtYWcUN37RxMkEYWJt6uS6GoY 2NY6qpDiHZho1q3u7lwKbEqumJeF5il6ICdjNwVkBZpFFgY7zpmNZDwVTftw4HcKyI4H jn5D5uwiK/fWJ5p42E8HLsTfXBKmpnW7fjBxIk0Rsiw/Du2auYHf+PS9qa9vV1DeR6MF EQtsIyB4LJvbhNPsZV8o3Da0jI1fxJ36emdNUzQHshjwdXRUvgWAQMGNbMwTn0GMfo7/ IbBXaw0ibvrCJnelT8i/QaYqkcZcvn5s/5HbKwPR7pGcbYxFOhxwdjp7IJBZu7dGGEra +vzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N4E+QPFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n24si24113079pfj.98.2021.10.08.04.30.16; Fri, 08 Oct 2021 04:30:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N4E+QPFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240344AbhJHLbR (ORCPT + 99 others); Fri, 8 Oct 2021 07:31:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:58110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240468AbhJHLan (ORCPT ); Fri, 8 Oct 2021 07:30:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 934A161040; Fri, 8 Oct 2021 11:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633692528; bh=g4j72Mh0bdT8fhD8A5kB7UcOUznHv2SleGFFDzh1U20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N4E+QPFlicEmH84+pcn2PcUFQIA7ONZkBTMMsNec287eAI6ob7d+K45rIEcJXcQBL Qtxmg0pRBXGCfY3yHRrrU7e8VSYButGaIxVuIWKiVw5TBohULNHlStINtsTDWTwTLs zTGbGYNal1ucP0kVzsib02KNpKBJJW1uduTz56ys= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Faizel K B , Sasha Levin Subject: [PATCH 4.4 6/7] usb: testusb: Fix for showing the connection speed Date: Fri, 8 Oct 2021 13:27:38 +0200 Message-Id: <20211008112713.718332587@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211008112713.515980393@linuxfoundation.org> References: <20211008112713.515980393@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Faizel K B [ Upstream commit f81c08f897adafd2ed43f86f00207ff929f0b2eb ] testusb' application which uses 'usbtest' driver reports 'unknown speed' from the function 'find_testdev'. The variable 'entry->speed' was not updated from the application. The IOCTL mentioned in the FIXME comment can only report whether the connection is low speed or not. Speed is read using the IOCTL USBDEVFS_GET_SPEED which reports the proper speed grade. The call is implemented in the function 'handle_testdev' where the file descriptor was availble locally. Sample output is given below where 'high speed' is printed as the connected speed. sudo ./testusb -a high speed /dev/bus/usb/001/011 0 /dev/bus/usb/001/011 test 0, 0.000015 secs /dev/bus/usb/001/011 test 1, 0.194208 secs /dev/bus/usb/001/011 test 2, 0.077289 secs /dev/bus/usb/001/011 test 3, 0.170604 secs /dev/bus/usb/001/011 test 4, 0.108335 secs /dev/bus/usb/001/011 test 5, 2.788076 secs /dev/bus/usb/001/011 test 6, 2.594610 secs /dev/bus/usb/001/011 test 7, 2.905459 secs /dev/bus/usb/001/011 test 8, 2.795193 secs /dev/bus/usb/001/011 test 9, 8.372651 secs /dev/bus/usb/001/011 test 10, 6.919731 secs /dev/bus/usb/001/011 test 11, 16.372687 secs /dev/bus/usb/001/011 test 12, 16.375233 secs /dev/bus/usb/001/011 test 13, 2.977457 secs /dev/bus/usb/001/011 test 14 --> 22 (Invalid argument) /dev/bus/usb/001/011 test 17, 0.148826 secs /dev/bus/usb/001/011 test 18, 0.068718 secs /dev/bus/usb/001/011 test 19, 0.125992 secs /dev/bus/usb/001/011 test 20, 0.127477 secs /dev/bus/usb/001/011 test 21 --> 22 (Invalid argument) /dev/bus/usb/001/011 test 24, 4.133763 secs /dev/bus/usb/001/011 test 27, 2.140066 secs /dev/bus/usb/001/011 test 28, 2.120713 secs /dev/bus/usb/001/011 test 29, 0.507762 secs Signed-off-by: Faizel K B Link: https://lore.kernel.org/r/20210902114444.15106-1-faizel.kb@dicortech.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- tools/usb/testusb.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c index 0692d99b6d8f..18c895654e76 100644 --- a/tools/usb/testusb.c +++ b/tools/usb/testusb.c @@ -278,12 +278,6 @@ nomem: } entry->ifnum = ifnum; - - /* FIXME update USBDEVFS_CONNECTINFO so it tells about high speed etc */ - - fprintf(stderr, "%s speed\t%s\t%u\n", - speed(entry->speed), entry->name, entry->ifnum); - entry->next = testdevs; testdevs = entry; return 0; @@ -312,6 +306,14 @@ static void *handle_testdev (void *arg) return 0; } + status = ioctl(fd, USBDEVFS_GET_SPEED, NULL); + if (status < 0) + fprintf(stderr, "USBDEVFS_GET_SPEED failed %d\n", status); + else + dev->speed = status; + fprintf(stderr, "%s speed\t%s\t%u\n", + speed(dev->speed), dev->name, dev->ifnum); + restart: for (i = 0; i < TEST_CASES; i++) { if (dev->test != -1 && dev->test != i) -- 2.33.0