Skip to content

Correct SET_INTERFACE request #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cores/arduino/USB/USBCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ static const unsigned char test_packet_buffer[] = {
volatile uint32_t _usbConfiguration = 0;
volatile uint32_t _usbInitialized = 0;
uint32_t _usbSetInterface = 0;
uint32_t _usbAlternateSetting = 0;
uint32_t _cdcComposite = 0;

//==================================================================
Expand Down Expand Up @@ -229,6 +230,11 @@ int USBD_SendControl(uint8_t flags __attribute__ ((unused)), const void* d, uint

if (_cmark < _cend)
{
if (_cmark + len > _cend)
{
len = _cend - _cmark;
length = len;
}
while (len > 0)
{
sent = UDD_Send(EP0, data + pos, len);
Expand Down Expand Up @@ -795,8 +801,9 @@ static void USB_ISR(void)
}
else if (SET_INTERFACE == r)
{
_usbSetInterface = setup.wValueL;
TRACE_CORE(puts(">>> EP0 Int: SET_INTERFACE\r\n");)
_usbSetInterface = setup.wIndex;
_usbAlternateSetting = setup.wValueL;
TRACE_CORE(printf(">>> EP0 Int: SET_INTERFACE interface=%d alternateSetting=%d\r\n",_usbSetInterface, _usbAlternateSetting);)
}
}
else
Expand Down