usb-gadget: remove usb-gadget and add configuration file 55/274555/1 accepted/tizen_7.0_unified_hotfix accepted/tizen_8.0_unified accepted/tizen_unified tizen_7.0_hotfix tizen_8.0 accepted/tizen/7.0/unified/20221110.062631 accepted/tizen/7.0/unified/hotfix/20221116.110403 accepted/tizen/8.0/unified/20231005.094451 accepted/tizen/unified/20220526.144149 submit/tizen/20220525.001052 tizen_7.0_m2_release tizen_8.0_m2_release
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 2 May 2022 08:11:37 +0000 (17:11 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 2 May 2022 08:11:37 +0000 (17:11 +0900)
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: I1dc5bbdacc0622ace2cfe88b89fcd3266ce61f63
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
CMakeLists.txt
conf/usb-gadget.conf [new file with mode: 0644]
hw/usb_gadget/CMakeLists.txt [deleted file]
hw/usb_gadget/usb_gadget.c [deleted file]
packaging/hal-backend-device-emulator.spec

index 1ac7295..4a9f6f6 100644 (file)
@@ -29,6 +29,5 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION ${HAL_LICENSE_DIR}
 ADD_SUBDIRECTORY(hw/battery)
 ADD_SUBDIRECTORY(hw/display)
 ADD_SUBDIRECTORY(hw/external_connection)
-ADD_SUBDIRECTORY(hw/usb_gadget)
 ADD_SUBDIRECTORY(hw/haptic)
 ADD_SUBDIRECTORY(hw/memory)
diff --git a/conf/usb-gadget.conf b/conf/usb-gadget.conf
new file mode 100644 (file)
index 0000000..d2abda4
--- /dev/null
@@ -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 (file)
index 7146f92..0000000
+++ /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 (file)
index f548efb..0000000
+++ /dev/null
@@ -1,90 +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 dummy_enable(void)
-{
-       return 0;
-}
-
-static int dummy_disable(void)
-{
-       return 0;
-}
-
-static int dummy_reconfigure_gadget(struct usb_gadget *gadget)
-{
-       return 0;
-}
-
-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_gadget_funcs->enable = dummy_enable;
-       usb_gadget_funcs->disable = dummy_disable;
-       usb_gadget_funcs->reconfigure_gadget = dummy_reconfigure_gadget;
-
-       *data = (void *)usb_gadget_funcs;
-
-       return 0;
-
-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) {
-               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 = "RPI",
-       .abi_version = HAL_ABI_VERSION_TIZEN_7_0,
-       .init = usb_gadget_init,
-       .exit = usb_gadget_exit,
-};
index 2972919..fd302c6 100644 (file)
@@ -36,6 +36,10 @@ make
 %install
 %make_install
 
+# install conf files
+mkdir -p %{buildroot}%{_hal_sysconfdir}/deviced
+install -m 644 conf/*.conf %{buildroot}%{_hal_sysconfdir}/deviced
+
 %post
 /sbin/ldconfig
 
@@ -47,3 +51,4 @@ make
 %defattr(-,root,root,-)
 %manifest %{name}.manifest
 %{_hal_libdir}/*.so*
+%{_hal_sysconfdir}/deviced/*