Merge branch 'master' into dev

This commit is contained in:
Kristian Lauszus 2014-09-10 21:01:45 -07:00
commit 1d13c6865c
7 changed files with 30 additions and 8 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 1edd5f46188a6c4b68d6f9120fa72359a12e38f1

@ -1 +1 @@
Subproject commit 2bf8f633e7f9bc5a7bf4c00f3f45c7b79484198e
Subproject commit 3b5455a20526208ad84215dcb40a51c8e000b507

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>