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
nexedi
linux
Commits
360b52b0
Commit
360b52b0
authored
May 10, 2005
by
Greg KH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: add modalias sysfs file for usb devices
Signed-off-by:
Greg Kroah-Hartman
<
gregkh@suse.de
>
parent
25b6f08e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
drivers/usb/core/sysfs.c
drivers/usb/core/sysfs.c
+34
-0
No files found.
drivers/usb/core/sysfs.c
View file @
360b52b0
...
...
@@ -286,6 +286,39 @@ static ssize_t show_interface_string(struct device *dev, char *buf)
}
static
DEVICE_ATTR
(
interface
,
S_IRUGO
,
show_interface_string
,
NULL
);
static
ssize_t
show_modalias
(
struct
device
*
dev
,
char
*
buf
)
{
struct
usb_interface
*
intf
;
struct
usb_device
*
udev
;
intf
=
to_usb_interface
(
dev
);
udev
=
interface_to_usbdev
(
intf
);
if
(
udev
->
descriptor
.
bDeviceClass
==
0
)
{
struct
usb_host_interface
*
alt
=
intf
->
cur_altsetting
;
return
sprintf
(
buf
,
"usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X
\n
"
,
le16_to_cpu
(
udev
->
descriptor
.
idVendor
),
le16_to_cpu
(
udev
->
descriptor
.
idProduct
),
le16_to_cpu
(
udev
->
descriptor
.
bcdDevice
),
udev
->
descriptor
.
bDeviceClass
,
udev
->
descriptor
.
bDeviceSubClass
,
udev
->
descriptor
.
bDeviceProtocol
,
alt
->
desc
.
bInterfaceClass
,
alt
->
desc
.
bInterfaceSubClass
,
alt
->
desc
.
bInterfaceProtocol
);
}
else
{
return
sprintf
(
buf
,
"usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*
\n
"
,
le16_to_cpu
(
udev
->
descriptor
.
idVendor
),
le16_to_cpu
(
udev
->
descriptor
.
idProduct
),
le16_to_cpu
(
udev
->
descriptor
.
bcdDevice
),
udev
->
descriptor
.
bDeviceClass
,
udev
->
descriptor
.
bDeviceSubClass
,
udev
->
descriptor
.
bDeviceProtocol
);
}
}
static
DEVICE_ATTR
(
modalias
,
S_IRUGO
,
show_modalias
,
NULL
);
static
struct
attribute
*
intf_attrs
[]
=
{
&
dev_attr_bInterfaceNumber
.
attr
,
&
dev_attr_bAlternateSetting
.
attr
,
...
...
@@ -293,6 +326,7 @@ static struct attribute *intf_attrs[] = {
&
dev_attr_bInterfaceClass
.
attr
,
&
dev_attr_bInterfaceSubClass
.
attr
,
&
dev_attr_bInterfaceProtocol
.
attr
,
&
dev_attr_modalias
.
attr
,
NULL
,
};
static
struct
attribute_group
intf_attr_grp
=
{
...
...
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