feature: add feature check routine 79/86879/1
authortaeyoung <ty317.kim@samsung.com>
Mon, 5 Sep 2016 10:27:11 +0000 (19:27 +0900)
committertaeyoung <ty317.kim@samsung.com>
Mon, 5 Sep 2016 10:27:11 +0000 (19:27 +0900)
- "http://tizen.org/feature/usb.host" feature is required
  to use usb host apis. Thus the feature check routine is added.

Change-Id: I291bc5bfc67c8348d48edea8738c349237057a06
Signed-off-by: taeyoung <ty317.kim@samsung.com>
CMakeLists.txt
packaging/capi-system-usbhost.spec
src/usb_host.c

index 3fabc8d67bb639a3775e4436e223eac7f1edf977..41d1014a274d50374dc1fd9a97ce9b5cb7c6499d 100644 (file)
@@ -26,6 +26,7 @@ IF(BUILD_SHARED_LIBS)
                ${PKG_MODULES}
                libusb-1.0
                dlog
+               capi-system-info
        )
 ENDIF()
 
index ed54d65971b01c5836d19f78fa7e4ff37e5d9f66..59a9c6a3740a7fcdf99c41b789dface4fb89911d 100644 (file)
@@ -12,6 +12,7 @@ BuildRequires:  cmake
 BuildRequires:  libattr-devel
 BuildRequires:  pkgconfig(libusb-1.0)
 BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(capi-system-info)
 
 %description
 Usb-host is a librarary for raw communication with USB devices.
index e5e836fa1b12b24710ff879e226312e53c42a985..23ead0be32f881977b15f85bfcbcb560943cbdc7 100644 (file)
@@ -23,6 +23,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/queue.h>
+#include <system_info.h>
 
 #include "usb_host.h"
 #include "uref.h"
 
 #include "usb_host_internal.h"
 
