Skip to content

Commit b4d313d

Browse files
committed
add numInterfaces field to PUSBCallbacks
1 parent b8d29ba commit b4d313d

File tree

5 files changed

+5
-6
lines changed

5 files changed

+5
-6
lines changed

Diff for: hardware/arduino/avr/cores/arduino/PluggableUSB.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ int8_t PUSB_AddFunction(PUSBCallbacks *cb, u8* interface)
9494
}
9595

9696
*interface = lastIf;
97-
lastIf++;
97+
lastIf += cb->numInterfaces;
9898
for ( u8 i = 0; i< cb->numEndpoints; i++) {
9999
_initEndpoints[lastEp] = cb->endpointType[i];
100100
lastEp++;
101101
}
102102
modules_count++;
103-
return lastEp-1;
103+
return lastEp - cb->numEndpoints;
104104
// restart USB layer???
105105
}
106106

Diff for: hardware/arduino/avr/cores/arduino/PluggableUSB.h

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ typedef struct
3131
int8_t (*getInterface)(u8* interfaceNum);
3232
int8_t (*getDescriptor)(int8_t t);
3333
int8_t numEndpoints;
34+
int8_t numInterfaces;
3435
u8 endpointType[];
3536
} PUSBCallbacks;
3637

Diff for: hardware/arduino/avr/cores/arduino/USBCore.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ extern const u16 STRING_LANGUAGE[] PROGMEM;
3333
extern const u8 STRING_PRODUCT[] PROGMEM;
3434
extern const u8 STRING_MANUFACTURER[] PROGMEM;
3535
extern const DeviceDescriptor USB_DeviceDescriptor PROGMEM;
36-
extern const DeviceDescriptor USB_DeviceDescriptorA PROGMEM;
3736
extern const DeviceDescriptor USB_DeviceDescriptorB PROGMEM;
3837

3938
const u16 STRING_LANGUAGE[2] = {
@@ -72,9 +71,6 @@ const u8 STRING_MANUFACTURER[] PROGMEM = USB_MANUFACTURER;
7271
const DeviceDescriptor USB_DeviceDescriptor =
7372
D_DEVICE(0x00,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
7473

75-
const DeviceDescriptor USB_DeviceDescriptorA =
76-
D_DEVICE(DEVICE_CLASS,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
77-
7874
const DeviceDescriptor USB_DeviceDescriptorB =
7975
D_DEVICE(0xEF,0x02,0x01,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
8076

Diff for: libraries/HID/HID.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ int8_t HID_Plug(void)
120120
cb.getInterface = &HID_GetInterface;
121121
cb.getDescriptor = &HID_GetDescriptor;
122122
cb.numEndpoints = 1;
123+
cb.numInterfaces = 1;
123124
cb.endpointType[0] = EP_TYPE_INTERRUPT_IN;
124125
HID_ENDPOINT_INT = PUSB_AddFunction(&cb, &HID_INTERFACE);
125126

Diff for: libraries/MIDIUSB/MIDIUSB.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ int8_t MIDI_plug(void)
179179
cb.getInterface = &MIDI_GetInterface;
180180
cb.getDescriptor = &MIDI_GetDescriptor;
181181
cb.numEndpoints = 2;
182+
cb.numInterfaces = 2;
182183
cb.endpointType[0] = EP_TYPE_BULK_OUT_MIDI; // MIDI_ENDPOINT_OUT
183184
cb.endpointType[1] = EP_TYPE_BULK_IN_MIDI; // MIDI_ENDPOINT_IN
184185

0 commit comments

Comments
 (0)