From 0e2a404fc90a4cf171ea5ac4860c4afa9a0377e6 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 17 May 2008 12:41:56 +0000 Subject: [PATCH] * Sync roothub code between UHCI and EHCI (will be reworked to a common one) * Minor whitespace cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25528 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/busses/usb/ehci_rh.cpp | 6 +++--- src/add-ons/kernel/busses/usb/uhci.cpp | 4 ++-- src/add-ons/kernel/busses/usb/uhci_rh.cpp | 16 +++++++++------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/add-ons/kernel/busses/usb/ehci_rh.cpp b/src/add-ons/kernel/busses/usb/ehci_rh.cpp index 3c47adb6c8..98167d6c01 100644 --- a/src/add-ons/kernel/busses/usb/ehci_rh.cpp +++ b/src/add-ons/kernel/busses/usb/ehci_rh.cpp @@ -58,7 +58,7 @@ static ehci_root_hub_configuration_s sEHCIRootHubConfig = 0x09, // Interface class (9 = Hub) 0, // Interface subclass 0, // Interface protocol - 0, // Index of interface string + 0 // Index of interface string }, { // endpoint descriptor @@ -67,7 +67,7 @@ static ehci_root_hub_configuration_s sEHCIRootHubConfig = USB_REQTYPE_DEVICE_IN | 1, // Endpoint address (first in IN endpoint) 0x03, // Attributes (0x03 = interrupt endpoint) 8, // Max packet size - 0xFF // Interval + 0xff // Interval }, { // hub descriptor @@ -169,7 +169,7 @@ EHCIRootHub::ProcessTransfer(EHCI *ehci, Transfer *transfer) break; } - TRACE(("usb_ehci_roothub: set address: %d\n", request->Value)); + TRACE(("usb_ehci_roothub: set address: %d\n", request->Value)); status = B_OK; break; diff --git a/src/add-ons/kernel/busses/usb/uhci.cpp b/src/add-ons/kernel/busses/usb/uhci.cpp index 2e6f0913e8..9a3e4f951c 100644 --- a/src/add-ons/kernel/busses/usb/uhci.cpp +++ b/src/add-ons/kernel/busses/usb/uhci.cpp @@ -363,7 +363,7 @@ UHCI::UHCI(pci_info *info, Stack *stack) } // Set base pointer and reset frame number - WriteReg32(UHCI_FRBASEADD, (uint32)physicalAddress); + WriteReg32(UHCI_FRBASEADD, (uint32)physicalAddress); WriteReg16(UHCI_FRNUM, 0); // Set the max packet size for bandwidth reclamation to 64 bytes @@ -1295,7 +1295,7 @@ UHCI::FinishIsochronousTransfers() bool transferDone = false; uint16 currentFrame = ReadReg16(UHCI_FRNUM); - + // Process the frame list until one transfer is processed while (!transferDone) { // wait 1ms in order to be sure to be one position behind diff --git a/src/add-ons/kernel/busses/usb/uhci_rh.cpp b/src/add-ons/kernel/busses/usb/uhci_rh.cpp index a27df8daaa..5ad1f3c089 100644 --- a/src/add-ons/kernel/busses/usb/uhci_rh.cpp +++ b/src/add-ons/kernel/busses/usb/uhci_rh.cpp @@ -8,8 +8,6 @@ */ #include "uhci.h" -#include - static usb_device_descriptor sUHCIRootHubDevice = { @@ -61,7 +59,7 @@ static uhci_root_hub_configuration_s sUHCIRootHubConfig = 0x09, // Interface class (9 = Hub) 0, // Interface subclass 0, // Interface protocol - 0, // Index of interface string + 0 // Index of interface string }, { // endpoint descriptor @@ -70,7 +68,7 @@ static uhci_root_hub_configuration_s sUHCIRootHubConfig = USB_REQTYPE_DEVICE_IN | 1, // Endpoint address (first in IN endpoint) 0x03, // Attributes (0x03 = interrupt endpoint) 8, // Max packet size - 0xFF // Interval + 0xff // Interval }, { // hub descriptor @@ -110,7 +108,6 @@ static uhci_root_hub_string_s sUHCIRootHubStrings[3] = { 'H', 'A', 'I', 'K', 'U', // Characters ' ', 'I', 'n', 'c', '.' } - }, { @@ -139,15 +136,19 @@ UHCIRootHub::ProcessTransfer(UHCI *uhci, Transfer *transfer) return B_ERROR; usb_request_data *request = transfer->RequestData(); + TRACE(("usb_ohci_roothub: request: %d\n", request->Request)); status_t status = B_TIMED_OUT; size_t actualLength = 0; switch (request->Request) { case USB_REQUEST_GET_STATUS: { if (request->Index == 0) { - // Get the hub status -- everything as 0 means all-right + // get hub status actualLength = MIN(sizeof(usb_port_status), transfer->DataLength()); + // the hub reports whether the local power failed (bit 0) + // and if there is a over-current condition (bit 1). + // everything as 0 means all is ok. memset(transfer->Data(), 0, actualLength); status = B_OK; break; @@ -159,6 +160,7 @@ UHCIRootHub::ProcessTransfer(UHCI *uhci, Transfer *transfer) memcpy(transfer->Data(), (void *)&portStatus, actualLength); status = B_OK; } + break; } @@ -224,7 +226,7 @@ UHCIRootHub::ProcessTransfer(UHCI *uhci, Transfer *transfer) case USB_REQUEST_CLEAR_FEATURE: { if (request->Index == 0) { - // We don't support any hub changes + // we don't support any hub changes TRACE_ERROR(("usb_uhci_roothub: clear feature: no hub changes\n")); break; }