Merge branch 'xxxajk'

This commit is contained in:
Kristian Lauszus 2014-09-10 00:22:29 -07:00
commit 840d5d67d4
8 changed files with 31 additions and 9 deletions

13
Usb.cpp
View file

@ -698,17 +698,20 @@ uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
// Allocate new address according to device class
//bAddress = addrPool.AllocAddress(parent, false, port);
//if (!bAddress)
// return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;
uint16_t vid = udd->idVendor;
uint16_t pid = udd->idProduct;
uint8_t klass = udd->bDeviceClass;
uint8_t subklass = udd->bDeviceSubClass;
// Attempt to configure if VID/PID or device class matches with a driver
// Qualify with subclass too.
//
// VID/PID & class tests default to false for drivers not yet ported
// subclass defaults to true, so you don't have to define it if you don't have to.
//
for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
if(!devConfig[devConfigIndex]) continue; // no driver
if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
if(devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass)) {
if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) {
rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
if(rcode != USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED)
break;
@ -724,7 +727,7 @@ uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
if(!devConfig[devConfigIndex]) continue;
if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
if(devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass)) continue; // If this is true it means it must have returned USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED above
if(devConfig[devConfigIndex]->DEVSUBCLASSOK(subklass) && (devConfig[devConfigIndex]->VIDPIDOK(vid, pid) || devConfig[devConfigIndex]->DEVCLASSOK(klass))) continue; // If this is true it means it must have returned USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED above
rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
//printf("ERROR ENUMERATING %2.2x\r\n", rcode);

View file

@ -150,6 +150,11 @@ public:
virtual boolean DEVCLASSOK(uint8_t klass) {
return false;
}
virtual boolean DEVSUBCLASSOK(uint8_t subklass) {
return true;
}
};
/* USB Setup Packet Structure */

View file

@ -246,7 +246,7 @@ uint8_t FTDI::Release() {
bNumEP = 1;
qNextPollTime = 0;
bPollEnable = false;
return 0;
return pAsync->OnRelease(this);
}
uint8_t FTDI::Poll() {

View file

@ -79,6 +79,7 @@ class FTDI;
class FTDIAsyncOper {
public:
virtual uint8_t OnInit(FTDI *pftdi) = 0;
virtual uint8_t OnRelease(FTDI *pftdi) = 0;
};
@ -128,6 +129,11 @@ public:
// UsbConfigXtracter implementation
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
virtual boolean VIDPIDOK(uint16_t vid, uint16_t pid) {
return (vid == FTDI_VID && pid == FTDI_PID);
}
};
#endif // __CDCFTDI_H__

@ -1 +1 @@
Subproject commit 7ada91a90027ccb7558b74087fb68d3940ecf64d
Subproject commit d35bb955e3818f0c14e47c8a1998003da8dc1b5a

@ -1 +1 @@
Subproject commit b119b97e1484a08aebcf24e070113d78c82fb023
Subproject commit 7fd6a306ca53d08bf53b2bbfc1b80eb056f2c55b

@ -1 +1 @@
Subproject commit 72b5bf467a1c2479ba7354ee4d864e382c167425
Subproject commit 0b8e3076b5a072251e01cfc6e6333b364d4e71e7

View file

@ -214,6 +214,14 @@ public:
// UsbConfigXtracter implementation
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
virtual boolean DEVCLASSOK(uint8_t klass) {
return (klass == USB_CLASS_HID);
}
virtual boolean DEVSUBCLASSOK(uint8_t subklass) {
return (subklass == BOOT_PROTOCOL);
}
};
template <const uint8_t BOOT_PROTOCOL>