Commit 2360e4aa authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

USB: indicate active altsetting in proc/bus/usb/devices file

Update /proc/bus/usb/devices output to report active altsettings.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 316547fd
...@@ -213,15 +213,16 @@ C:* #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA ...@@ -213,15 +213,16 @@ C:* #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA
Interface descriptor info (can be multiple per Config): Interface descriptor info (can be multiple per Config):
I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss I:* If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss
| | | | | | | |__Driver name | | | | | | | | |__Driver name
| | | | | | | or "(none)" | | | | | | | | or "(none)"
| | | | | | |__InterfaceProtocol | | | | | | | |__InterfaceProtocol
| | | | | |__InterfaceSubClass | | | | | | |__InterfaceSubClass
| | | | |__InterfaceClass | | | | | |__InterfaceClass
| | | |__NumberOfEndpoints | | | | |__NumberOfEndpoints
| | |__AlternateSettingNumber | | | |__AlternateSettingNumber
| |__InterfaceNumber | | |__InterfaceNumber
| |__ "*" indicates the active altsetting (others are " ")
|__Interface info tag |__Interface info tag
A given interface may have one or more "alternate" settings. A given interface may have one or more "alternate" settings.
...@@ -277,7 +278,7 @@ of the USB devices on a system's root hub. (See more below ...@@ -277,7 +278,7 @@ of the USB devices on a system's root hub. (See more below
on how to do this.) on how to do this.)
The Interface lines can be used to determine what driver is The Interface lines can be used to determine what driver is
being used for each device. being used for each device, and which altsetting it activated.
The Configuration lines could be used to list maximum power The Configuration lines could be used to list maximum power
(in milliamps) that a system's USB devices are using. (in milliamps) that a system's USB devices are using.
......
...@@ -104,7 +104,7 @@ static const char *format_config = ...@@ -104,7 +104,7 @@ static const char *format_config =
static const char *format_iface = static const char *format_iface =
/* I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=xxxx*/ /* I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=xxxx*/
"I: If#=%2d Alt=%2d #EPs=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x Driver=%s\n"; "I:%c If#=%2d Alt=%2d #EPs=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x Driver=%s\n";
static const char *format_endpt = static const char *format_endpt =
/* E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=D?s */ /* E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=D?s */
...@@ -242,15 +242,19 @@ static char *usb_dump_interface_descriptor(char *start, char *end, ...@@ -242,15 +242,19 @@ static char *usb_dump_interface_descriptor(char *start, char *end,
{ {
const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc; const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc;
const char *driver_name = ""; const char *driver_name = "";
int active = 0;
if (start > end) if (start > end)
return start; return start;
down_read(&usb_bus_type.subsys.rwsem); down_read(&usb_bus_type.subsys.rwsem);
if (iface) if (iface) {
driver_name = (iface->dev.driver driver_name = (iface->dev.driver
? iface->dev.driver->name ? iface->dev.driver->name
: "(none)"); : "(none)");
active = (desc == &iface->cur_altsetting->desc);
}
start += sprintf(start, format_iface, start += sprintf(start, format_iface,
active ? '*' : ' ', /* mark active altsetting */
desc->bInterfaceNumber, desc->bInterfaceNumber,
desc->bAlternateSetting, desc->bAlternateSetting,
desc->bNumEndpoints, desc->bNumEndpoints,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment