diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-11-03 03:20:08 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2010-11-03 03:20:08 +0000 |
| commit | 23d4b5773999838a6ab7f26c06d3fd6af11a2eaa (patch) | |
| tree | 97380d53164b47f3a36b8234aa9ec536c79c5ef1 /LUFA/Drivers | |
| parent | 6b81d2a0575d527f03144847b7d766fa0cfd0708 (diff) | |
Fixed MIDI class driver send routines silently discarding packets if the endpoint or pipe is busy (thanks to Robin Green).
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1551 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'LUFA/Drivers')
| -rw-r--r-- | LUFA/Drivers/USB/Class/Device/MIDI.c | 15 | ||||
| -rw-r--r-- | LUFA/Drivers/USB/Class/Host/MIDI.c | 15 |
2 files changed, 12 insertions, 18 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.c b/LUFA/Drivers/USB/Class/Device/MIDI.c index 2e175754..78d9043a 100644 --- a/LUFA/Drivers/USB/Class/Device/MIDI.c +++ b/LUFA/Drivers/USB/Class/Device/MIDI.c @@ -92,18 +92,15 @@ uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter if (USB_DeviceState != DEVICE_STATE_Configured) return ENDPOINT_RWSTREAM_DeviceDisconnected; + uint8_t ErrorCode; + Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber); - if (Endpoint_IsReadWriteAllowed()) - { - uint8_t ErrorCode; + if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK)) != ENDPOINT_RWSTREAM_NoError) + return ErrorCode; - if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK)) != ENDPOINT_RWSTREAM_NoError) - return ErrorCode; - - if (!(Endpoint_IsReadWriteAllowed())) - Endpoint_ClearIN(); - } + if (!(Endpoint_IsReadWriteAllowed())) + Endpoint_ClearIN(); return ENDPOINT_RWSTREAM_NoError; } diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.c b/LUFA/Drivers/USB/Class/Host/MIDI.c index ad6c5cfd..87e42901 100644 --- a/LUFA/Drivers/USB/Class/Host/MIDI.c +++ b/LUFA/Drivers/USB/Class/Host/MIDI.c @@ -179,18 +179,15 @@ uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive)) return HOST_SENDCONTROL_DeviceDisconnected; + uint8_t ErrorCode; + Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber); - if (Pipe_IsReadWriteAllowed()) - { - uint8_t ErrorCode; + if ((ErrorCode = Pipe_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError) + return ErrorCode; - if ((ErrorCode = Pipe_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError) - return ErrorCode; - - if (!(Pipe_IsReadWriteAllowed())) - Pipe_ClearOUT(); - } + if (!(Pipe_IsReadWriteAllowed())) + Pipe_ClearOUT(); return PIPE_RWSTREAM_NoError; } |
