Merge pull request #502 from kanoi/master

Klondike temp checking and read buffer size
Convert all usb control transfers to asynchronous communication with our own timeout management as well.
Merge branch 'master' of github.com:ckolivas/cgminer
Add a hash_driver_work function to allow for drivers that wish to do their own work queueing and management.
Convert the bitfury driver to use the hash_driver_work version of hash_work.
Provide a lower level __bin2hex function that does not allocate memory itself.
Use stack memory in test_work_current, avoiding a malloc/free cycle each time.
Use stack memory for hex used in stratum share submissions.
Use a timeout with usb handle events set to a nominal 200ms and wait for the polling thread to shut down before deinitialising libusb.
Although async transfers are meant to use heap memory, we never return before the transfer function has completed so stack memory will suffice for control transfers, fixing a memory leak in the process.
Do not perform bfi int patching for opencl1.2 or later.
Free a libusb transfer after we have finished using it to avoid a dereference in usb_control_transfer
Use a write lock when performing any USB control transfers to prevent concurrent transfers.
Lock mutex before second pthread_cond_wait in usbutils to prevent a race.
Do not use locking on usb callback function pthread signalling to prevent deadlock with libusb's own event lock.
Use the one LIBUSB_ERROR_TIMEOUT for cancelled transactions since this error is explicitly tested for in various drivers.
Implement a generic cgsem_mswait similar to sem_timedwait
Fix util.h exports for cgsem_mswait
Check for correct timeout error in cgsem_mswait
Convert the usb callback function to use a cgsem_t using the timedwait code to avoid races with mutexes/conditionals.