From a9d76751ed87ae59949aa050a6268a2def70d208 Mon Sep 17 00:00:00 2001 From: taeyoung Date: Tue, 20 Sep 2016 16:32:14 +0900 Subject: [PATCH] usbhost api: do not search the usbfs path for Mobile profile - Currently, usb host api is supported only for the Mobile profile. Thus usbfs path is not searched only for the Mobile profile. Change-Id: I7ce753dc6e0730171c0a9996434183717f054d1d Signed-off-by: taeyoung --- libusb/os/linux_usbfs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c index 73f68f6..e6d1e11 100644 --- a/libusb/os/linux_usbfs.c +++ b/libusb/os/linux_usbfs.c @@ -433,10 +433,17 @@ static int op_init(struct libusb_context *ctx) struct stat statbuf; int r; - +#ifdef USE_DEVICED /* find_usbfs_path() may fail if there are no devices connected. * We assume that /dev/bus/usb is usbfs mount point. */ usbfs_path = "/dev/bus/usb"; +#else + usbfs_path = find_usbfs_path(); + if (!usbfs_path) { + usbi_err(ctx, "could not find usbfs"); + return LIBUSB_ERROR_OTHER; + } +#endif if (monotonic_clkid == -1) monotonic_clkid = find_monotonic_clock(); -- 2.7.4