+static int usb_host_feature_enabled(void)
+{
+       int ret;
+       bool val;
+       static int enabled = -1;
+
+       if (enabled >= 0)
+               return enabled;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/usb.host", &val);
+       if (ret == SYSTEM_INFO_ERROR_NONE && val)
+               enabled = 1;
+       else {
+               _E("USB Host API is not supported");
+               enabled = 0;
+       }
+
+       return enabled;
+}
+
 static inline struct usb_host_device_s *to_usb_host_device(struct uref *_uref)
 {
        return container_of(_uref, struct usb_host_device_s, ref);
@@ -345,6 +366,9 @@ int usb_host_create(usb_host_context_h *ctx)
        int count = 10;
        struct usb_host_context_s *_ctx;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!ctx) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -379,6 +403,9 @@ out:
 
 int usb_host_destroy(usb_host_context_h context)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!context) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -394,6 +421,9 @@ int usb_host_device_open(usb_host_device_h dev)
 {
        int ret = USB_HOST_ERROR_OUT_OF_MEMORY;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -410,6 +440,9 @@ int usb_host_device_open(usb_host_device_h dev)
 
 int usb_host_device_close(usb_host_device_h dev)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -434,6 +467,9 @@ int usb_host_device_open_with_vid_pid(usb_host_context_h ctx,
        libusb_device_handle *ldev_handle;
        libusb_device *ldev;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!ctx || !device_handle) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -475,6 +511,9 @@ out:
 
 int usb_host_device_get_bus_number(usb_host_device_h dev, int *bus_number)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !bus_number) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -486,6 +525,8 @@ int usb_host_device_get_bus_number(usb_host_device_h dev, int *bus_number)
 
 int usb_host_device_get_address(usb_host_device_h dev, int *device_address)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
 
        if (!dev || !device_address) {
                _E("Invalid parameter was passed");
@@ -503,6 +544,9 @@ int usb_host_device_get_port_numbers(usb_host_device_h dev, int *port_numbers, i
        int ret = 0;
        int i;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (port_numbers_len <= 0) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -530,6 +574,9 @@ int usb_host_get_device_list(usb_host_context_h context, usb_host_device_h **dev
        struct usb_host_device_s *rdevice;
        struct usb_host_device_s **list;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!context || !devs || !length) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -577,6 +624,9 @@ out:
 
 int usb_host_ref_device(usb_host_device_h dev)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -589,6 +639,9 @@ int usb_host_ref_device(usb_host_device_h dev)
 
 int usb_host_unref_device(usb_host_device_h dev)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -603,6 +656,9 @@ int usb_host_free_device_list(usb_host_device_h *devs, bool unref_devices)
        int i = 0;
        int ret;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!devs) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -627,6 +683,9 @@ int usb_host_get_active_config(usb_host_device_h dev, usb_host_config_h *config)
        struct libusb_config_descriptor *lcfg_desc;
        struct usb_host_config_s *cfg;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !config) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -672,6 +731,9 @@ int usb_host_set_config(usb_host_config_h configuration)
        int ret;
        struct usb_host_device_s *dev;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!configuration) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -700,6 +762,9 @@ int usb_host_claim_interface(usb_host_interface_h interface, bool force)
        int interface_number;
        struct libusb_device_handle *lusb_dev_handle;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!interface) {
                _E("Invalid parameter");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -764,6 +829,9 @@ int usb_host_release_interface(usb_host_interface_h interface)
        int interface_number;
        struct libusb_device_handle *lusb_dev_handle;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!interface) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -800,6 +868,9 @@ out:
 
 int usb_host_device_get_bcd_usb(usb_host_device_h dev, int *bcd_usb)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !bcd_usb) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -810,6 +881,9 @@ int usb_host_device_get_bcd_usb(usb_host_device_h dev, int *bcd_usb)
 
 int usb_host_device_get_class(usb_host_device_h dev, int *device_class)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !device_class) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -821,6 +895,9 @@ int usb_host_device_get_class(usb_host_device_h dev, int *device_class)
 
 int usb_host_device_get_sub_class(usb_host_device_h dev, int *subclass)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !subclass) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -832,6 +909,9 @@ int usb_host_device_get_sub_class(usb_host_device_h dev, int *subclass)
 
 int usb_host_device_get_protocol(usb_host_device_h dev, int *protocol)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !protocol) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -843,6 +923,9 @@ int usb_host_device_get_protocol(usb_host_device_h dev, int *protocol)
 
 int usb_host_device_get_max_packet_size_0(usb_host_device_h dev, int *max_packet_size)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !max_packet_size) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -854,6 +937,9 @@ int usb_host_device_get_max_packet_size_0(usb_host_device_h dev, int *max_packet
 
 int usb_host_device_get_id_vendor(usb_host_device_h dev, int *vendor_id)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !vendor_id) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -865,6 +951,9 @@ int usb_host_device_get_id_vendor(usb_host_device_h dev, int *vendor_id)
 
 int usb_host_device_get_id_product(usb_host_device_h dev, int *product_id)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !product_id) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -876,6 +965,9 @@ int usb_host_device_get_id_product(usb_host_device_h dev, int *product_id)
 
 int usb_host_device_get_bcd_device(usb_host_device_h dev, int *device_bcd)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !device_bcd) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -887,6 +979,9 @@ int usb_host_device_get_bcd_device(usb_host_device_h dev, int *device_bcd)
 
 int usb_host_device_get_num_configurations(usb_host_device_h dev, int *num_configurations)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !num_configurations) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -897,6 +992,9 @@ int usb_host_device_get_num_configurations(usb_host_device_h dev, int *num_confi
 
 int usb_host_is_device_opened(usb_host_device_h dev, bool *is_opened)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !is_opened) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -908,6 +1006,9 @@ int usb_host_is_device_opened(usb_host_device_h dev, bool *is_opened)
 
 int usb_host_device_get_manufacturer_str(usb_host_device_h dev, int *length, unsigned char *data)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !data) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -919,6 +1020,9 @@ int usb_host_device_get_manufacturer_str(usb_host_device_h dev, int *length, uns
 
 int usb_host_device_get_product_str(usb_host_device_h dev, int *length, unsigned char *data)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !data) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -930,6 +1034,9 @@ int usb_host_device_get_product_str(usb_host_device_h dev, int *length, unsigned
 
 int usb_host_device_get_serial_number_str(usb_host_device_h dev, int *length, unsigned char *data)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !data) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -941,6 +1048,9 @@ int usb_host_device_get_serial_number_str(usb_host_device_h dev, int *length, un
 
 int usb_host_config_get_num_interfaces(usb_host_config_h config, int *num_interfaces)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!config || !num_interfaces) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -951,6 +1061,9 @@ int usb_host_config_get_num_interfaces(usb_host_config_h config, int *num_interf
 
 int usb_host_config_is_self_powered(usb_host_config_h config, bool *self_powered)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!config || !self_powered) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -962,6 +1075,9 @@ int usb_host_config_is_self_powered(usb_host_config_h config, bool *self_powered
 
 int usb_host_config_support_remote_wakeup(usb_host_config_h config, bool *remote_wakeup)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!config || !remote_wakeup) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -975,6 +1091,9 @@ int usb_host_config_get_max_power(usb_host_config_h config, int *max_power)
 {
        int speed;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!config || !max_power) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -992,6 +1111,9 @@ int usb_host_config_get_max_power(usb_host_config_h config, int *max_power)
 
 int usb_host_device_get_config_str(usb_host_config_h config, int *length, unsigned char *data)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!config || !data) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1003,6 +1125,9 @@ int usb_host_device_get_config_str(usb_host_config_h config, int *length, unsign
 
 int usb_host_interface_get_number(usb_host_interface_h interface, int *number)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!interface || !number) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1014,6 +1139,9 @@ int usb_host_interface_get_number(usb_host_interface_h interface, int *number)
 
 int usb_host_interface_get_num_endpoints(usb_host_interface_h interface, int *num_endpoints)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!interface || !num_endpoints) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1026,6 +1154,9 @@ int usb_host_interface_get_num_endpoints(usb_host_interface_h interface, int *nu
 int usb_host_interface_get_str(usb_host_interface_h interface, int *length,
                unsigned char *data)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!interface || !data) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1037,6 +1168,9 @@ int usb_host_interface_get_str(usb_host_interface_h interface, int *length,
 
 int usb_host_endpoint_get_number(usb_host_endpoint_h ep, int *number)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!ep || !number) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1047,6 +1181,9 @@ int usb_host_endpoint_get_number(usb_host_endpoint_h ep, int *number)
 
 int usb_host_endpoint_get_direction(usb_host_endpoint_h ep, int* direction)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!ep || !direction) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1059,6 +1196,9 @@ int usb_host_endpoint_get_direction(usb_host_endpoint_h ep, int* direction)
 
 int usb_host_endpoint_get_transfer_type(usb_host_endpoint_h ep, int *transfer_type)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!ep || !transfer_type) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1087,6 +1227,9 @@ int usb_host_endpoint_get_transfer_type(usb_host_endpoint_h ep, int *transfer_ty
 
 int usb_host_endpoint_get_synch_type(usb_host_endpoint_h ep, int *synch_type)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!ep || !synch_type) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1115,6 +1258,9 @@ int usb_host_endpoint_get_synch_type(usb_host_endpoint_h ep, int *synch_type)
 
 int usb_host_endpoint_get_usage_type(usb_host_endpoint_h ep, int *usage_type)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!ep || !usage_type) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1139,6 +1285,9 @@ int usb_host_endpoint_get_usage_type(usb_host_endpoint_h ep, int *usage_type)
 
 int usb_host_endpoint_get_max_packet_size(usb_host_endpoint_h ep, int *max_packet_size)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!ep || !max_packet_size) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1150,6 +1299,9 @@ int usb_host_endpoint_get_max_packet_size(usb_host_endpoint_h ep, int *max_packe
 
 int usb_host_endpoint_get_interval(usb_host_endpoint_h ep, int *interval)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!ep || !interval) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1163,6 +1315,9 @@ int usb_host_config_destroy(usb_host_config_h config)
 {
        int i;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!config) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1182,6 +1337,8 @@ int usb_host_config_destroy(usb_host_config_h config)
 int usb_host_interface_get_endpoint(usb_host_interface_h interface, int ep_index,
                usb_host_endpoint_h *ep)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
 
        if (!interface || !ep || ep_index >= interface->altsettings[interface->altsetting].num_endpoints) {
                _E("Invalid parameter was passed");
@@ -1194,6 +1351,9 @@ int usb_host_interface_get_endpoint(usb_host_interface_h interface, int ep_index
 
 int usb_host_interface_set_altsetting(usb_host_interface_h interface, int altsetting)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!interface || altsetting < 0 || altsetting >= interface->num_altsettings) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1204,6 +1364,9 @@ int usb_host_interface_set_altsetting(usb_host_interface_h interface, int altset
 
 int usb_host_config_get_interface(usb_host_config_h config, int interface_index, usb_host_interface_h *interface)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!interface || !config || interface_index < 0 || interface_index >= config->num_interfaces) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1215,6 +1378,9 @@ int usb_host_config_get_interface(usb_host_config_h config, int interface_index,
 
 int usb_host_device_get_config(usb_host_device_h dev, int config_index, usb_host_config_h *config)
 {
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !config) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1258,6 +1424,9 @@ int usb_host_device_get_string_descriptor_ascii(usb_host_device_h dev,
 {
        int ret;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !data || !length) {
                _E("Invalid parameter was passed");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1285,6 +1454,9 @@ int usb_host_control_transfer(usb_host_device_h dev, uint8_t bmRequestType,
 {
        int ret;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!dev || !data || !transfered) {
                _E("Invalid parameter");
                return USB_HOST_ERROR_INVALID_PARAMETER;
@@ -1372,6 +1544,9 @@ int usb_host_transfer(usb_host_endpoint_h ep, unsigned char *data, int length,
 {
        int type;
 
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
        if (!ep) {
                _E("Inavlid parameter");
                return USB_HOST_ERROR_INVALID_PARAMETER;