summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungjae Cho <y0.cho@samsung.com>2022-04-28 17:02:38 +0900
committerYoungjae Cho <y0.cho@samsung.com>2022-05-02 15:38:58 +0900
commitd69cd576f2b173d0e8b08998cb2e650bfbfd511a (patch)
treec16fe3f17e24f0516fc0250410b246d0bd15a3fb
parenta934858bd51847d7bd703860cd54eec90995726d (diff)
downloaddevice-tm1-accepted/tizen_unified.tar.gz
device-tm1-accepted/tizen_unified.tar.bz2
device-tm1-accepted/tizen_unified.zip
The actual operation of usb-gadget is no more hal dependent. Instead, the deviced is now in charge of running usb-gadget. The hal backend has changed to provide only target specific usb-gadget configurations. If there is no target specific configurations, deviced runs usb-gadget with default configurations. Change-Id: Iaf124c6413f0de5c4636edea4d936754444654b7 Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
-rw-r--r--CMakeLists.txt1
-rw-r--r--conf/usb-gadget.conf18
-rw-r--r--hw/usb_gadget/CMakeLists.txt18
-rw-r--r--hw/usb_gadget/usb_gadget.c81
-rw-r--r--packaging/hal-backend-device-tm1.spec5
5 files changed, 23 insertions, 100 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f1880cb..d2e3009 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,6 @@ ADD_SUBDIRECTORY(hw/external_connection)
ADD_SUBDIRECTORY(hw/touchscreen)
ADD_SUBDIRECTORY(hw/ir)
ADD_SUBDIRECTORY(hw/thermal)
-ADD_SUBDIRECTORY(hw/usb_gadget)
ADD_SUBDIRECTORY(hw/board)
ADD_SUBDIRECTORY(hw/haptic)
ADD_SUBDIRECTORY(hw/memory)
diff --git a/conf/usb-gadget.conf b/conf/usb-gadget.conf
new file mode 100644
index 0000000..d2abda4
--- /dev/null
+++ b/conf/usb-gadget.conf
@@ -0,0 +1,18 @@
+#[SystemdUnit]
+#Service=diag.service
+#RemainAfterDisable=yes
+#
+#[Attribute]
+#Function=diag|rmnet
+#idVendor=0x05c6
+#idProduct=0x901d
+#
+#[Attribute]
+#Function=acm|diag
+#idVendor=0x05c6
+#idProduct=0x901d
+#
+#[Attribute]
+#Function=diag
+#idVendor=0x05c6
+#idProduct=0x901d
diff --git a/hw/usb_gadget/CMakeLists.txt b/hw/usb_gadget/CMakeLists.txt
deleted file mode 100644
index 7146f92..0000000
--- a/hw/usb_gadget/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(hal-backend-device-usb-gadget C)
-
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(hal-backend-device-usb-gadget_pkgs REQUIRED hal-backend-device-common)
-
-FOREACH(flag ${hal-backend-device-usb-gadget_pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-
-ADD_LIBRARY(${PROJECT_NAME} MODULE usb_gadget.c)
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${hal-backend-device-usb-gadget_pkgs_LDFLAGS})
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${HAL_LIB_DIR} COMPONENT RuntimeLibraries)
diff --git a/hw/usb_gadget/usb_gadget.c b/hw/usb_gadget/usb_gadget.c
deleted file mode 100644
index 98d4e25..0000000
--- a/hw/usb_gadget/usb_gadget.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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 <errno.h>
-#include <stdlib.h>
-
-#include <hal/hal-common-interface.h>
-#include <hal/device/hal-usb_gadget-interface.h>
-
-#include </hal/include/device/hal-backend-common-usb_gadget.h>
-#include </hal/include/device/hal-backend-common.h>
-
-static int usb_gadget_init(void **data)
-{
- hal_backend_usb_gadget_funcs *usb_gadget_funcs;
-
- if (!data)
- return -EINVAL;
-
- usb_gadget_funcs = calloc(1, sizeof(hal_backend_usb_gadget_funcs));
- if (!usb_gadget_funcs)
- return -ENOMEM;
-
- // usb_gadget_translator
- if (simple_translator_open(usb_gadget_funcs)) {
- _E("No USB gadget translator");
- goto error_translator_open;
- }
-
- // usb_client
- if (hw_legacy_gadget_open(usb_gadget_funcs)) {
- _I("No USB client");
- goto error_gadget_open;
- }
-
- *data = (void *)usb_gadget_funcs;
-
- return 0;
-
-error_gadget_open:
- simple_translator_close(usb_gadget_funcs);
-
-error_translator_open:
- free(usb_gadget_funcs);
-
- return -ENODEV;
-}
-
-static int usb_gadget_exit(void *data)
-{
- hal_backend_usb_gadget_funcs *usb_gadget_funcs = (hal_backend_usb_gadget_funcs *)data;
-
- if (usb_gadget_funcs) {
- hw_legacy_gadget_close(usb_gadget_funcs);
- simple_translator_close(usb_gadget_funcs);
- free(usb_gadget_funcs);
- }
-
- return 0;
-}
-
-hal_backend EXPORT hal_backend_device_usb_gadget_data = {
- .name = "usb_gadget",
- .vendor = "SC7730",
- .abi_version = HAL_ABI_VERSION_TIZEN_7_0,
- .init = usb_gadget_init,
- .exit = usb_gadget_exit,
-};
diff --git a/packaging/hal-backend-device-tm1.spec b/packaging/hal-backend-device-tm1.spec
index be6f353..735814e 100644
--- a/packaging/hal-backend-device-tm1.spec
+++ b/packaging/hal-backend-device-tm1.spec
@@ -35,6 +35,10 @@ make %{?jobs:-j%jobs}
%install
rm -rf %{buildroot}
+# install conf files
+mkdir -p %{buildroot}%{_hal_sysconfdir}/deviced
+install -m 644 conf/*.conf %{buildroot}%{_hal_sysconfdir}/deviced
+
mkdir -p %{buildroot}%{_prefix}/lib/udev/rules.d
install -m 644 rules/61-video.rules %{buildroot}%{_prefix}/lib/udev/rules.d
@@ -49,3 +53,4 @@ install -m 644 rules/61-video.rules %{buildroot}%{_prefix}/lib/udev/rules.d
%manifest %{name}.manifest
%{_hal_licensedir}/%{name}/LICENSE.Apache-2.0
%{_prefix}/lib/udev/rules.d/61-video.rules
+%{_hal_sysconfdir}/deviced/*