mirror of
https://github.com/cathery/sys-con.git
synced 2024-07-05 10:48:46 +00:00
more thorough interface check in controller init
This commit is contained in:
parent
4c78a716d6
commit
b4ee502e04
|
@ -43,8 +43,10 @@ Status Dualshock3Controller::OpenInterfaces()
|
||||||
rc = interface->Open();
|
rc = interface->Open();
|
||||||
if (S_FAILED(rc))
|
if (S_FAILED(rc))
|
||||||
return rc;
|
return rc;
|
||||||
if (interface->GetDescriptor()->bNumEndpoints >= 2)
|
|
||||||
{
|
if (interface->GetDescriptor()->bNumEndpoints < 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
//Send an initial control packet
|
//Send an initial control packet
|
||||||
uint8_t initBytes[] = {0x42, 0x0C, 0x00, 0x00};
|
uint8_t initBytes[] = {0x42, 0x0C, 0x00, 0x00};
|
||||||
rc = SendCommand(interface.get(), Ds3FeatureStartDevice, initBytes, sizeof(initBytes));
|
rc = SendCommand(interface.get(), Ds3FeatureStartDevice, initBytes, sizeof(initBytes));
|
||||||
|
@ -86,11 +88,11 @@ Status Dualshock3Controller::OpenInterfaces()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_inPipe || !m_outPipe)
|
if (!m_inPipe || !m_outPipe)
|
||||||
return 69;
|
return 69;
|
||||||
}
|
|
||||||
}
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
void Dualshock3Controller::CloseInterfaces()
|
void Dualshock3Controller::CloseInterfaces()
|
||||||
|
|
|
@ -47,6 +47,9 @@ Status Xbox360Controller::OpenInterfaces()
|
||||||
if (interface->GetDescriptor()->bInterfaceProtocol != 1)
|
if (interface->GetDescriptor()->bInterfaceProtocol != 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (interface->GetDescriptor()->bNumEndpoints < 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!m_inPipe)
|
if (!m_inPipe)
|
||||||
{
|
{
|
||||||
for (int i = 0; i != 15; ++i)
|
for (int i = 0; i != 15; ++i)
|
||||||
|
|
|
@ -91,8 +91,14 @@ Status XboxOneController::OpenInterfaces()
|
||||||
rc = interface->Open();
|
rc = interface->Open();
|
||||||
if (S_FAILED(rc))
|
if (S_FAILED(rc))
|
||||||
return rc;
|
return rc;
|
||||||
//TODO: check for numEndpoints before trying to open them!
|
|
||||||
if (interface->GetDescriptor()->bNumEndpoints >= 2)
|
if (interface->GetDescriptor()->bInterfaceProtocol != 208)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (interface->GetDescriptor()->bNumEndpoints < 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!m_inPipe)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i != 15; ++i)
|
for (uint8_t i = 0; i != 15; ++i)
|
||||||
{
|
{
|
||||||
|
@ -107,6 +113,10 @@ Status XboxOneController::OpenInterfaces()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_outPipe)
|
||||||
|
{
|
||||||
for (uint8_t i = 0; i != 15; ++i)
|
for (uint8_t i = 0; i != 15; ++i)
|
||||||
{
|
{
|
||||||
IUSBEndpoint *outEndpoint = interface->GetEndpoint(IUSBEndpoint::USB_ENDPOINT_OUT, i);
|
IUSBEndpoint *outEndpoint = interface->GetEndpoint(IUSBEndpoint::USB_ENDPOINT_OUT, i);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user