mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-usb-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] USB and driver core changes for 2.5.41
Date: Tue, 8 Oct 2002 16:20:32 -0700	[thread overview]
Message-ID: <20021008232032.GH11337@kroah.com> (raw)
In-Reply-To: <20021008231957.GG11337@kroah.com>

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.573.92.18 -> 1.573.92.19
#	drivers/usb/core/driverfs.c	1.1     -> 1.2    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/08	greg@kroah.com	1.573.92.19
# USB: add device speed driverfs file.
# --------------------------------------------
#
diff -Nru a/drivers/usb/core/driverfs.c b/drivers/usb/core/driverfs.c
--- a/drivers/usb/core/driverfs.c	Tue Oct  8 15:53:35 2002
+++ b/drivers/usb/core/driverfs.c	Tue Oct  8 15:53:35 2002
@@ -99,6 +99,34 @@
 }
 static DEVICE_ATTR(serial,S_IRUGO,show_serial,NULL);
 
+static ssize_t
+show_speed (struct device *dev, char *buf, size_t count, loff_t off)
+{
+	struct usb_device *udev;
+	char *speed;
+
+	if (off)
+		return 0;
+	udev = to_usb_device (dev);
+
+	switch (udev->speed) {
+	case USB_SPEED_LOW:
+		speed = "1.5";
+		break;
+	case USB_SPEED_UNKNOWN:
+	case USB_SPEED_FULL:
+		speed = "12";
+		break;
+	case USB_SPEED_HIGH:
+		speed = "480";
+		break;
+	default:
+		speed = "unknown";
+	}
+	return sprintf (buf, "%s\n", speed);
+}
+static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL);
+
 /* Descriptor fields */
 #define usb_descriptor_attr(field, format_string)			\
 static ssize_t								\
@@ -136,6 +164,7 @@
 	device_create_file (dev, &dev_attr_bDeviceClass);
 	device_create_file (dev, &dev_attr_bDeviceSubClass);
 	device_create_file (dev, &dev_attr_bDeviceProtocol);
+	device_create_file (dev, &dev_attr_speed);
 
 	if (udev->descriptor.iManufacturer)
 		device_create_file (dev, &dev_attr_manufacturer);

  reply	other threads:[~2002-10-08 23:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-08 23:15 [BK PATCH] " Greg KH
2002-10-08 23:15 ` [PATCH] " Greg KH
2002-10-08 23:16   ` Greg KH
2002-10-08 23:17     ` Greg KH
2002-10-08 23:18       ` Greg KH
2002-10-08 23:19         ` Greg KH
2002-10-08 23:19           ` Greg KH
2002-10-08 23:20             ` Greg KH [this message]
2002-10-08 23:21               ` Greg KH
2002-10-10 11:54         ` Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021008232032.GH11337@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®