* 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:
+25
-10
@@ -3,7 +3,7 @@
|
|||||||
* Copyright 2000, Be Incorporated. All rights reserved.
|
* Copyright 2000, Be Incorporated. All rights reserved.
|
||||||
*
|
*
|
||||||
* Modified for Haiku by François Revol and Michael Lotz.
|
* 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>
|
#include <USBKit.h>
|
||||||
@@ -16,10 +16,14 @@ DumpInterface(const BUSBInterface *interface)
|
|||||||
if (!interface)
|
if (!interface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf(" Class .............. 0x%02x\n", interface->Class());
|
printf(" Class .............. 0x%02x\n",
|
||||||
printf(" Subclass ........... 0x%02x\n", interface->Subclass());
|
interface->Class());
|
||||||
printf(" Protocol ........... 0x%02x\n", interface->Protocol());
|
printf(" Subclass ........... 0x%02x\n",
|
||||||
printf(" Interface String ... \"%s\"\n", interface->InterfaceString());
|
interface->Subclass());
|
||||||
|
printf(" Protocol ........... 0x%02x\n",
|
||||||
|
interface->Protocol());
|
||||||
|
printf(" Interface String ... \"%s\"\n",
|
||||||
|
interface->InterfaceString());
|
||||||
|
|
||||||
for (uint32 i = 0; i < interface->CountEndpoints(); i++) {
|
for (uint32 i = 0; i < interface->CountEndpoints(); i++) {
|
||||||
const BUSBEndpoint *endpoint = interface->EndpointAt(i);
|
const BUSBEndpoint *endpoint = interface->EndpointAt(i);
|
||||||
@@ -27,8 +31,10 @@ DumpInterface(const BUSBInterface *interface)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
printf(" [Endpoint %lu]\n", i);
|
printf(" [Endpoint %lu]\n", i);
|
||||||
printf(" MaxPacketSize .... %d\n", endpoint->MaxPacketSize());
|
printf(" MaxPacketSize .... %d\n",
|
||||||
printf(" Interval ......... %d\n", endpoint->Interval());
|
endpoint->MaxPacketSize());
|
||||||
|
printf(" Interval ......... %d\n",
|
||||||
|
endpoint->Interval());
|
||||||
|
|
||||||
if (endpoint->IsControl())
|
if (endpoint->IsControl())
|
||||||
printf(" Type ............. Control\n");
|
printf(" Type ............. Control\n");
|
||||||
@@ -49,7 +55,8 @@ DumpInterface(const BUSBInterface *interface)
|
|||||||
usb_descriptor *generic = (usb_descriptor *)buffer;
|
usb_descriptor *generic = (usb_descriptor *)buffer;
|
||||||
for (uint32 i = 0; interface->OtherDescriptorAt(i, generic, 256) == B_OK; i++) {
|
for (uint32 i = 0; interface->OtherDescriptorAt(i, generic, 256) == B_OK; i++) {
|
||||||
printf(" [Descriptor %lu]\n", 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 ............. ");
|
printf(" Data ............. ");
|
||||||
// the length includes the length and descriptor_type field
|
// the length includes the length and descriptor_type field
|
||||||
for(int32 j = 0; j < generic->generic.length - 2; j++)
|
for(int32 j = 0; j < generic->generic.length - 2; j++)
|
||||||
@@ -65,10 +72,18 @@ DumpConfiguration(const BUSBConfiguration *configuration)
|
|||||||
if (!configuration)
|
if (!configuration)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf(" Configuration String . \"%s\"\n", configuration->ConfigurationString());
|
printf(" Configuration String . \"%s\"\n",
|
||||||
|
configuration->ConfigurationString());
|
||||||
for (uint32 i = 0; i < configuration->CountInterfaces(); i++) {
|
for (uint32 i = 0; i < configuration->CountInterfaces(); i++) {
|
||||||
printf(" [Interface %lu]\n", 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user