diff --git a/ControllerUSB/include/IUSBEndpoint.h b/ControllerUSB/include/IUSBEndpoint.h index a5a38f0..a36a594 100644 --- a/ControllerUSB/include/IUSBEndpoint.h +++ b/ControllerUSB/include/IUSBEndpoint.h @@ -28,7 +28,7 @@ public: virtual void Close() = 0; //This will read from the inBuffer pointer for the specified size and write it to the endpoint. - virtual Status Write(void *inBuffer, size_t bufferSize) = 0; + virtual Status Write(const void *inBuffer, size_t bufferSize) = 0; //This will read from the endpoint and put the data in the outBuffer pointer for the specified size. virtual Status Read(void *outBuffer, size_t bufferSize) = 0; diff --git a/SwitchUSB/include/SwitchUSBEndpoint.h b/SwitchUSB/include/SwitchUSBEndpoint.h index d474fb2..3033c6a 100644 --- a/SwitchUSB/include/SwitchUSBEndpoint.h +++ b/SwitchUSB/include/SwitchUSBEndpoint.h @@ -22,7 +22,7 @@ public: virtual void Close(); //buffer should point to the data array, and only the specified size will be read. - virtual Result Write(void *inBuffer, size_t bufferSize); + virtual Result Write(const void *inBuffer, size_t bufferSize); //The data received will be put in the outBuffer array for the length of the specified size. virtual Result Read(void *outBuffer, size_t bufferSize); diff --git a/SwitchUSB/source/SwitchUSBEndpoint.cpp b/SwitchUSB/source/SwitchUSBEndpoint.cpp index 19482ae..de84b19 100644 --- a/SwitchUSB/source/SwitchUSBEndpoint.cpp +++ b/SwitchUSB/source/SwitchUSBEndpoint.cpp @@ -28,7 +28,7 @@ void SwitchUSBEndpoint::Close() usbHsEpClose(&m_epSession); } -Result SwitchUSBEndpoint::Write(void *inBuffer, size_t bufferSize) +Result SwitchUSBEndpoint::Write(const void *inBuffer, size_t bufferSize) { Result rc = -1; if (m_buffer != nullptr) @@ -38,7 +38,7 @@ Result SwitchUSBEndpoint::Write(void *inBuffer, size_t bufferSize) for (size_t byte = 0; byte != bufferSize; ++byte) { - static_cast(m_buffer)[byte] = static_cast(inBuffer)[byte]; + static_cast(m_buffer)[byte] = static_cast(inBuffer)[byte]; } rc = usbHsEpPostBuffer(&m_epSession, m_buffer, bufferSize, &transferredSize);