mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Merge branch 'master' into dev
This commit is contained in:
commit
1d13c6865c
7 changed files with 30 additions and 8 deletions
13
Usb.cpp
13
Usb.cpp
|
@ -698,17 +698,20 @@ uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
|
||||||
// Allocate new address according to device class
|
// Allocate new address according to device class
|
||||||
//bAddress = addrPool.AllocAddress(parent, false, port);
|
//bAddress = addrPool.AllocAddress(parent, false, port);
|
||||||
|
|
||||||
//if (!bAddress)
|
|
||||||
// return USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL;
|
|
||||||
uint16_t vid = udd->idVendor;
|
uint16_t vid = udd->idVendor;
|
||||||
uint16_t pid = udd->idProduct;
|
uint16_t pid = udd->idProduct;
|
||||||
uint8_t klass = udd->bDeviceClass;
|
uint8_t klass = udd->bDeviceClass;
|
||||||
|
uint8_t subklass = udd->bDeviceSubClass;
|
||||||
// Attempt to configure if VID/PID or device class matches with a driver
|
// 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++) {
|
for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
|
||||||
if(!devConfig[devConfigIndex]) continue; // no driver
|
if(!devConfig[devConfigIndex]) continue; // no driver
|
||||||
if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
|
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);
|
rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
|
||||||
if(rcode != USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED)
|
if(rcode != USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED)
|
||||||
break;
|
break;
|
||||||
|
@ -724,7 +727,7 @@ uint8_t USB::Configuring(uint8_t parent, uint8_t port, bool lowspeed) {
|
||||||
for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
|
for(devConfigIndex = 0; devConfigIndex < USB_NUMDEVICES; devConfigIndex++) {
|
||||||
if(!devConfig[devConfigIndex]) continue;
|
if(!devConfig[devConfigIndex]) continue;
|
||||||
if(devConfig[devConfigIndex]->GetAddress()) continue; // consumed
|
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);
|
rcode = AttemptConfig(devConfigIndex, parent, port, lowspeed);
|
||||||
|
|
||||||
//printf("ERROR ENUMERATING %2.2x\r\n", rcode);
|
//printf("ERROR ENUMERATING %2.2x\r\n", rcode);
|
||||||
|
|
|
@ -150,6 +150,11 @@ public:
|
||||||
virtual boolean DEVCLASSOK(uint8_t klass) {
|
virtual boolean DEVCLASSOK(uint8_t klass) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual boolean DEVSUBCLASSOK(uint8_t subklass) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* USB Setup Packet Structure */
|
/* USB Setup Packet Structure */
|
||||||
|
|
|
@ -246,7 +246,7 @@ uint8_t FTDI::Release() {
|
||||||
bNumEP = 1;
|
bNumEP = 1;
|
||||||
qNextPollTime = 0;
|
qNextPollTime = 0;
|
||||||
bPollEnable = false;
|
bPollEnable = false;
|
||||||
return 0;
|
return pAsync->OnRelease(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t FTDI::Poll() {
|
uint8_t FTDI::Poll() {
|
||||||
|
|
|
@ -79,6 +79,7 @@ class FTDI;
|
||||||
class FTDIAsyncOper {
|
class FTDIAsyncOper {
|
||||||
public:
|
public:
|
||||||
virtual uint8_t OnInit(FTDI *pftdi) = 0;
|
virtual uint8_t OnInit(FTDI *pftdi) = 0;
|
||||||
|
virtual uint8_t OnRelease(FTDI *pftdi) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,6 +129,11 @@ public:
|
||||||
|
|
||||||
// UsbConfigXtracter implementation
|
// UsbConfigXtracter implementation
|
||||||
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
|
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__
|
#endif // __CDCFTDI_H__
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7ada91a90027ccb7558b74087fb68d3940ecf64d
|
Subproject commit 1edd5f46188a6c4b68d6f9120fa72359a12e38f1
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2bf8f633e7f9bc5a7bf4c00f3f45c7b79484198e
|
Subproject commit 3b5455a20526208ad84215dcb40a51c8e000b507
|
|
@ -214,6 +214,14 @@ public:
|
||||||
|
|
||||||
// UsbConfigXtracter implementation
|
// UsbConfigXtracter implementation
|
||||||
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep);
|
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>
|
template <const uint8_t BOOT_PROTOCOL>
|
||||||
|
|
Loading…
Reference in a new issue