On some exotic hardware, e.g. HP ProLiant Moonshot Cartridge servers there
are no usb controllers, so no usb devices at all.
In this case currently libusb_init will fail, because find_usbfs_path
fails. Many apps don't handle this gracefully, and even if they do not crash
the result still is not pretty, e.g.:
unable to initialize libusb: -99
Where one simply would expect empty output.
Since on systems using udev the usbfs path should always be /dev/bus/usb
(as that gets created by udev), simply assume /dev/bus/usb when build with
USE_UDEV and the path cannot be found in the traditional way.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
}
}
+/* On udev based systems without any usb-devices /dev/bus/usb will not
+ * exist. So if we've not found anything and we're using udev for hotplug
+ * simply assume /dev/bus/usb rather then making libusb_init fail. */
+#if defined(USE_UDEV)
+ if (ret == NULL)
+ ret = "/dev/bus/usb";
+#endif
+
if (ret != NULL)
usbi_dbg("found usbfs at %s", ret);
-#define LIBUSB_NANO 10993
+#define LIBUSB_NANO 10994