Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
6370591e
Commit
6370591e
authored
Oct 08, 2002
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
USB: add device speed driverfs file.
parent
f87424fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
drivers/usb/core/driverfs.c
drivers/usb/core/driverfs.c
+29
-0
No files found.
drivers/usb/core/driverfs.c
View file @
6370591e
...
...
@@ -99,6 +99,34 @@ show_serial (struct device *dev, char *buf, size_t count, loff_t off)
}
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 @@ void usb_create_driverfs_dev_files (struct usb_device *udev)
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment