mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Merge pull request #314 from felis/bmAttributes
Fixed bit mask indicating the transfer type when reading the attribut…
This commit is contained in:
commit
3cf2ae3932
9 changed files with 31 additions and 40 deletions
6
BTD.cpp
6
BTD.cpp
|
@ -335,15 +335,13 @@ void BTD::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto
|
||||||
bConfNum = conf;
|
bConfNum = conf;
|
||||||
uint8_t index;
|
uint8_t index;
|
||||||
|
|
||||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80) { // Interrupt In endpoint found
|
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80) { // Interrupt In endpoint found
|
||||||
index = BTD_EVENT_PIPE;
|
index = BTD_EVENT_PIPE;
|
||||||
epInfo[index].bmNakPower = USB_NAK_NOWAIT;
|
epInfo[index].bmNakPower = USB_NAK_NOWAIT;
|
||||||
} else {
|
} else if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) // Bulk endpoint found
|
||||||
if((pep->bmAttributes & 0x02) == 2) // Bulk endpoint found
|
|
||||||
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? BTD_DATAIN_PIPE : BTD_DATAOUT_PIPE;
|
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? BTD_DATAIN_PIPE : BTD_DATAOUT_PIPE;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// Fill the rest of endpoint data structure
|
// Fill the rest of endpoint data structure
|
||||||
epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
|
epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
|
||||||
|
|
2
adk.cpp
2
adk.cpp
|
@ -321,7 +321,7 @@ void ADK::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto
|
||||||
|
|
||||||
bConfNum = conf;
|
bConfNum = conf;
|
||||||
|
|
||||||
if((pep->bmAttributes & 0x02) == 2) {
|
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) {
|
||||||
uint8_t index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
uint8_t index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||||
// Fill in the endpoint info structure
|
// Fill in the endpoint info structure
|
||||||
epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
|
epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
|
||||||
|
|
|
@ -237,10 +237,9 @@ void ACM::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto
|
||||||
|
|
||||||
uint8_t index;
|
uint8_t index;
|
||||||
|
|
||||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
|
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80)
|
||||||
index = epInterruptInIndex;
|
index = epInterruptInIndex;
|
||||||
else
|
else if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK)
|
||||||
if((pep->bmAttributes & 0x02) == 2)
|
|
||||||
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -229,10 +229,9 @@ void FTDI::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t prot
|
||||||
|
|
||||||
uint8_t index;
|
uint8_t index;
|
||||||
|
|
||||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
|
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80)
|
||||||
index = epInterruptInIndex;
|
index = epInterruptInIndex;
|
||||||
else
|
else if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK)
|
||||||
if((pep->bmAttributes & 0x02) == 2)
|
|
||||||
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -546,7 +546,7 @@ void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t
|
||||||
bConfNum = conf;
|
bConfNum = conf;
|
||||||
bIfaceNum = iface;
|
bIfaceNum = iface;
|
||||||
|
|
||||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80) {
|
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80) {
|
||||||
if(pep->bInterval > bInterval) bInterval = pep->bInterval;
|
if(pep->bInterval > bInterval) bInterval = pep->bInterval;
|
||||||
|
|
||||||
// Fill in the endpoint info structure
|
// Fill in the endpoint info structure
|
||||||
|
|
|
@ -313,10 +313,8 @@ void HIDComposite::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint
|
||||||
bNumIface++;
|
bNumIface++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
|
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT)
|
||||||
index = epInterruptInIndex;
|
index = (pep->bEndpointAddress & 0x80) == 0x80 ? epInterruptInIndex : epInterruptOutIndex;
|
||||||
else
|
|
||||||
index = epInterruptOutIndex;
|
|
||||||
|
|
||||||
if(!SelectInterface(iface, proto))
|
if(!SelectInterface(iface, proto))
|
||||||
index = 0;
|
index = 0;
|
||||||
|
|
|
@ -315,10 +315,8 @@ void HIDUniversal::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint
|
||||||
bNumIface++;
|
bNumIface++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
|
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT)
|
||||||
index = epInterruptInIndex;
|
index = (pep->bEndpointAddress & 0x80) == 0x80 ? epInterruptInIndex : epInterruptOutIndex;
|
||||||
else
|
|
||||||
index = epInterruptOutIndex;
|
|
||||||
|
|
||||||
if(index) {
|
if(index) {
|
||||||
// Fill in the endpoint info structure
|
// Fill in the endpoint info structure
|
||||||
|
|
|
@ -550,7 +550,7 @@ void BulkOnly::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t
|
||||||
uint8_t index;
|
uint8_t index;
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
if((pep->bmAttributes & 0x02) == 2) {
|
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) {
|
||||||
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||||
// Fill in the endpoint info structure
|
// Fill in the endpoint info structure
|
||||||
epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
|
epInfo[index].epAddr = (pep->bEndpointAddress & 0x0F);
|
||||||
|
@ -564,10 +564,9 @@ void BulkOnly::EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if((pep->bmAttributes & 0x03) == 3 && (pep->bEndpointAddress & 0x80) == 0x80)
|
if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_INTERRUPT && (pep->bEndpointAddress & 0x80) == 0x80)
|
||||||
index = epInterruptInIndex;
|
index = epInterruptInIndex;
|
||||||
else
|
else if((pep->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK)
|
||||||
if((pep->bmAttributes & 0x02) == 2)
|
|
||||||
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
index = ((pep->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -304,7 +304,7 @@ uint8_t USBH_MIDI::parseConfigDescr( uint8_t addr, uint8_t conf )
|
||||||
USBTRACE("-EPAddr:"), D_PrintHex(epDesc->bEndpointAddress, 0x80);
|
USBTRACE("-EPAddr:"), D_PrintHex(epDesc->bEndpointAddress, 0x80);
|
||||||
USBTRACE(" bmAttr:"), D_PrintHex(epDesc->bmAttributes, 0x80);
|
USBTRACE(" bmAttr:"), D_PrintHex(epDesc->bmAttributes, 0x80);
|
||||||
USBTRACE2(" MaxPktSz:", (uint8_t)epDesc->wMaxPacketSize);
|
USBTRACE2(" MaxPktSz:", (uint8_t)epDesc->wMaxPacketSize);
|
||||||
if ((epDesc->bmAttributes & 0x02) == 2) {//bulk
|
if ((epDesc->bmAttributes & bmUSB_TRANSFER_TYPE) == USB_TRANSFER_TYPE_BULK) {//bulk
|
||||||
uint8_t index;
|
uint8_t index;
|
||||||
if( isMidi )
|
if( isMidi )
|
||||||
index = ((epDesc->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
index = ((epDesc->bEndpointAddress & 0x80) == 0x80) ? epDataInIndex : epDataOutIndex;
|
||||||
|
|
Loading…
Reference in a new issue