Ticket #13768: usb3.patch

File usb3.patch, 1.9 KB (added by hugeping, 6 years ago)

Clear status fix

  • src/add-ons/kernel/bus_managers/usb/Hub.cpp

    diff --git a/src/add-ons/kernel/bus_managers/usb/Hub.cpp b/src/add-ons/kernel/bus_managers/usb/Hub.cpp
    index 64bc4516f0..892ba1a25d 100644
    a b Hub::Explore(change_item **changeList)  
    335335                USB_REQUEST_CLEAR_FEATURE, C_PORT_RESET, i + 1,
    336336                0, NULL, 0, NULL);
    337337        }
     338
     339        if (fPortStatus[i].change & (1 << PORT_LINK_STATE)) {
     340            TRACE_ALWAYS("port %" B_PRId32 " was link stated\n", i);
     341            DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | USB_REQTYPE_OTHER_OUT,
     342                USB_REQUEST_CLEAR_FEATURE, PORT_LINK_STATE, i + 1,
     343                0, NULL, 0, NULL);
     344        }
     345
     346        if (fPortStatus[i].change & (1 << PORT_BH_PORT_RESET)) {
     347            TRACE_ALWAYS("port %" B_PRId32 " was warm reset\n", i);
     348            DefaultPipe()->SendRequest(USB_REQTYPE_CLASS | USB_REQTYPE_OTHER_OUT,
     349                USB_REQUEST_CLEAR_FEATURE, PORT_BH_PORT_RESET, i + 1,
     350                0, NULL, 0, NULL);
     351        }
     352
    338353    }
    339354
    340355    // explore down the tree if we have hubs connected
  • src/add-ons/kernel/busses/usb/xhci.cpp

    diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp b/src/add-ons/kernel/busses/usb/xhci.cpp
    index b70b51c4fb..2cb6ac0446 100644
    a b XHCI::GetPortStatus(uint8 index, usb_port_status* status)  
    17891789
    17901790    if (fPortSpeeds[index] == USB_SPEED_SUPER) {
    17911791        if (portStatus & PS_PLC)
    1792             status->change |= PORT_LINK_STATE;
     1792            status->change |= (1 << PORT_LINK_STATE);
    17931793        if (portStatus & PS_WRC)
    1794             status->change |= PORT_BH_PORT_RESET;
     1794            status->change |= (1 << PORT_BH_PORT_RESET);
    17951795    }
    17961796
    17971797    return B_OK;
    XHCI::ClearPortFeature(uint8 index, uint16 feature)  
    18741874    case C_PORT_RESET:
    18751875        WriteOpReg(portRegister, portStatus | PS_PRC);
    18761876        break;
     1877    case PORT_LINK_STATE:
     1878        WriteOpReg(portRegister, portStatus | PS_PLC);
     1879        break;
     1880    case PORT_BH_PORT_RESET:
     1881        WriteOpReg(portRegister, portStatus | PS_WRC);
     1882        break;
    18771883    default:
    18781884        return B_BAD_VALUE;
    18791885    }