+++ /dev/null
-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)
+++ /dev/null
-/*
- * 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_cfs_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_cfs_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 = "R800",
- .abi_version = HAL_ABI_VERSION_TIZEN_7_0,
- .init = usb_gadget_init,
- .exit = usb_gadget_exit,
-};