cleaned up and compatible with older libusb-1.0