* Add alternate interface printing to usb_dev_info, which is now pretty straight
forward using the new USBKit interface. * Make the output indents a bit more natural and wider to make things more readable. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27410 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
89dda28052
commit
9de98b30cf
|
@ -3,7 +3,7 @@
|
|||
* Copyright 2000, Be Incorporated. All rights reserved.
|
||||
*
|
||||
* Modified for Haiku by François Revol and Michael Lotz.
|
||||
* Copyright 2007, Haiku Inc. All rights reserved.
|
||||
* Copyright 2007-2008, Haiku Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <USBKit.h>
|
||||
|
@ -16,10 +16,14 @@ DumpInterface(const BUSBInterface *interface)
|
|||
if (!interface)
|
||||
return;
|
||||
|
||||
printf(" Class .............. 0x%02x\n", interface->Class());
|
||||
printf(" Subclass ........... 0x%02x\n", interface->Subclass());
|
||||
printf(" Protocol ........... 0x%02x\n", interface->Protocol());
|
||||
printf(" Interface String ... \"%s\"\n", interface->InterfaceString());
|
||||
printf(" Class .............. 0x%02x\n",
|
||||
interface->Class());
|
||||
printf(" Subclass ........... 0x%02x\n",
|
||||
interface->Subclass());
|
||||
printf(" Protocol ........... 0x%02x\n",
|
||||
interface->Protocol());
|
||||
printf(" Interface String ... \"%s\"\n",
|
||||
interface->InterfaceString());
|
||||
|
||||
for (uint32 i = 0; i < interface->CountEndpoints(); i++) {
|
||||
const BUSBEndpoint *endpoint = interface->EndpointAt(i);
|
||||
|
@ -27,8 +31,10 @@ DumpInterface(const BUSBInterface *interface)
|
|||
continue;
|
||||
|
||||
printf(" [Endpoint %lu]\n", i);
|
||||
printf(" MaxPacketSize .... %d\n", endpoint->MaxPacketSize());
|
||||
printf(" Interval ......... %d\n", endpoint->Interval());
|
||||
printf(" MaxPacketSize .... %d\n",
|
||||
endpoint->MaxPacketSize());
|
||||
printf(" Interval ......... %d\n",
|
||||
endpoint->Interval());
|
||||
|
||||
if (endpoint->IsControl())
|
||||
printf(" Type ............. Control\n");
|
||||
|
@ -49,7 +55,8 @@ DumpInterface(const BUSBInterface *interface)
|
|||
usb_descriptor *generic = (usb_descriptor *)buffer;
|
||||
for (uint32 i = 0; interface->OtherDescriptorAt(i, generic, 256) == B_OK; i++) {
|
||||
printf(" [Descriptor %lu]\n", i);
|
||||
printf(" Type ............. 0x%02x\n", generic->generic.descriptor_type);
|
||||
printf(" Type ............. 0x%02x\n",
|
||||
generic->generic.descriptor_type);
|
||||
printf(" Data ............. ");
|
||||
// the length includes the length and descriptor_type field
|
||||
for(int32 j = 0; j < generic->generic.length - 2; j++)
|
||||
|
@ -65,10 +72,18 @@ DumpConfiguration(const BUSBConfiguration *configuration)
|
|||
if (!configuration)
|
||||
return;
|
||||
|
||||
printf(" Configuration String . \"%s\"\n", configuration->ConfigurationString());
|
||||
printf(" Configuration String . \"%s\"\n",
|
||||
configuration->ConfigurationString());
|
||||
for (uint32 i = 0; i < configuration->CountInterfaces(); i++) {
|
||||
printf(" [Interface %lu]\n", i);
|
||||
DumpInterface(configuration->InterfaceAt(i));
|
||||
const BUSBInterface *interface = configuration->InterfaceAt(i);
|
||||
|
||||
for (uint32 j = 0; j < interface->CountAlternates(); j++) {
|
||||
const BUSBInterface *alternate = interface->AlternateAt(j);
|
||||
printf(" [Alternate %lu%s]\n", j,
|
||||
j == interface->AlternateIndex() ? " active" : "");
|
||||
DumpInterface(alternate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue