usb: patches to selectively support both slp and functionfs
[platform/adaptation/samsung_exynos/device-manager-plugin-exynos5433.git] / hw / usb_client / usb_client.c
index df5229a..824e562 100644 (file)
@@ -23,6 +23,7 @@
 #include <limits.h>
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 #include <systemd/sd-bus.h>
 
 #define zalloc(amount) calloc(1, amount)
@@ -715,6 +716,10 @@ static int legacy_gadget_open(struct hw_info *info,
        if (!info || !common)
                return -EINVAL;
 
+       /* check if slp usb gadget exists */
+       if (access("/sys/class/usb_mode/usb0/enable", F_OK))
+               return -ENOENT;
+
        legacy = zalloc(sizeof(*legacy));
        if (!legacy)
                return -ENOMEM;