|
|
@ -589,6 +589,8 @@ int main() { |
|
|
|
uint64_t marker = 0; |
|
|
|
uint64_t marker = 0; |
|
|
|
#define CURRENT_THRESHOLD 0xF00 |
|
|
|
#define CURRENT_THRESHOLD 0xF00 |
|
|
|
#define CLICKS 8 |
|
|
|
#define CLICKS 8 |
|
|
|
|
|
|
|
// Enough clicks to ensure that enumeration happened. Should be longer than bootup time of the device connected to EON
|
|
|
|
|
|
|
|
#define CLICKS_BOOTUP 30 |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
for (cnt=0;;cnt++) { |
|
|
|
for (cnt=0;;cnt++) { |
|
|
@ -615,8 +617,8 @@ int main() { |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case USB_POWER_CDP: |
|
|
|
case USB_POWER_CDP: |
|
|
|
// been CLICKS clicks since we switched to CDP
|
|
|
|
// been CLICKS_BOOTUP clicks since we switched to CDP
|
|
|
|
if ((cnt-marker) >= CLICKS) { |
|
|
|
if ((cnt-marker) >= CLICKS_BOOTUP ) { |
|
|
|
// measure current draw, if positive and no enumeration, switch to DCP
|
|
|
|
// measure current draw, if positive and no enumeration, switch to DCP
|
|
|
|
if (!is_enumerated && current < CURRENT_THRESHOLD) { |
|
|
|
if (!is_enumerated && current < CURRENT_THRESHOLD) { |
|
|
|
puts("USBP: no enumeration with current draw, switching to DCP mode\n"); |
|
|
|
puts("USBP: no enumeration with current draw, switching to DCP mode\n"); |
|
|
|