* 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:
@@ -153,7 +153,6 @@ Device::Device(Object *parent, int8 hubPort, usb_device_descriptor &desc,
|
|||||||
interfaceInfo->generic_count = 0;
|
interfaceInfo->generic_count = 0;
|
||||||
interfaceInfo->generic = NULL;
|
interfaceInfo->generic = NULL;
|
||||||
|
|
||||||
// TODO: Remove all Interface class related code.
|
|
||||||
Interface *interface = new(std::nothrow) Interface(this,
|
Interface *interface = new(std::nothrow) Interface(this,
|
||||||
interfaceDescriptor->interface_number);
|
interfaceDescriptor->interface_number);
|
||||||
interfaceInfo->handle = interface->USBID();
|
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()));
|
TRACE(("USB Hub %d: creating hub\n", DeviceAddress()));
|
||||||
|
|
||||||
memset(&fHubDescriptor, 0, sizeof(fHubDescriptor));
|
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;
|
fChildren[i] = NULL;
|
||||||
|
|
||||||
if (!fInitOK) {
|
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(("\tdevice_removeable:...0x%02x\n", fHubDescriptor.device_removeable));
|
||||||
TRACE(("\tpower_control_mask:..0x%02x\n", fHubDescriptor.power_control_mask));
|
TRACE(("\tpower_control_mask:..0x%02x\n", fHubDescriptor.power_control_mask));
|
||||||
|
|
||||||
if (fHubDescriptor.num_ports > 8) {
|
if (fHubDescriptor.num_ports > USB_MAX_PORT_COUNT) {
|
||||||
TRACE(("USB Hub %d: hub supports more ports than we do (%d vs. 8)\n", DeviceAddress(), fHubDescriptor.num_ports));
|
TRACE_ERROR(("USB Hub %d: hub supports more ports than we do (%d vs. %d)\n",
|
||||||
fHubDescriptor.num_ports = 8;
|
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);
|
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
|
void
|
||||||
Hub::Explore(change_item **changeList)
|
Hub::Explore(change_item **changeList)
|
||||||
{
|
{
|
||||||
@@ -238,9 +249,7 @@ Hub::Explore(change_item **changeList)
|
|||||||
// the device failed to setup correctly, disable the port
|
// the device failed to setup correctly, disable the port
|
||||||
// so that the device doesn't get in the way of future
|
// so that the device doesn't get in the way of future
|
||||||
// addressing.
|
// addressing.
|
||||||
DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | USB_REQTYPE_OTHER_OUT,
|
DisablePort(i);
|
||||||
USB_REQUEST_CLEAR_FEATURE, PORT_ENABLE, i + 1,
|
|
||||||
0, NULL, 0, NULL);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Device removed...
|
// Device removed...
|
||||||
|
|||||||
@@ -259,6 +259,13 @@ Stack::IndexOfBusManager(BusManager *busManager)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BusManager *
|
||||||
|
Stack::BusManagerAt(int32 index)
|
||||||
|
{
|
||||||
|
return fBusManagers.ElementAt(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Stack::AllocateChunk(void **logicalAddress, void **physicalAddress, size_t size)
|
Stack::AllocateChunk(void **logicalAddress, void **physicalAddress, size_t size)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "usbspec_p.h"
|
#include "usbspec_p.h"
|
||||||
#include <lock.h>
|
#include <lock.h>
|
||||||
|
|
||||||
|
//#define TRACE_USB
|
||||||
#ifdef TRACE_USB
|
#ifdef TRACE_USB
|
||||||
#define TRACE(x) dprintf x
|
#define TRACE(x) dprintf x
|
||||||
#define TRACE_ERROR(x) dprintf x
|
#define TRACE_ERROR(x) dprintf x
|
||||||
@@ -115,6 +115,7 @@ public:
|
|||||||
|
|
||||||
void AddBusManager(BusManager *bus);
|
void AddBusManager(BusManager *bus);
|
||||||
int32 IndexOfBusManager(BusManager *bus);
|
int32 IndexOfBusManager(BusManager *bus);
|
||||||
|
BusManager *BusManagerAt(int32 index);
|
||||||
|
|
||||||
status_t AllocateChunk(void **logicalAddress,
|
status_t AllocateChunk(void **logicalAddress,
|
||||||
void **physicalAddress, size_t size);
|
void **physicalAddress, size_t size);
|
||||||
@@ -497,8 +498,13 @@ virtual status_t GetDescriptor(uint8 descriptorType,
|
|||||||
void *data, size_t dataLength,
|
void *data, size_t dataLength,
|
||||||
size_t *actualLength);
|
size_t *actualLength);
|
||||||
|
|
||||||
|
Device *ChildAt(uint8 index)
|
||||||
|
{ return fChildren[index]; };
|
||||||
|
|
||||||
status_t UpdatePortStatus(uint8 index);
|
status_t UpdatePortStatus(uint8 index);
|
||||||
status_t ResetPort(uint8 index);
|
status_t ResetPort(uint8 index);
|
||||||
|
status_t DisablePort(uint8 index);
|
||||||
|
|
||||||
void Explore(change_item **changeList);
|
void Explore(change_item **changeList);
|
||||||
static void InterruptCallback(void *cookie,
|
static void InterruptCallback(void *cookie,
|
||||||
status_t status, void *data,
|
status_t status, void *data,
|
||||||
@@ -518,9 +524,9 @@ private:
|
|||||||
InterruptPipe *fInterruptPipe;
|
InterruptPipe *fInterruptPipe;
|
||||||
usb_hub_descriptor fHubDescriptor;
|
usb_hub_descriptor fHubDescriptor;
|
||||||
|
|
||||||
usb_port_status fInterruptStatus[8];
|
usb_port_status fInterruptStatus[USB_MAX_PORT_COUNT];
|
||||||
usb_port_status fPortStatus[8];
|
usb_port_status fPortStatus[USB_MAX_PORT_COUNT];
|
||||||
Device *fChildren[8];
|
Device *fChildren[USB_MAX_PORT_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#define USB_MAX_AREAS 8
|
#define USB_MAX_AREAS 8
|
||||||
#define USB_MAX_FRAGMENT_SIZE B_PAGE_SIZE * 96
|
#define USB_MAX_FRAGMENT_SIZE B_PAGE_SIZE * 96
|
||||||
|
#define USB_MAX_PORT_COUNT 16
|
||||||
|
|
||||||
#define USB_DELAY_BUS_RESET 100000
|
#define USB_DELAY_BUS_RESET 100000
|
||||||
#define USB_DELAY_DEVICE_POWER_UP 300000
|
#define USB_DELAY_DEVICE_POWER_UP 300000
|
||||||
|
|||||||
Reference in New Issue
Block a user