1
0
mirror of https://github.com/cathery/sys-con.git synced 2025-03-29 22:20:09 +00:00

Add option to specify max packet size in IUSBEndpoint::Open()

This commit is contained in:
cathery 2019-11-12 20:56:22 +03:00
parent b3c995fe66
commit fd529963cc
4 changed files with 6 additions and 6 deletions

View File

@ -18,7 +18,7 @@ protected:
public:
uint8_t m_inputData[100];
bool m_UpdateCalled;
bool m_UpdateCalled = false;
IController(std::unique_ptr<IUSBDevice> &&interface) : m_device(std::move(interface)) {}
virtual ~IController() = default;

View File

@ -23,8 +23,8 @@ public:
virtual ~IUSBEndpoint() = default;
//Open and close the endpoint.
virtual Status Open() = 0;
//Open and close the endpoint. if maxPacketSize is not set, it uses wMaxPacketSize from the descriptor.
virtual Status Open(int maxPacketSize = 0) = 0;
virtual void Close() = 0;
//This will read from the inBuffer pointer for the specified size and write it to the endpoint.

View File

@ -16,7 +16,7 @@ public:
~SwitchUSBEndpoint();
//Open and close the endpoint
virtual Result Open();
virtual Result Open(int maxPacketSize = 0);
virtual void Close();
//buffer should point to the data array, and only the specified size will be read.

View File

@ -13,9 +13,9 @@ SwitchUSBEndpoint::~SwitchUSBEndpoint()
Close();
}
Result SwitchUSBEndpoint::Open()
Result SwitchUSBEndpoint::Open(int maxPacketSize)
{
Result rc = usbHsIfOpenUsbEp(m_ifSession, &m_epSession, 1, m_descriptor->wMaxPacketSize, m_descriptor);
Result rc = usbHsIfOpenUsbEp(m_ifSession, &m_epSession, 1, (maxPacketSize != 0 ? maxPacketSize : m_descriptor->wMaxPacketSize), m_descriptor);
if (R_FAILED(rc))
return 73011;
return rc;