diff --git a/hardware/arduino/avr/cores/arduino/PluggableUSB.cpp b/hardware/arduino/avr/cores/arduino/PluggableUSB.cpp index 15195b01a..f59fc67e3 100644 --- a/hardware/arduino/avr/cores/arduino/PluggableUSB.cpp +++ b/hardware/arduino/avr/cores/arduino/PluggableUSB.cpp @@ -95,13 +95,13 @@ int8_t PUSB_AddFunction(PUSBCallbacks *cb, u8* interface) } *interface = lastIf; - lastIf++; + lastIf += cb->numInterfaces; for ( u8 i = 0; i< cb->numEndpoints; i++) { _initEndpoints[lastEp] = cb->endpointType[i]; lastEp++; } modules_count++; - return lastEp-1; + return lastEp - cb->numEndpoints; // restart USB layer??? } diff --git a/hardware/arduino/avr/cores/arduino/PluggableUSB.h b/hardware/arduino/avr/cores/arduino/PluggableUSB.h index e066d3775..8e7f5d761 100644 --- a/hardware/arduino/avr/cores/arduino/PluggableUSB.h +++ b/hardware/arduino/avr/cores/arduino/PluggableUSB.h @@ -31,6 +31,7 @@ typedef struct int8_t (*getInterface)(u8* interfaceNum); int8_t (*getDescriptor)(int8_t t); int8_t numEndpoints; + int8_t numInterfaces; u8 endpointType[]; } PUSBCallbacks; diff --git a/hardware/arduino/avr/cores/arduino/USBCore.cpp b/hardware/arduino/avr/cores/arduino/USBCore.cpp index 53c71d905..d936a6bfb 100644 --- a/hardware/arduino/avr/cores/arduino/USBCore.cpp +++ b/hardware/arduino/avr/cores/arduino/USBCore.cpp @@ -33,7 +33,6 @@ extern const u16 STRING_LANGUAGE[] PROGMEM; extern const u8 STRING_PRODUCT[] PROGMEM; extern const u8 STRING_MANUFACTURER[] PROGMEM; extern const DeviceDescriptor USB_DeviceDescriptor PROGMEM; -extern const DeviceDescriptor USB_DeviceDescriptorA PROGMEM; extern const DeviceDescriptor USB_DeviceDescriptorB PROGMEM; const u16 STRING_LANGUAGE[2] = { @@ -72,9 +71,6 @@ const u8 STRING_MANUFACTURER[] PROGMEM = USB_MANUFACTURER; const DeviceDescriptor USB_DeviceDescriptor = D_DEVICE(0x00,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1); -const DeviceDescriptor USB_DeviceDescriptorA = - D_DEVICE(DEVICE_CLASS,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1); - const DeviceDescriptor USB_DeviceDescriptorB = D_DEVICE(0xEF,0x02,0x01,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1); diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp index e195f8e77..8bab60ae4 100644 --- a/libraries/HID/HID.cpp +++ b/libraries/HID/HID.cpp @@ -120,6 +120,7 @@ int8_t HID_Plug(void) cb.getInterface = &HID_GetInterface; cb.getDescriptor = &HID_GetDescriptor; cb.numEndpoints = 1; + cb.numInterfaces = 1; cb.endpointType[0] = EP_TYPE_INTERRUPT_IN; HID_ENDPOINT_INT = PUSB_AddFunction(&cb, &HID_INTERFACE); diff --git a/libraries/MIDIUSB/MIDIUSB.cpp b/libraries/MIDIUSB/MIDIUSB.cpp index 329b40bc2..e3fab0e47 100644 --- a/libraries/MIDIUSB/MIDIUSB.cpp +++ b/libraries/MIDIUSB/MIDIUSB.cpp @@ -179,6 +179,7 @@ int8_t MIDI_plug(void) cb.getInterface = &MIDI_GetInterface; cb.getDescriptor = &MIDI_GetDescriptor; cb.numEndpoints = 2; + cb.numInterfaces = 2; cb.endpointType[0] = EP_TYPE_BULK_OUT_MIDI; // MIDI_ENDPOINT_OUT cb.endpointType[1] = EP_TYPE_BULK_IN_MIDI; // MIDI_ENDPOINT_IN