added some hub ports information to listusb
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41157 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -128,10 +128,10 @@ Hub::UpdatePortStatus(uint8 index)
|
||||
// get the current port status
|
||||
size_t actualLength = 0;
|
||||
status_t result = DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | USB_REQTYPE_OTHER_IN,
|
||||
USB_REQUEST_GET_STATUS, 0, index + 1, 4, (void *)&fPortStatus[index],
|
||||
4, &actualLength);
|
||||
USB_REQUEST_GET_STATUS, 0, index + 1, sizeof(usb_port_status),
|
||||
(void *)&fPortStatus[index], sizeof(usb_port_status), &actualLength);
|
||||
|
||||
if (result < B_OK || actualLength < 4) {
|
||||
if (result < B_OK || actualLength < sizeof(usb_port_status)) {
|
||||
TRACE_ERROR("error updating port status\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "BeOSCompatibility.h"
|
||||
#include "usbspec_private.h"
|
||||
#include <lock.h>
|
||||
#include <util/Vector.h>
|
||||
|
||||
|
||||
#define TRACE_OUTPUT(x, y, z...) \
|
||||
|
||||
@@ -6,14 +6,13 @@
|
||||
* Michael Lotz <mmlr@mlotz.ch>
|
||||
* Niels S. Reedijk
|
||||
*/
|
||||
|
||||
#ifndef _USBSPEC_PRIVATE_H
|
||||
#define _USBSPEC_PRIVATE_H
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <util/Vector.h>
|
||||
#include <USB3.h>
|
||||
#include <util/kernel_cpp.h>
|
||||
|
||||
|
||||
#define USB_MAX_AREAS 8
|
||||
#define USB_MAX_FRAGMENT_SIZE B_PAGE_SIZE * 96
|
||||
@@ -96,6 +95,8 @@ struct usb_port_status
|
||||
#define PORT_STATUS_POWER 0x0100
|
||||
#define PORT_STATUS_LOW_SPEED 0x0200
|
||||
#define PORT_STATUS_HIGH_SPEED 0x0400
|
||||
#define PORT_STATUS_TEST 0x0800
|
||||
#define PORT_STATUS_INDICATOR 0x1000
|
||||
|
||||
|
||||
//The feature requests with ports
|
||||
|
||||
@@ -195,6 +195,9 @@ StdBinCommands
|
||||
setusbconfig.cpp
|
||||
: be libdevice.so : $(haiku-utils_rsrc) ;
|
||||
|
||||
ObjectHdrs [ FGristFiles listusb$(SUFOBJ) ]
|
||||
: [ FDirName $(SUBDIR) $(DOTDOT) add-ons kernel bus_managers usb ] ;
|
||||
|
||||
# standard commands that need libbluetooth.so, due the Bluetooth Kit
|
||||
StdBinCommands
|
||||
bt_dev_info.cpp
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <USBKit.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "usbspec_private.h"
|
||||
|
||||
|
||||
const char*
|
||||
ClassName(int classNumber) {
|
||||
@@ -168,6 +170,40 @@ DumpInfo(BUSBDevice &device, bool verbose)
|
||||
printf(" [Configuration %lu]\n", i);
|
||||
DumpConfiguration(device.ConfigurationAt(i));
|
||||
}
|
||||
|
||||
if (device.Class() != 0x09)
|
||||
return;
|
||||
|
||||
usb_hub_descriptor hubDescriptor;
|
||||
size_t size = device.GetDescriptor(USB_DESCRIPTOR_HUB, 0, 0,
|
||||
(void *)&hubDescriptor, sizeof(usb_hub_descriptor));
|
||||
if (size == sizeof(usb_hub_descriptor)) {
|
||||
printf(" Hub ports count......... %d\n", hubDescriptor.num_ports);
|
||||
printf(" Hub Controller Current.. %dmA\n", hubDescriptor.max_power);
|
||||
|
||||
for (int index = 1; index <= hubDescriptor.num_ports; index++) {
|
||||
usb_port_status portStatus;
|
||||
size_t actualLength = device.ControlTransfer(USB_REQTYPE_CLASS
|
||||
| USB_REQTYPE_OTHER_IN, USB_REQUEST_GET_STATUS, 0,
|
||||
index, sizeof(portStatus), (void *)&portStatus);
|
||||
if (actualLength != sizeof(portStatus))
|
||||
continue;
|
||||
printf(" Port %d status....... %04x.%04x%s%s%s%s%s%s%s%s%s\n",
|
||||
index, portStatus.status, portStatus.change,
|
||||
portStatus.status & PORT_STATUS_CONNECTION ? " Connect": "",
|
||||
portStatus.status & PORT_STATUS_ENABLE ? " Enable": "",
|
||||
portStatus.status & PORT_STATUS_SUSPEND ? " Suspend": "",
|
||||
portStatus.status & PORT_STATUS_OVER_CURRENT ? " Overcurrent": "",
|
||||
portStatus.status & PORT_STATUS_RESET ? " Reset": "",
|
||||
portStatus.status & PORT_STATUS_POWER ? " Power": "",
|
||||
portStatus.status & PORT_STATUS_CONNECTION ?
|
||||
(portStatus.status & PORT_STATUS_LOW_SPEED ? " Lowspeed"
|
||||
: (portStatus.status & PORT_STATUS_HIGH_SPEED ? " Highspeed"
|
||||
: " Fullspeed")) : "",
|
||||
portStatus.status & PORT_STATUS_TEST ? " Test": "",
|
||||
portStatus.status & PORT_STATUS_INDICATOR ? " Indicator": "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user