Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2265588pxb; Fri, 8 Oct 2021 04:31:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWIx3rLuA6YdGy4ai6QDCk24FQk5rz2SZrrOh+uDSS989SnEQj8J9skoQ3TqHBGPf0QLJ3 X-Received: by 2002:a17:90a:de16:: with SMTP id m22mr11744391pjv.38.1633692706400; Fri, 08 Oct 2021 04:31:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633692706; cv=none; d=google.com; s=arc-20160816; b=pup0DjkGUihzwkjtFsCrbzao0nSyTKAQDV9HTQbPNymumKFKNeQ1RdxhUalGLkLLXc Rf+hVjT4IiHUtQbDNIf93pgCM073KZmaZixfTamuNZ1FKQtF2stQ+0ezYNlSmwLYDjze e6LrixfoQ+wYlcFeqJ02derfNj987CUis7ekc7etmOgF/8cNI/oVAYytPEqcY2YZKjok sUlmz9usvbAdT+edcG7MDSyXHShegFHTdlb41RWt92xEiOtHEgyxB+yFSzYbcq0B+TTD nYJfH9PhO7qsqZWVuWf+tc0wGu3z/hsXeRKjuDq+OWtttcUD+Dj+cnTOuzean6Z9I29F 9Jgw== 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=Zk1zXiiPcIvDXuO8QdSSyApfmUYrdZBDANzdpF08cdNUwu1HbA9pO3yktvJ+LV8woA hlpviKMx6tNpgDNicXbU2AgBuYT9AehXz/WBk5mQxI44zsHWDqYC02yjDR+j8+mSuYcu Hd/JXsDoUrgy9FzaE4FSO++j0rFOxyh6FhQPYjO0ZL2q473URvl8XLwzQFaQZhxYwOqu yAYWaD+dEx734lNmDk5rwv0og8lfxU5Tv++yt0qcueI6b6mE8NGN54Q3CcZqBekGIJQM mecrqt6/VH8RPWkglqyjdixE+Eebdz5ZFBs9QouFgZ8NUQHACDl334jHq8v+3pwSHnRU CFDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p57p5Z2i; 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 u9si2881388pjd.146.2021.10.08.04.31.32; Fri, 08 Oct 2021 04:31:46 -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=p57p5Z2i; 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 S241000AbhJHLcf (ORCPT + 99 others); Fri, 8 Oct 2021 07:32:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:59312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240824AbhJHLb0 (ORCPT ); Fri, 8 Oct 2021 07:31:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2591B610E7; Fri, 8 Oct 2021 11:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633692547; bh=g4j72Mh0bdT8fhD8A5kB7UcOUznHv2SleGFFDzh1U20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p57p5Z2i3ln//yznDea0mm6OHhJVlhqR6/lKSerpjwk3Ac/i3IIfha+z6KlKMPVWJ PD5cTU8iJBY9cLaANZSS1qLKKHGaerjFCKcEGfohmJs6z4lp82EFjf0zH04PijBy6T PQcn18L+KWzF4WWlR5HAVNfD0kwtAQm+Y5XPn30Y= 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.9 7/8] usb: testusb: Fix for showing the connection speed Date: Fri, 8 Oct 2021 13:27:44 +0200 Message-Id: <20211008112714.189216807@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211008112713.941269121@linuxfoundation.org> References: <20211008112713.941269121@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