Skip to content

Commit 469162e

Browse files
committed
Merge remote-tracking branch 'nico/plugfix3'
2 parents 4283013 + 2a1a65b commit 469162e

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

hardware/arduino/avr/cores/arduino/PluggableUSB.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ int PluggableUSB_::getInterface(uint8_t* interfaceCount)
3838
return sent;
3939
}
4040

41-
int PluggableUSB_::getDescriptor(int8_t type)
41+
int PluggableUSB_::getDescriptor(USBSetup& setup)
4242
{
4343
PUSBListNode* node;
4444
for (node = rootNode; node; node = node->next) {
45-
int ret = node->getDescriptor(type);
45+
int ret = node->getDescriptor(setup);
4646
// ret!=0 -> request has been processed
4747
if (ret)
4848
return ret;
4949
}
5050
return 0;
5151
}
5252

53-
bool PluggableUSB_::setup(USBSetup& setup, uint8_t interfaceNum)
53+
bool PluggableUSB_::setup(USBSetup& setup)
5454
{
5555
PUSBListNode* node;
5656
for (node = rootNode; node; node = node->next) {
57-
if (node->setup(setup, interfaceNum)) {
57+
if (node->setup(setup)) {
5858
return true;
5959
}
6060
}

hardware/arduino/avr/cores/arduino/PluggableUSB.h

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,20 @@
2727

2828
class PUSBListNode {
2929
public:
30-
PUSBListNode(int8_t numEps, int8_t numIfs, uint8_t *epType) :
30+
PUSBListNode(uint8_t numEps, uint8_t numIfs, uint8_t *epType) :
3131
numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType)
3232
{ }
3333

34-
inline uint8_t interface() const { return pluggedInterface; }
35-
inline int8_t endpoint() const { return pluggedEndpoint; }
36-
3734
protected:
38-
virtual bool setup(USBSetup& setup, uint8_t interfaceNum) = 0;
35+
virtual bool setup(USBSetup& setup) = 0;
3936
virtual int getInterface(uint8_t* interfaceCount) = 0;
40-
virtual int getDescriptor(int8_t t) = 0;
37+
virtual int getDescriptor(USBSetup& setup) = 0;
4138

4239
uint8_t pluggedInterface;
43-
int8_t pluggedEndpoint;
40+
uint8_t pluggedEndpoint;
4441

45-
const int8_t numEndpoints;
46-
const int8_t numInterfaces;
42+
const uint8_t numEndpoints;
43+
const uint8_t numInterfaces;
4744
const uint8_t *endpointType;
4845

4946
PUSBListNode *next = NULL;
@@ -56,8 +53,8 @@ class PluggableUSB_ {
5653
PluggableUSB_();
5754
bool plug(PUSBListNode *node);
5855
int getInterface(uint8_t* interfaceCount);
59-
int getDescriptor(int8_t type);
60-
bool setup(USBSetup& setup, uint8_t interfaceNum);
56+
int getDescriptor(USBSetup& setup);
57+
bool setup(USBSetup& setup);
6158

6259
private:
6360
uint8_t lastIf;

hardware/arduino/avr/cores/arduino/USBCore.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ bool ClassInterfaceRequest(USBSetup& setup)
362362
return CDC_Setup(setup);
363363

364364
#ifdef PLUGGABLE_USB_ENABLED
365-
return PluggableUSB().setup(setup, i);
365+
return PluggableUSB().setup(setup);
366366
#endif
367367
return false;
368368
}
@@ -476,7 +476,7 @@ bool SendDescriptor(USBSetup& setup)
476476

477477
InitControl(setup.wLength);
478478
#ifdef PLUGGABLE_USB_ENABLED
479-
ret = PluggableUSB().getDescriptor(t);
479+
ret = PluggableUSB().getDescriptor(setup);
480480
if (ret != 0) {
481481
return (ret > 0 ? true : false);
482482
}

0 commit comments

Comments
 (0)