diff options
author | David Brownell <david-b@pacbell.net> | 2006-12-13 16:07:10 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-07 18:44:33 -0500 |
commit | 2360e4aa64da412c29136113f8050b6aa9e757b8 (patch) | |
tree | 78489a2c0166a6a65c8ef78498475249a1e92355 | |
parent | 316547fdfae1be3847add6a18a711703e6d5ebc1 (diff) |
USB: indicate active altsetting in proc/bus/usb/devices file
Update /proc/bus/usb/devices output to report active altsettings.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | Documentation/usb/proc_usb_info.txt | 21 | ||||
-rw-r--r-- | drivers/usb/core/devices.c | 8 |
2 files changed, 17 insertions, 12 deletions
diff --git a/Documentation/usb/proc_usb_info.txt b/Documentation/usb/proc_usb_info.txt index 22c5331260ca..077e9032d0cd 100644 --- a/Documentation/usb/proc_usb_info.txt +++ b/Documentation/usb/proc_usb_info.txt | |||
@@ -213,15 +213,16 @@ C:* #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA | |||
213 | 213 | ||
214 | Interface descriptor info (can be multiple per Config): | 214 | Interface descriptor info (can be multiple per Config): |
215 | 215 | ||
216 | I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss | 216 | I:* If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss |
217 | | | | | | | | |__Driver name | 217 | | | | | | | | | |__Driver name |
218 | | | | | | | | or "(none)" | 218 | | | | | | | | | or "(none)" |
219 | | | | | | | |__InterfaceProtocol | 219 | | | | | | | | |__InterfaceProtocol |
220 | | | | | | |__InterfaceSubClass | 220 | | | | | | | |__InterfaceSubClass |
221 | | | | | |__InterfaceClass | 221 | | | | | | |__InterfaceClass |
222 | | | | |__NumberOfEndpoints | 222 | | | | | |__NumberOfEndpoints |
223 | | | |__AlternateSettingNumber | 223 | | | | |__AlternateSettingNumber |
224 | | |__InterfaceNumber | 224 | | | |__InterfaceNumber |
225 | | |__ "*" indicates the active altsetting (others are " ") | ||
225 | |__Interface info tag | 226 | |__Interface info tag |
226 | 227 | ||
227 | A given interface may have one or more "alternate" settings. | 228 | 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 | on how to do this.) | 278 | on how to do this.) |
278 | 279 | ||
279 | The Interface lines can be used to determine what driver is | 280 | The Interface lines can be used to determine what driver is |
280 | being used for each device. | 281 | being used for each device, and which altsetting it activated. |
281 | 282 | ||
282 | The Configuration lines could be used to list maximum power | 283 | The Configuration lines could be used to list maximum power |
283 | (in milliamps) that a system's USB devices are using. | 284 | (in milliamps) that a system's USB devices are using. |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index ea398e5d50af..1ff429c37d52 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -104,7 +104,7 @@ static const char *format_config = | |||
104 | 104 | ||
105 | static const char *format_iface = | 105 | static const char *format_iface = |
106 | /* I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=xxxx*/ | 106 | /* I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=xxxx*/ |
107 | "I: If#=%2d Alt=%2d #EPs=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x Driver=%s\n"; | 107 | "I:%c If#=%2d Alt=%2d #EPs=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x Driver=%s\n"; |
108 | 108 | ||
109 | static const char *format_endpt = | 109 | static const char *format_endpt = |
110 | /* E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=D?s */ | 110 | /* 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 | { | 242 | { |
243 | const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc; | 243 | const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc; |
244 | const char *driver_name = ""; | 244 | const char *driver_name = ""; |
245 | int active = 0; | ||
245 | 246 | ||
246 | if (start > end) | 247 | if (start > end) |
247 | return start; | 248 | return start; |
248 | down_read(&usb_bus_type.subsys.rwsem); | 249 | down_read(&usb_bus_type.subsys.rwsem); |
249 | if (iface) | 250 | if (iface) { |
250 | driver_name = (iface->dev.driver | 251 | driver_name = (iface->dev.driver |
251 | ? iface->dev.driver->name | 252 | ? iface->dev.driver->name |
252 | : "(none)"); | 253 | : "(none)"); |
254 | active = (desc == &iface->cur_altsetting->desc); | ||
255 | } | ||
253 | start += sprintf(start, format_iface, | 256 | start += sprintf(start, format_iface, |
257 | active ? '*' : ' ', /* mark active altsetting */ | ||
254 | desc->bInterfaceNumber, | 258 | desc->bInterfaceNumber, |
255 | desc->bAlternateSetting, | 259 | desc->bAlternateSetting, |
256 | desc->bNumEndpoints, | 260 | desc->bNumEndpoints, |