MCPcopy Create free account
hub / github.com/cathery/sys-con / Open

Method Open

source/ControllerSwitch/SwitchUSBInterface.cpp:15–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15Result SwitchUSBInterface::Open()
16{
17 UsbHsClientIfSession temp;
18 Result rc = usbHsAcquireUsbIf(&temp, &m_interface);
19 if (R_FAILED(rc))
20 return rc;
21
22 m_session = temp;
23
24 if (R_SUCCEEDED(rc))
25 {
26
27 for (int i = 0; i != 15; ++i)
28 {
29 usb_endpoint_descriptor &epdesc = m_session.inf.inf.input_endpoint_descs[i];
30 if (epdesc.bLength != 0)
31 {
32 m_inEndpoints[i] = std::make_unique<SwitchUSBEndpoint>(m_session, epdesc);
33 }
34 }
35
36 for (int i = 0; i != 15; ++i)
37 {
38 usb_endpoint_descriptor &epdesc = m_session.inf.inf.output_endpoint_descs[i];
39 if (epdesc.bLength != 0)
40 {
41 m_outEndpoints[i] = std::make_unique<SwitchUSBEndpoint>(m_session, epdesc);
42 }
43 }
44 }
45 return rc;
46}
47void SwitchUSBInterface::Close()
48{
49 for (auto &&endpoint : m_inEndpoints)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected