* Make the maximum port count a define and set it to 16. OHCI officially
supports up to 15 ports and QEMUs OHCI emulation uses a port count of 10 for example. * Update the hub code to remove the hardcoded 8 port limits. * Some other code to enumerate the USB structure I had laying around (available internally only, might be added as a public API some time). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25555 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a5a728361c
commit
519fbf77d3
@ -153,7 +153,6 @@ Device::Device(Object *parent, int8 hubPort, usb_device_descriptor &desc,
|
||||
interfaceInfo->generic_count = 0;
|
||||
interfaceInfo->generic = NULL;
|
||||
|
||||
// TODO: Remove all Interface class related code.
|
||||
Interface *interface = new(std::nothrow) Interface(this,
|
||||
interfaceDescriptor->interface_number);
|
||||
interfaceInfo->handle = interface->USBID();
|
||||
|
@ -19,7 +19,7 @@ Hub::Hub(Object *parent, int8 hubPort, usb_device_descriptor &desc,
|
||||
TRACE(("USB Hub %d: creating hub\n", DeviceAddress()));
|
||||
|
||||
memset(&fHubDescriptor, 0, sizeof(fHubDescriptor));
|
||||
for (int32 i = 0; i < 8; i++)
|
||||
for (int32 i = 0; i < USB_MAX_PORT_COUNT; i++)
|
||||
fChildren[i] = NULL;
|
||||
|
||||
if (!fInitOK) {
|
||||
@ -55,9 +55,10 @@ Hub::Hub(Object *parent, int8 hubPort, usb_device_descriptor &desc,
|
||||
TRACE(("\tdevice_removeable:...0x%02x\n", fHubDescriptor.device_removeable));
|
||||
TRACE(("\tpower_control_mask:..0x%02x\n", fHubDescriptor.power_control_mask));
|
||||
|
||||
if (fHubDescriptor.num_ports > 8) {
|
||||
TRACE(("USB Hub %d: hub supports more ports than we do (%d vs. 8)\n", DeviceAddress(), fHubDescriptor.num_ports));
|
||||
fHubDescriptor.num_ports = 8;
|
||||
if (fHubDescriptor.num_ports > USB_MAX_PORT_COUNT) {
|
||||
TRACE_ERROR(("USB Hub %d: hub supports more ports than we do (%d vs. %d)\n",
|
||||
DeviceAddress(), fHubDescriptor.num_ports, USB_MAX_PORT_COUNT));
|
||||
fHubDescriptor.num_ports = USB_MAX_PORT_COUNT;
|
||||
}
|
||||
|
||||
Object *object = GetStack()->GetObject(Configuration()->interface->active->endpoint[0].handle);
|
||||
@ -174,6 +175,16 @@ Hub::ResetPort(uint8 index)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Hub::DisablePort(uint8 index)
|
||||
{
|
||||
return DefaultPipe()->SendRequest(USB_REQTYPE_CLASS
|
||||
| USB_REQTYPE_OTHER_OUT, USB_REQUEST_CLEAR_FEATURE, PORT_ENABLE,
|
||||
index + 1, 0, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
Hub::Explore(change_item **changeList)
|
||||
{
|
||||
@ -238,9 +249,7 @@ Hub::Explore(change_item **changeList)
|
||||
// the device failed to setup correctly, disable the port
|
||||
// so that the device doesn't get in the way of future
|
||||
// addressing.
|
||||
DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | USB_REQTYPE_OTHER_OUT,
|
||||
USB_REQUEST_CLEAR_FEATURE, PORT_ENABLE, i + 1,
|
||||
0, NULL, 0, NULL);
|
||||
DisablePort(i);
|
||||
}
|
||||
} else {
|
||||
// Device removed...
|
||||
|
@ -259,6 +259,13 @@ Stack::IndexOfBusManager(BusManager *busManager)
|
||||
}
|
||||
|
||||
|
||||
BusManager *
|
||||
Stack::BusManagerAt(int32 index)
|
||||
{
|
||||
return fBusManagers.ElementAt(index);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Stack::AllocateChunk(void **logicalAddress, void **physicalAddress, size_t size)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "usbspec_p.h"
|
||||
#include <lock.h>
|
||||
|
||||
|
||||
//#define TRACE_USB
|
||||
#ifdef TRACE_USB
|
||||
#define TRACE(x) dprintf x
|
||||
#define TRACE_ERROR(x) dprintf x
|
||||
@ -115,6 +115,7 @@ public:
|
||||
|
||||
void AddBusManager(BusManager *bus);
|
||||
int32 IndexOfBusManager(BusManager *bus);
|
||||
BusManager *BusManagerAt(int32 index);
|
||||
|
||||
status_t AllocateChunk(void **logicalAddress,
|
||||
void **physicalAddress, size_t size);
|
||||
@ -497,8 +498,13 @@ virtual status_t GetDescriptor(uint8 descriptorType,
|
||||
void *data, size_t dataLength,
|
||||
size_t *actualLength);
|
||||
|
||||
Device *ChildAt(uint8 index)
|
||||
{ return fChildren[index]; };
|
||||
|
||||
status_t UpdatePortStatus(uint8 index);
|
||||
status_t ResetPort(uint8 index);
|
||||
status_t DisablePort(uint8 index);
|
||||
|
||||
void Explore(change_item **changeList);
|
||||
static void InterruptCallback(void *cookie,
|
||||
status_t status, void *data,
|
||||
@ -518,9 +524,9 @@ private:
|
||||
InterruptPipe *fInterruptPipe;
|
||||
usb_hub_descriptor fHubDescriptor;
|
||||
|
||||
usb_port_status fInterruptStatus[8];
|
||||
usb_port_status fPortStatus[8];
|
||||
Device *fChildren[8];
|
||||
usb_port_status fInterruptStatus[USB_MAX_PORT_COUNT];
|
||||
usb_port_status fPortStatus[USB_MAX_PORT_COUNT];
|
||||
Device *fChildren[USB_MAX_PORT_COUNT];
|
||||
};
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#define USB_MAX_AREAS 8
|
||||
#define USB_MAX_FRAGMENT_SIZE B_PAGE_SIZE * 96
|
||||
#define USB_MAX_PORT_COUNT 16
|
||||
|
||||
#define USB_DELAY_BUS_RESET 100000
|
||||
#define USB_DELAY_DEVICE_POWER_UP 300000
|
||||
|
Loading…
Reference in New Issue
Block a user