io: Ensure all pending events are consumed in one libusb_handle_events call

Before this patch if ie multiple hot-plug events were pending, multiple
handle_events calls would be necessary to handle them all, this patch
changes handle_events so that the poll is re-done to check for more events
if there was activity on any of the special fds.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
hotplug: Fix usb_device memleak with hotunplug events pending on libusb_exit

Closes #150

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
core: Make LIBUSB_DEBUG environment variable also work from libusb_exit

libusb_exit sets usbi_default_context to NULL, modify usbi_log_v so that
it still honors the  LIBUSB_DEBUG environment variable in this case.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Windows: Fix a crash when HID transfers return no data

* Issue reported by Surmakyynis
* Closes #160
core: fix Doxygen warning

libusbx/libusb/libusb.h:153: warning: no matching file member found for
libusb_cpu_to_le16()Possible candidates:
  static uint16_t libusb_cpu_to_le16(const uint16_t x)

Thanks to Serhat Sevki Dincer for the bug report
http://sourceforge.net/mailarchive/message.php?msg_id=31719691
Windows: Add Visual Studio 2013 solution files

* Also update gitignore
* Closes #162
WIP patch provided by Philippe Houdoin, merged into libusbx up-to-date version.

TODO list :
 * Actual management of USB transfers. Needs an USBTransfer class and a worker threadfor each usb_device_handle, should wake up haiku_handle_events (backend asynchronous
function) via a pipe
 * The configuration descriptor is hand-built, while there actually are APIs in Haiku usb kit to get it.

Dynamic detection and enumeration, descriptors are working as expected.

Conflicts:
	configure.ac
	libusb/Makefile.am
	libusb/core.c
	libusb/libusbi.h
Get the Haiku patch compiling against head libusbx
Get things to actually work.

 * Fixup autoconf script to do things more like on other platforms
 * Use "hotplug" mode instead of a static device list (hot-unplug doesn't work yet)

This gets the simple listdev test work without a crash. Yay!
From 0a991f55a85767b6d0bff4690c2e4236bcccbeb1 Mon Sep 17 00:00:00 2001
From: Philippe Houdoin <philippe.houdoin@gmail.com>
* Cache actual configuration(s) whole descriptor(s) by retrieving them simply from device.
* when a device is added/removed, handle each active context, not just default one.
* implement hot unplug support as well. Untested on real hardware yet.
Several fixes, allowing stress tests to pass:
- fix broken deviceWasAllocated logic in _AddNewDevice(), fixing the
  crash observed before.
- start only once our UsbRoster at first context init, and stop it at last exit.
- add trace to track UsbRoster's DeviceAdded/Removed() : seems that
BUSBRoster:DeviceRemoved() is only called on hub nodes!?
Fixed hotplug issue.
BUSBRoster will only notify device removal for those where DeviceAdded()
returned B_OK.
This make libusbx hotplug works under Haiku too.
Control transfer 16bits wide parameters are set in bus order.
Some work towards getting transfers working

 - Actually start the worker thread and get it spinning
 - Submit transfers and try to get the result when they are complete
 - Also implement clock_gettime (code stolen from netBSD port) as the
 debug message was bothering me.