153 pid = udd->idProduct;
158 goto FailGetDevDescr;
189 num_of_conf = udd->bNumConfigurations;
195 goto FailSetDevTblEntry;
207 for (uint8_t i=0; i<num_of_conf; i++) {
210 goto FailGetConfDescr;
219 goto FailGetConfDescr;
223 USBTRACE(
"MIDI not found. Attempts bulk device\r\n");
239 goto FailSetConfDescr;
256 uint8_t* buf_ptr = buf;
258 uint8_t descr_length;
260 uint16_t total_length;
269 total_length = buf[2] | ((int)buf[3] << 8);
281 while( buf_ptr < buf + total_length ) {
282 descr_length = *( buf_ptr );
283 descr_type = *( buf_ptr + 1 );
284 switch( descr_type ) {
320 #ifdef DEBUG_USB_HOST
321 PrintEndpointDescriptor(epDesc);
328 buf_ptr += descr_length;
348 if(
vid == 0x1235 ) {
350 if(
pid == 0x20 ||
pid == 0x36 ||
pid == 0x51 ||
pid == 0x69 ||
pid == 0x7b ) {
363 dataptr[*bytes_rcvd] =
'\0';
364 dataptr[(*bytes_rcvd)+1] =
'\0';
382 goto RecvData_return_from_buffer;
397 RecvData_return_from_buffer:
400 if( isRaw ==
true ) {
429 buf[0] = (nCable << 4) | (msg >> 4);
430 if( msg < 0xf0 ) msg = msg & 0xf0;
442 buf[0] = (nCable << 4) | 3;
448 if(msg == 0xf1 || msg == 0xf3) {
449 buf[0] = (nCable << 4) | 2;
464 #ifdef DEBUG_USB_HOST 467 USBTRACE(
"Endpoint descriptor:\r\n");
487 if( (cin & 0xc) == 4 ) {
488 if( cin == 4 || cin == 7 )
return 3;
489 if( cin == 6 )
return 2;
490 if( cin == 5 )
return 1;
493 if( midiMsg < 0xf0 ) midiMsg &= 0xf0;
536 if( *dataptr != 0xf0 ){
541 while(*dataptr != 0xf7)
560 uint16_t n = datasize;
561 uint16_t pktSize = (n*10/3+7)/10*4;
573 buf[wptr] = (nCable << 4) | 0x4;
577 buf[wptr++] = (nCable << 4) | 0x5;
578 buf[wptr++] = *(dataptr++);
584 buf[wptr++] = (nCable << 4) | 0x6;
585 buf[wptr++] = *(dataptr++);
586 buf[wptr++] = *(dataptr++);
591 buf[wptr] = (nCable << 4) | 0x7;
594 buf[wptr++] = *(dataptr++);
595 buf[wptr++] = *(dataptr++);
596 buf[wptr++] = *(dataptr++);
601 if( wptr >= maxpkt || n == 0 ){
622 uint8_t cin = *(p) & 0x0f;
625 if( (cin & 0xc) != 4 )
return rc;
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
uint8_t SendSysEx(uint8_t *dataptr, uint16_t datasize, uint8_t nCable=0)
static const uint8_t epDataInIndexVSP
#define USB_ERROR_EPINFO_IS_NULL
uint8_t bTransferTypeMask
uint8_t RecvData(uint16_t *bytes_rcvd, uint8_t *dataptr)
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
#define USB_DESCRIPTOR_ENDPOINT
#define USB_SUBCLASS_MIDISTREAMING
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
uint8_t SendRawData(uint16_t bytes_send, uint8_t *dataptr)
uint16_t countSysExDataSize(uint8_t *dataptr)
virtual void FreeAddress(uint8_t addr)=0
static const uint8_t epDataOutIndexVSP
#define USB_DESCRIPTOR_CONFIGURATION
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
void setupDeviceSpecific()
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
#define USB_NAK_MAX_POWER
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
virtual uint8_t Release()
uint8_t RecvRawData(uint8_t *outBuf)
#define bmUSB_TRANSFER_TYPE
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
static const uint8_t epDataInIndex
#define MIDI_EVENT_PACKET_SIZE
uint8_t lookupMsgSize(uint8_t midiMsg, uint8_t cin=0)
uint8_t recvBuf[MIDI_EVENT_PACKET_SIZE]
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
#define MIDI_MAX_SYSEX_SIZE
EpInfo epInfo[MIDI_MAX_ENDPOINTS]
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
uint8_t extractSysExData(uint8_t *p, uint8_t *buf)
uint8_t SendData(uint8_t *dataptr, uint8_t nCable=0)
static const uint8_t epDataOutIndex
#define MIDI_MAX_ENDPOINTS
AddressPool & GetAddressPool()
uint8_t parseConfigDescr(uint8_t addr, uint8_t conf)
#define USB_TRANSFER_TYPE_BULK
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
void D_PrintHex(T val, int lvl)
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
#define USB_DESCRIPTOR_INTERFACE