Check for async transfer variants of error messages.
Limit ms_tdiff to 1 hour as a sanity check.
Minimise the time between dropping the read devlock and grabbing the write devlock to avoid tons of logging spam in the interim.
Check a pool is stable for >5 mins before switching back to it.
Try switching pools if for some reason we end up with only idle pools and have ended up current_pool set to an idle one.
Merge branch 'master' into async

Conflicts:
	api.c
	cgminer.c
	miner.h
	usbutils.c
	util.c
Remove unused variables.
Revert "Check for the async variants of the libusb errors and retry up to retry max when trying to clear a pipe error/stall."

This reverts commit c7d5256b3657bd6d4f2f04f7288cd757bcbf77a5.
Check for async transfer variants of error messages.
Enable the usb buffer in avalon driver.
Limit ms_tdiff to 1 hour as a sanity check.
Use libusb's own error name function instead of hand coding the error names.
Display errors on failed usb read and write and consider sequential IO errors a permanent failure.
Further smooth out avalon hashrate by limiting the maximum number of nonces counted each cycle to 1 per miner, saving them for later cycles.
Revert "Further smooth out avalon hashrate by limiting the maximum number of nonces counted each cycle to 1 per miner, saving them for later cycles."

This reverts commit 7be59992c121a61e56402cec21508e39401fad6c.

Of dubious utility since a full nonce range is not scanned before loading more work.
Check return values when attempting to open a BF1 device and set the msg size as a macro.
Failing to add_cgpu in bitfury should be a terminal failure.
Make the bf1 getinfo size a macro
Kill off threads that have failed using hash_sole_work instead of just disabling them.
CMR allow sending flash and clock commands