diff options
author | Wootak Jung <wootak.jung@samsung.com> | 2021-01-27 16:53:45 +0900 |
---|---|---|
committer | Wootak Jung <wootak.jung@samsung.com> | 2021-01-27 16:53:45 +0900 |
commit | 630f8f9bff688ba56e7c02dfec99b930f404eb10 (patch) | |
tree | b3ac51c49947c193462608653000ac90b225357e | |
parent | 539c774ca605fdbc1a12392a4436b28331547775 (diff) | |
download | bluetooth-firmware-marvell-630f8f9bff688ba56e7c02dfec99b930f404eb10.tar.gz bluetooth-firmware-marvell-630f8f9bff688ba56e7c02dfec99b930f404eb10.tar.bz2 bluetooth-firmware-marvell-630f8f9bff688ba56e7c02dfec99b930f404eb10.zip |
Apply hal macro and modify scriptsubmit/tizen/20210127.232224accepted/tizen/unified/20210128.132326
Change-Id: Ie4a40364e7626e89167ee1ffa8b83bc81c72ffe0
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | packaging/bluetooth-firmware-marvell.spec | 17 | ||||
-rwxr-xr-x | scripts/CMakeLists.txt | 6 | ||||
-rwxr-xr-x | scripts/bt-dev-end.sh | 24 | ||||
-rwxr-xr-x | scripts/bt-dev-start.sh | 18 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/hal-backend-bluetooth.c | 4 |
7 files changed, 51 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a34dca..fd35d3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(bluetooth-firmware-marvell C) #INCLUDE(FindPkgConfig) #pkg_check_modules(package REQUIRED glib-2.0) @@ -10,5 +11,7 @@ ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fPIE") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION ${HAL_LICENSE_DIR}/${PROJECT_NAME}) + ADD_SUBDIRECTORY(scripts) ADD_SUBDIRECTORY(src) diff --git a/packaging/bluetooth-firmware-marvell.spec b/packaging/bluetooth-firmware-marvell.spec index e923e32..ffbf857 100644 --- a/packaging/bluetooth-firmware-marvell.spec +++ b/packaging/bluetooth-firmware-marvell.spec @@ -30,7 +30,11 @@ BT script tools for artik530 %setup -q %build -cmake ./ -DCMAKE_INSTALL_PREFIX=%{_prefix} -DPLUGIN_INSTALL_PREFIX=%{_prefix} +cmake ./ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DPLUGIN_INSTALL_PREFIX=%{_prefix} \ + -DHAL_LIB_DIR=%{_hal_libdir} \ + -DHAL_LICENSE_DIR=%{_hal_licensedir} \ + -DHAL_SYSCONF_DIR=%{_hal_sysconfdir} make %{?jobs:-j%jobs} %install @@ -44,9 +48,8 @@ rm -rf %{buildroot} %files artik530 %manifest %{name}.manifest -%license LICENSE -%defattr(-,root,root,-) -%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-end.sh -%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-start.sh -%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-set-addr.sh -/hal/lib/*.so* +%{_hal_licensedir}/%{name}/LICENSE +%{_hal_sysconfdir}/bluetooth/bt-dev-end.sh +%{_hal_sysconfdir}/bluetooth/bt-dev-start.sh +%{_hal_sysconfdir}/bluetooth/bt-set-addr.sh +%{_hal_libdir}/*.so* diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 99606f2..c14438e 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,4 +1,4 @@ # install scripts -INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-end.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) -INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) -INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-set-addr.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-end.sh DESTINATION ${HAL_SYSCONF_DIR}/bluetooth) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start.sh DESTINATION ${HAL_SYSCONF_DIR}/bluetooth) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-set-addr.sh DESTINATION ${HAL_SYSCONF_DIR}/bluetooth) diff --git a/scripts/bt-dev-end.sh b/scripts/bt-dev-end.sh index 69aea9a..d20db6b 100755 --- a/scripts/bt-dev-end.sh +++ b/scripts/bt-dev-end.sh @@ -7,3 +7,27 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin # Turn off Bluetooth Chip /usr/sbin/rfkill block bluetooth +HCI_CONFIG=/usr/bin/hciconfig +TIMEOUT=20 +for ((i=1; i<=$TIMEOUT; i++)) +do + /bin/sleep 0.1 + if [ $i -eq $TIMEOUT ] + then + echo "time expired happen $i" + exit 2 + fi + if (${HCI_CONFIG} | grep DOWN); then + echo "Bluetooth device is down" + break + fi + if (${HCI_CONFIG} | grep hci); then + echo "Bluetooth device still exist" + else + echo "hci is removed" + break + fi + echo "Continue...$i" +done + +exit 0 diff --git a/scripts/bt-dev-start.sh b/scripts/bt-dev-start.sh index b45e0ab..0e7900e 100755 --- a/scripts/bt-dev-start.sh +++ b/scripts/bt-dev-start.sh @@ -28,22 +28,20 @@ echo "Power On" echo 2 > /sys/devices/platform/sd8x-rfkill/pwr_ctrl TIMEOUT=20 - -for (( i=1; i<=$TIMEOUT; i++)) +for ((i=1; i<=$TIMEOUT; i++)) do /bin/sleep 0.1 - - if [ $i -eq $TIMEOUT ] - then - echo "time expired happen $i" - ${RFKILL} block bluetooth - exit 1 - fi - + if [ $i -eq $TIMEOUT ] + then + echo "time expired happen $i" + ${RFKILL} block bluetooth + exit 2 + fi if (${HCI_CONFIG} | ${GREP} hci); then echo "Bluetooth device is made" break fi echo "Continue...$i" done + exit 0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ca1fc73..964fe52 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,4 +22,4 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${hal-backend-bluetooth_pkgs_LDFLAGS}) -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /hal/lib COMPONENT RuntimeLibraries) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${HAL_LIB_DIR} COMPONENT RuntimeLibraries) diff --git a/src/hal-backend-bluetooth.c b/src/hal-backend-bluetooth.c index 6aec23b..0b1072e 100644 --- a/src/hal-backend-bluetooth.c +++ b/src/hal-backend-bluetooth.c @@ -14,7 +14,7 @@ static int bluetooth_artik_start(void) { int ret; - ret = system("/usr/etc/bluetooth/bt-stack-up.sh"); + ret = system("/hal/etc/bluetooth/bt-dev-start.sh"); if (ret == 0x100) { LOGE("script internal failed"); return HAL_BACKEND_ERROR_INTERNAL; @@ -29,7 +29,7 @@ static int bluetooth_artik_start(void) static int bluetooth_artik_stop(void) { int ret; - ret = system("/usr/etc/bluetooth/bt-stack-down.sh"); + ret = system("/hal/etc/bluetooth/bt-dev-end.sh"); if (ret == 0x100) { LOGE("script internal failed"); return HAL_BACKEND_ERROR_INTERNAL; |