[usb] Fix synchronous transfer event loop (#464)
[usb] Fix synchronous transfer event loop (#464)

We need to call libusb_handle_events_completed() in a loop: this
function doesn't promise that the specified transfer (identified by the
"completed" variable) completes, but it only promises to process one
asynchronous event from any transfer in flight.

Before this fix, it could've happened that we returned to the caller
before the transfer actually finishes.

This commit is part of the WebUSB support effort tracked by #429.
GoogleChromeLabs/chromeos_smart_card_connector,GoogleChromeLabs/chromeos_smart_card_connector,GoogleChromeLabs/chromeos_smart_card_connector,GoogleChromeLabs/chromeos_smart_card_connector,GoogleChromeLabs/chromeos_smart_card_connector,googlechromelabs/chromeos_smart_card_connector,GoogleChromeLabs/chromeos_smart_card_connector,googlechromelabs/chromeos_smart_card_connector,googlechromelabs/chromeos_smart_card_connector,googlechromelabs/chromeos_smart_card_connector,googlechromelabs/chromeos_smart_card_connector,googlechromelabs/chromeos_smart_card_connector