summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2015-03-11 15:33:48 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2015-03-12 03:42:28 -0700
commit82adf8aab74588db77a8dbc22525ca19b495db6f (patch)
treec62d4e929b0ff5c2c153a763d71318b5e7d501e2
parent0eedb2a0954e4e7153758b925b1564782a2c0ce9 (diff)
downloaddeviced-82adf8aab74588db77a8dbc22525ca19b495db6f.tar.gz
deviced-82adf8aab74588db77a8dbc22525ca19b495db6f.tar.bz2
deviced-82adf8aab74588db77a8dbc22525ca19b495db6f.zip
Currently, runtime-info uses VCONFKEY_SYSMAN_USB_STATUS vconf key to judge if usb is connected or not. Deviced will update the vconf key whenever usb is changed. Change-Id: I97ab2e9a7a8228fe33b14297b4c002398fd9532c Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
-rw-r--r--src/usb/usb.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/usb/usb.c b/src/usb/usb.c
index 6de4bd35..44d5d2d0 100644
--- a/src/usb/usb.c
+++ b/src/usb/usb.c
@@ -18,6 +18,7 @@
#include <stdio.h>
+#include <vconf.h>
#include "core/log.h"
#include "core/list.h"
@@ -137,7 +138,8 @@ static int usb_config_disable(void)
static int usb_state_changed(int status)
{
- static int old = USB_DISCONNECTED;
+ static int old = -1; /* to update at the first time */
+ int vconf_state;
int ret;
_I("USB state is changed from (%d) to (%d)", old, status);
@@ -149,10 +151,15 @@ static int usb_state_changed(int status)
case USB_CONNECTED:
_I("USB cable is connected");
ret = usb_config_enable();
+ if (ret == 0)
+ vconf_state = VCONFKEY_SYSMAN_USB_AVAILABLE;
+ else
+ vconf_state = VCONFKEY_SYSMAN_USB_CONNECTED;
break;
case USB_DISCONNECTED:
_I("USB cable is disconnected");
ret = usb_config_disable();
+ vconf_state = VCONFKEY_SYSMAN_USB_DISCONNECTED;
break;
default:
_E("Invalid USB state(%d)", status);
@@ -163,6 +170,7 @@ static int usb_state_changed(int status)
else
old = status;
+ vconf_set_int(VCONFKEY_SYSMAN_USB_STATUS, vconf_state);
return ret;
}
@@ -180,7 +188,7 @@ static void usb_init(void *data)
if (ret < 0)
_E("Failed to initialize usb configuation");
- ret = usb_state_changed(&(extcon_usb_ops.status));
+ ret = usb_state_changed(extcon_usb_ops.status);
if (ret < 0)
_E("Failed to update usb status(%d)", ret);
}