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:
parent
b3c995fe66
commit
fd529963cc
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user