summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorINSUN PYO <insun.pyo@samsung.com>2020-01-28 17:40:43 +0900
committerINSUN PYO <insun.pyo@samsung.com>2020-01-28 09:32:28 +0000
commitdc10d02f8a1fee855bce0d99ef2af77b3fe4043e (patch)
tree6553d42336f186c562112ee3c01bafa0cd957959
parent641eca1920c453595651fea10bc5ee5185081880 (diff)
downloadlibdevice-node-dc10d02f8a1fee855bce0d99ef2af77b3fe4043e.tar.gz
libdevice-node-dc10d02f8a1fee855bce0d99ef2af77b3fe4043e.tar.bz2
libdevice-node-dc10d02f8a1fee855bce0d99ef2af77b3fe4043e.zip
Add USB rndis_handler for rndis modesubmit/tizen_5.5/20200128.093910
Rndis mode needs rndis.service and sshd.service. Also, rndis.service should run first, and sshd.service should run later. The rndis_handler starts rndis.service and service trigger starts sshd.service. Change-Id: I1a2f3960b257ce56a7d49e47848ab11021ad418e (cherry picked from commit 90247ab0794ce0dde0d1bd5f8378fa0a055b5129)
-rw-r--r--hw/usb_gadget.h4
-rw-r--r--hw/usb_gadget_common.c10
2 files changed, 13 insertions, 1 deletions
diff --git a/hw/usb_gadget.h b/hw/usb_gadget.h
index 8533228..f61f966 100644
--- a/hw/usb_gadget.h
+++ b/hw/usb_gadget.h
@@ -165,6 +165,8 @@ out_nomem:
return -ENOMEM;
}
+void rndis_handler(int enable);
+
#define DEFINE_USB_FUNCTION(_id, _name, _ffs_service, _service, _handler) \
static struct usb_function _##_name##_function = { \
.id = _id, \
@@ -184,7 +186,7 @@ DEFINE_USB_FUNCTION(USB_FUNCTION_CONN_GADGET, conn_gadget, NULL, NULL,
DEFINE_USB_FUNCTION(USB_FUNCTION_SDB, sdb, "sdbd", NULL, NULL);
DEFINE_USB_FUNCTION(USB_FUNCTION_MTP, mtp, "mtp-responder", NULL, NULL);
DEFINE_USB_FUNCTION(USB_FUNCTION_ACM, acm, NULL, "data-router", NULL);
-DEFINE_USB_FUNCTION(USB_FUNCTION_RNDIS, rndis, NULL, "rndis", NULL);
+DEFINE_USB_FUNCTION(USB_FUNCTION_RNDIS, rndis, NULL, "sshd", rndis_handler);
#undef DEFINE_USB_FUNCTION
#define MAKE_FUNC_AVAILABLE(_name, _vname) \
diff --git a/hw/usb_gadget_common.c b/hw/usb_gadget_common.c
index e629b47..e9db26a 100644
--- a/hw/usb_gadget_common.c
+++ b/hw/usb_gadget_common.c
@@ -24,6 +24,8 @@
#include <errno.h>
#include <string.h>
+#include <libsyscommon/dbus-systemd.h>
+
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
#define zalloc(amount) calloc(1, amount)
@@ -397,6 +399,14 @@ out:
return ret;
}
+void rndis_handler(int enable)
+{
+ if (enable)
+ (void)systemd_start_unit_wait_started("rndis.service", NULL, -1);
+ else
+ (void)systemd_stop_unit_wait_stopped("rndis.service", NULL, -1);
+}
+
EXPORT
int simple_translator_open(struct hw_info *info,
const char *id, struct hw_common **common)