mikaelpatel/Cosa — pull request #256 by jediunix (2014-11-12 16:06:54+00:00)
Title: Fix CDC::begin hang when no host is present

When no host is present CDC::begin hangs in USBDevice::attach. This change waits 2 seconds before giving up on the host. If no host is connected within that time USB data is disabled but USB power regulator is left on in case power comes from a USB power adapter.

I have a 32U4. When I power from a USB adapter CDC::begin hangs. Since this is the usual trace device this would be a normal situation.

Although this has been tested with 32U4 I'm unsure about the change being complete. I'm also unsure about the 2 second timeout; perhaps it should be longer.

While I haven't tested, I assume the same issue is present if power comes from a source other than USB.