libusb: check for failure of hid_init()

Return NULL from hid_enumerate() and hid_open_path() if hid_init() fails.
linux/libusb: do not check bDeviceClass on enumeration

Some composite devices do not have bDeviceClass set to
LIBUSB_CLASS_PER_INTERFACE and were ignored when enumerating HID devices.

Ignore checking the bDeviceClass as we will be checking interface
bInterfaceClass later anyway.

Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
linux: Use poll() even in non-blocking mode

It appears that calls to read() when in non-blocking mode will not set errno
to other than EAGAIN when the a device has been disconnected.  Note that
this is the same errno code set when there is simply no data to return.

Make it so that poll() is used, in non-blocking mode, to check the
status of the device. In blocking mode though, poll() is not needed.
mac: Unregister the proper removal callback in hid_close()

Unregister from IOHIDManager instead of IOHIDDevice.

Thanks to github user tomsor for noticing this.
windows: Fix leak of event handle on open_device() failure

Create a new free_hid_device() function which takes care of all the
resources in hid_device which may need to be freed/released.

Reported-by: Johan Lindh <johan@linkdata.se>