diff options
author | taeyoung <ty317.kim@samsung.com> | 2016-06-18 17:32:56 +0900 |
---|---|---|
committer | Taeyoung Kim <ty317.kim@samsung.com> | 2016-06-18 03:05:58 -0700 |
commit | d83f3338473f676a92acbc4dbc6b36feec40ae65 (patch) | |
tree | 733c20318996a9507e3b1859380cea659e5341bb | |
parent | 2f17195bc47ca604d1a41f9299f80c2d395f93de (diff) | |
download | deviced-accepted/tizen/ivi/20160620.081239.tar.gz deviced-accepted/tizen/ivi/20160620.081239.tar.bz2 deviced-accepted/tizen/ivi/20160620.081239.zip |
usb: handle usb connection on emulatorsubmit/tizen/20160618.100730accepted/tizen/wearable/20160620.081224accepted/tizen/tv/20160620.081202accepted/tizen/mobile/20160620.081148accepted/tizen/ivi/20160620.081239accepted/tizen/common/20160620.163455
- On emulator, There is no usb configuration concept.
Thus usb connection operataion was failed during
setting configuration.
- Now, usb configuration is skipped on emulator.
Thus other states are updated, and indicator shows
the usb icon.
Change-Id: If3756cde29ac25f09ef2aa82636dac1b471e9356
Signed-off-by: taeyoung <ty317.kim@samsung.com>
-rw-r--r-- | src/usb/usb-default.c | 7 | ||||
-rw-r--r-- | src/usb/usb-emulator.c | 46 | ||||
-rw-r--r-- | src/usb/usb.c | 12 |
3 files changed, 57 insertions, 8 deletions
diff --git a/src/usb/usb-default.c b/src/usb/usb-default.c index bd67a18d..a634be16 100644 --- a/src/usb/usb-default.c +++ b/src/usb/usb-default.c @@ -331,9 +331,12 @@ static const struct usb_config_plugin_ops default_plugin = { static bool usb_valid(void) { - /* TODO - * add checking default config valid condition */ +#ifdef TARGET + _I("This is target device"); return true; +#else + return false; +#endif } static const struct usb_config_plugin_ops *usb_load(void) diff --git a/src/usb/usb-emulator.c b/src/usb/usb-emulator.c new file mode 100644 index 00000000..83fad036 --- /dev/null +++ b/src/usb/usb-emulator.c @@ -0,0 +1,46 @@ +/* + * deviced + * + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include <stdio.h> +#include <stdbool.h> +#include "core/common.h" +#include "core/log.h" +#include "usb.h" + +static bool usb_valid(void) +{ +#ifdef EMULATOR + _I("This is emulator device"); + return true; +#else + return false; +#endif +} + +static const struct usb_config_plugin_ops *usb_load(void) +{ + return NULL; +} + +static const struct usb_config_ops usb_config_emulator_ops = { + .is_valid = usb_valid, + .load = usb_load, +}; + +USB_CONFIG_OPS_REGISTER(&usb_config_emulator_ops) diff --git a/src/usb/usb.c b/src/usb/usb.c index df8afdd5..d03a45f9 100644 --- a/src/usb/usb.c +++ b/src/usb/usb.c @@ -82,12 +82,12 @@ static int usb_config_init(void) { if (!config_plugin) { _E("There is no usb config plugin"); - return -ENOENT; + return 0; } if (config_plugin->init == NULL) { _E("There is no usb config init function"); - return -ENOENT; + return 0; } return config_plugin->init(NULL); @@ -114,12 +114,12 @@ static int usb_config_enable(void) if (!config_plugin) { _E("There is no usb config plugin"); - return -ENOENT; + return 0; } if (config_plugin->enable == NULL) { _E("There is no usb config enable function"); - return -ENOENT; + return 0; } if (usb_tethering_state()) @@ -134,12 +134,12 @@ static int usb_config_disable(void) { if (!config_plugin) { _E("There is no usb config plugin"); - return -ENOENT; + return 0; } if (config_plugin->disable == NULL) { _E("There is no usb config disable function"); - return -ENOENT; + return 0; } return config_plugin->disable(NULL); |