diff options
author | INSUN PYO <insun.pyo@samsung.com> | 2020-02-18 13:41:52 +0900 |
---|---|---|
committer | Hyotaek Shim <hyotaek.shim@samsung.com> | 2020-02-18 06:26:36 +0000 |
commit | b54461f39296454dd32075e8ed84983199ce8d88 (patch) | |
tree | 2f9976cf3edcc50fe3444dace7a52ae18e2a6f86 | |
parent | 1f97debf475742c1f30ea0136b1622dad1a5d434 (diff) | |
download | libdevice-node-b54461f39296454dd32075e8ed84983199ce8d88.tar.gz libdevice-node-b54461f39296454dd32075e8ed84983199ce8d88.tar.bz2 libdevice-node-b54461f39296454dd32075e8ed84983199ce8d88.zip |
Use mtp-responder-dummy.socket when there is no mtp-responser.socketsubmit/tizen_5.5/20200220.232939submit/tizen_5.5/20200218.230832accepted/tizen/5.5/unified/20200221.094219
The mtp-responder.socket is special in the configfs environment.
If mtp-responder.socket is missing, gadget configuration will fail.
As a result, all usb operations do not work properly.
So in environments that mtp doesn't support, use dummy mtp.
Applied target : XU3, Artik headless, RPI4
Change-Id: I34bee7c1837ada478959407cd7c6500e219f28bc
(cherry picked from commit 0202291b7c1b3be3db32bba3001d51d7efe6a362)
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | hw/usb_gadget_common.c | 12 | ||||
-rw-r--r-- | mtp-responder-dummy/descs | bin | 0 -> 80 bytes | |||
-rw-r--r-- | mtp-responder-dummy/mtp-responder-dummy.service | 12 | ||||
-rw-r--r-- | mtp-responder-dummy/mtp-responder-dummy.socket | 6 | ||||
-rw-r--r-- | mtp-responder-dummy/strs | bin | 0 -> 30 bytes | |||
-rw-r--r-- | packaging/libdevice-node.spec | 4 |
7 files changed, 40 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 452fae7..4646bb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,12 @@ INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/hw/ DESTINATION include/hw CONFIGURE_FILE(hwcommon.pc.in hwcommon.pc @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/hwcommon.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) +# dummy mtp responder +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mtp-responder-dummy/strs DESTINATION /etc/mtp-responder-dummy) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mtp-responder-dummy/descs DESTINATION /etc/mtp-responder-dummy) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mtp-responder-dummy/mtp-responder-dummy.socket DESTINATION /usr/lib/systemd/system) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mtp-responder-dummy/mtp-responder-dummy.service DESTINATION /usr/lib/systemd/system) + IF(BUILD_GTESTS STREQUAL on) ADD_SUBDIRECTORY(unittest) ENDIF() diff --git a/hw/usb_gadget_common.c b/hw/usb_gadget_common.c index 2ecef99..fb6a986 100644 --- a/hw/usb_gadget_common.c +++ b/hw/usb_gadget_common.c @@ -23,6 +23,7 @@ #include <stdlib.h> #include <errno.h> #include <string.h> +#include <unistd.h> #include <libsyscommon/dbus-systemd.h> @@ -522,6 +523,17 @@ int simple_translator_open(struct hw_info *info, simple_translator->id_to_gadget = simple_id_to_gadget; simple_translator->cleanup_gadget = simple_cleanup_gadget; + /* Use mtp-responder-dummy.socket when there is no mtp-responser.socket. + * + * The mtp-responder.socket is special in the configfs environment. + * If mtp-responder.socket is missing, gadget configuration will fail. + * As a result, all usb operations do not work properly. + * So in environments that mtp doesn't support, use dummy mtp. + */ + if (access("/usr/lib/systemd/system/mtp-responder.socket", F_OK)) { + _available_funcs[USB_FUNCTION_IDX_MTP]->ffs_service = "mtp-responder-dummy"; + } + *common = &simple_translator->common; return 0; } diff --git a/mtp-responder-dummy/descs b/mtp-responder-dummy/descs Binary files differnew file mode 100644 index 0000000..0bffd51 --- /dev/null +++ b/mtp-responder-dummy/descs diff --git a/mtp-responder-dummy/mtp-responder-dummy.service b/mtp-responder-dummy/mtp-responder-dummy.service new file mode 100644 index 0000000..04e7258 --- /dev/null +++ b/mtp-responder-dummy/mtp-responder-dummy.service @@ -0,0 +1,12 @@ +[Unit] +Description=MTP dummy responder +StartLimitIntervalSec=0 + +[Service] +User=network_fw +Group=network_fw +RemainAfterExit=yes +ExecStart=/usr/bin/true +SmackProcessLabel=System +USBFunctionDescriptors=/etc/mtp-responder-dummy/descs +USBFunctionStrings=/etc/mtp-responder-dummy/strs diff --git a/mtp-responder-dummy/mtp-responder-dummy.socket b/mtp-responder-dummy/mtp-responder-dummy.socket new file mode 100644 index 0000000..3f84ab7 --- /dev/null +++ b/mtp-responder-dummy/mtp-responder-dummy.socket @@ -0,0 +1,6 @@ +[Unit] +Description=MTP dummy responder functionfs socket + +[Socket] +ListenUSBFunction=/dev/usb-funcs/mtp/default +TriggerLimitIntervalSec=0 diff --git a/mtp-responder-dummy/strs b/mtp-responder-dummy/strs Binary files differnew file mode 100644 index 0000000..b0bd4ab --- /dev/null +++ b/mtp-responder-dummy/strs diff --git a/packaging/libdevice-node.spec b/packaging/libdevice-node.spec index 2f9b9f0..809904f 100644 --- a/packaging/libdevice-node.spec +++ b/packaging/libdevice-node.spec @@ -54,6 +54,10 @@ make %{?jobs:-j%jobs} %manifest %{name}.manifest %license LICENSE.Apache-2.0 %{_libdir}/*.so.* +%{_unitdir}/mtp-responder-dummy.socket +%{_unitdir}/mtp-responder-dummy.service +/etc/mtp-responder-dummy/strs +/etc/mtp-responder-dummy/descs %files devel %manifest %{name}.manifest |