Apply hal macro and modify script 37/252337/8 accepted/tizen/unified/20210128.132349 submit/tizen/20210127.232224
authorWootak Jung <wootak.jung@samsung.com>
Wed, 27 Jan 2021 07:14:16 +0000 (16:14 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 27 Jan 2021 07:21:24 +0000 (16:21 +0900)
Change-Id: I7c213801409c008278d4634e129e620a74d0dd50
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
12 files changed:
CMakeLists.txt
firmware/CMakeLists.txt
packaging/bluetooth-firmware-bcm.spec
packaging/bluetooth-hci-device.service [deleted file]
packaging/bluetooth-hciattach@.service [deleted file]
scripts/CMakeLists.txt
scripts/bt-dev-end-rpi3.sh
scripts/bt-dev-start-rpi3.sh
set-address/CMakeLists.txt
src/CMakeLists.txt
src/hal-backend-bluetooth.c
tools/CMakeLists.txt

index a196a1b..de149a5 100644 (file)
@@ -1,4 +1,5 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(bluetooth-firmware-bcm C)
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(package REQUIRED glib-2.0 vconf)
@@ -10,6 +11,9 @@ 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.APLv2 DESTINATION ${HAL_LICENSE_DIR}/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.Broadcom DESTINATION ${HAL_LICENSE_DIR}/${PROJECT_NAME})
+
 ADD_SUBDIRECTORY(set-address)
 ADD_SUBDIRECTORY(tools)
 ADD_SUBDIRECTORY(firmware)
index d047afb..58e8d01 100755 (executable)
@@ -1,17 +1,17 @@
 # install firmware
-#INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BT_FW_BCM4330B1_002.001.003.0221.0265.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BT_FW_BCM4358A1_001.002.005.0032.0066.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BCM4345C0_003.001.025.0111.0205.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/artik_bcmtool/brcm_patchram_plus DESTINATION ${PLUGIN_INSTALL_PREFIX}/bin)
+#INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BT_FW_BCM4330B1_002.001.003.0221.0265.hcd DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BT_FW_BCM4358A1_001.002.005.0032.0066.hcd DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BCM4345C0_003.001.025.0111.0205.hcd DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/artik_bcmtool/brcm_patchram_plus DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
 
 # Gear S2
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bcm4343w/BCM4343A1_001.002.009.0035.0096_ORC_Orbis_WC1-S.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bcm4343w/BCM4343A1_001.002.009.0022.0050_Murata_Type-1FR.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bcm4343w/BCM4343A1_001.002.009.0035.0096_ORC_Orbis_WC1-S.hcd DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bcm4343w/BCM4343A1_001.002.009.0022.0050_Murata_Type-1FR.hcd DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
 
 # TW2
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bcm43012/BCM43012B0_002.001.021.0081.0087.hex DESTINATION /lib/firmware/bcm43012/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bcm43012/BCM43012B0_002.001.021.0081.0087.hex DESTINATION ${HAL_LIB_DIR}/firmware/bcm43012/)
 
 # RPI3
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpi3/BCM43430A1.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpi3/BCM4345C0.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpi3/BCM43430A1.hcd DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpi3/BCM4345C0.hcd DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
index 5a4d44d..113a26f 100644 (file)
@@ -7,8 +7,6 @@ License:    Apache-2.0 and Broadcom
 # NOTE: Source name does not match package name.  This should be
 # resolved in the future, by I don't have that power. - Ryan Ware
 Source0:    %{name}-%{version}.tar.gz
-Source1:    bluetooth-hciattach@.service
-Source2:    bluetooth-hci-device.service
 Provides:   bluetooth-scripts
 
 BuildRequires:  pkgconfig(vconf)
@@ -56,7 +54,11 @@ BT firmware and tools for rpi3
 %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
@@ -64,99 +66,83 @@ rm -rf %{buildroot}
 
 %make_install
 
-install -D -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/bluetooth-hciattach@.service
-install -D -m 0644 %SOURCE2 %{buildroot}%{_unitdir}/bluetooth-hci-device.service
-
 %files
 %manifest %{name}.manifest
-%license LICENSE.APLv2 LICENSE.Broadcom
-%defattr(-,root,root,-)
-#%{_bindir}/bcmtool_4330b1
-%exclude %{_bindir}/bcmtool_4343w
-%{_bindir}/bcmtool_4358a1
-%{_bindir}/setbd
-#%{_prefix}/etc/bluetooth/BT_FW_BCM4330B1_002.001.003.0221.0265.hcd
-%{_prefix}/etc/bluetooth/BT_FW_BCM4358A1_001.002.005.0032.0066.hcd
-%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
-%exclude %{_unitdir}/bluetooth-hciattach@.service
-%exclude %{_unitdir}/bluetooth-hci-device.service
-%manifest %{name}.manifest
+%{_hal_licensedir}/%{name}/LICENSE.APLv2
+%{_hal_licensedir}/%{name}/LICENSE.Broadcom
+#%{_hal_sysconfdir}/bluetooth/bcmtool_4330b1
+%exclude %{_hal_sysconfdir}/bluetooth/bcmtool_4343w
+%{_hal_sysconfdir}/bluetooth/bcmtool_4358a1
+%{_hal_sysconfdir}/bluetooth/setbd
+#%{_hal_sysconfdir}/bluetooth/BT_FW_BCM4330B1_002.001.003.0221.0265.hcd
+%{_hal_sysconfdir}/bluetooth/BT_FW_BCM4358A1_001.002.005.0032.0066.hcd
+%{_hal_sysconfdir}/bluetooth/bt-dev-end.sh
+%{_hal_sysconfdir}/bluetooth/bt-dev-start.sh
+%{_hal_sysconfdir}/bluetooth/bt-set-addr.sh
 
 %post exynos3250
-rm -rf %{_prefix}/etc/bluetooth/bt-dev-start.sh
-ln -s %{_prefix}/etc/bluetooth/bt-dev-start-exynos3250.sh %{_prefix}/etc/bluetooth/bt-dev-start.sh
+rm -rf %{_hal_sysconfdir}/bluetooth/bt-dev-start.sh
+ln -s %{_hal_sysconfdir}/bluetooth/bt-dev-start-exynos3250.sh %{_hal_sysconfdir}/bluetooth/bt-dev-start.sh
 
 %files exynos3250
 %manifest %{name}.manifest
-%license LICENSE.APLv2 LICENSE.Broadcom
-%defattr(-,root,root,-)
-%{_bindir}/bcmtool_4343w
-%{_bindir}/setbd
-%{_prefix}/etc/bluetooth/BCM4343A1_001.002.009.0035.0096_ORC_Orbis_WC1-S.hcd
-%{_prefix}/etc/bluetooth/BCM4343A1_001.002.009.0022.0050_Murata_Type-1FR.hcd
-%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-end.sh
-%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-start-exynos3250.sh
-%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-set-addr.sh
-%{_unitdir}/bluetooth-hciattach@.service
-%{_unitdir}/bluetooth-hci-device.service
-%manifest %{name}.manifest
+%{_hal_licensedir}/%{name}/LICENSE.APLv2
+%{_hal_licensedir}/%{name}/LICENSE.Broadcom
+%{_hal_sysconfdir}/bluetooth/bcmtool_4343w
+%{_hal_sysconfdir}/bluetooth/setbd
+%{_hal_sysconfdir}/bluetooth/BCM4343A1_001.002.009.0035.0096_ORC_Orbis_WC1-S.hcd
+%{_hal_sysconfdir}/bluetooth/BCM4343A1_001.002.009.0022.0050_Murata_Type-1FR.hcd
+%{_hal_sysconfdir}/bluetooth/bt-dev-end.sh
+%{_hal_sysconfdir}/bluetooth/bt-dev-start-exynos3250.sh
+%{_hal_sysconfdir}/bluetooth/bt-set-addr.sh
 
 %post artik
-rm -rf %{_prefix}/etc/bluetooth/bt-dev-start.sh
-ln -s %{_prefix}/etc/bluetooth/bt-dev-start-artik.sh %{_prefix}/etc/bluetooth/bt-dev-start.sh
+rm -rf %{_hal_sysconfdir}/bluetooth/bt-dev-start.sh
+ln -s %{_hal_sysconfdir}/bluetooth/bt-dev-start-artik.sh %{_hal_sysconfdir}/bluetooth/bt-dev-start.sh
 
 %files artik
 %manifest %{name}.manifest
-%license LICENSE.APLv2 LICENSE.Broadcom
-%defattr(644,root,root,-)
-%{_bindir}/brcm_patchram_plus
-%{_bindir}/setbd
-%{_prefix}/etc/bluetooth/BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd
-%{_prefix}/etc/bluetooth/BCM4345C0_003.001.025.0111.0205.hcd
-%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-end.sh
-%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-start-artik.sh
-%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-set-addr.sh
-%{_unitdir}/bluetooth-hciattach@.service
-%{_unitdir}/bluetooth-hci-device.service
-%manifest %{name}.manifest
+%{_hal_licensedir}/%{name}/LICENSE.APLv2
+%{_hal_licensedir}/%{name}/LICENSE.Broadcom
+%{_hal_sysconfdir}/bluetooth/brcm_patchram_plus
+%{_hal_sysconfdir}/bluetooth/setbd
+%{_hal_sysconfdir}/bluetooth/BCM4354_003.001.012.0353.0745_Samsung_Artik_ORC.hcd
+%{_hal_sysconfdir}/bluetooth/BCM4345C0_003.001.025.0111.0205.hcd
+%{_hal_sysconfdir}/bluetooth/bt-dev-end.sh
+%{_hal_sysconfdir}/bluetooth/bt-dev-start-artik.sh
+%{_hal_sysconfdir}/bluetooth/bt-set-addr.sh
 
 %post exynos7270
-rm -rf %{_prefix}/etc/bluetooth/bt-dev-start.sh
-ln -s %{_prefix}/etc/bluetooth/bt-dev-start-exynos7270.sh %{_prefix}/etc/bluetooth/bt-dev-start.sh
-rm -rf /lib/firmware/43012B0.hex
-ln -s /lib/firmware/bcm43012/BCM43012B0_002.001.021.0081.0087.hex /lib/firmware/43012B0.hex
+rm -rf %{_hal_sysconfdir}/bluetooth/bt-dev-start.sh
+ln -s %{_hal_sysconfdir}/bluetooth/bt-dev-start-exynos7270.sh %{_hal_sysconfdir}/bluetooth/bt-dev-start.sh
+rm -rf %{_hal_libdir}/firmware/43012B0.hex
+ln -s %{_hal_libdir}/firmware/bcm43012/BCM43012B0_002.001.021.0081.0087.hex %{_hal_libdir}/firmware/43012B0.hex
 
 %files exynos7270
 %manifest %{name}.manifest
-%license LICENSE.APLv2 LICENSE.Broadcom
-%defattr(-,root,root,-)
-%{_bindir}/setbd
-/lib/firmware/bcm43012/BCM43012B0_002.001.021.0081.0087.hex
-%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-end.sh
-%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-start-exynos7270.sh
-%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-set-addr.sh
-%{_unitdir}/bluetooth-hciattach@.service
-%{_unitdir}/bluetooth-hci-device.service
-%manifest %{name}.manifest
+%{_hal_licensedir}/%{name}/LICENSE.APLv2
+%{_hal_licensedir}/%{name}/LICENSE.Broadcom
+%{_hal_sysconfdir}/bluetooth/setbd
+%{_hal_libdir}/firmware/bcm43012/BCM43012B0_002.001.021.0081.0087.hex
+%{_hal_sysconfdir}/bluetooth/bt-dev-end.sh
+%{_hal_sysconfdir}/bluetooth/bt-dev-start-exynos7270.sh
+%{_hal_sysconfdir}/bluetooth/bt-set-addr.sh
 
 %post rpi3
-rm -rf %{_prefix}/etc/bluetooth/bt-dev-start.sh
-rm -rf %{_prefix}/etc/bluetooth/bt-dev-end.sh
-ln -s %{_prefix}/etc/bluetooth/bt-dev-start-rpi3.sh %{_prefix}/etc/bluetooth/bt-dev-start.sh
-ln -s %{_prefix}/etc/bluetooth/bt-dev-end-rpi3.sh %{_prefix}/etc/bluetooth/bt-dev-end.sh
-mkdir -p /lib/firmware/brcm
-ln -s %{_prefix}/etc/bluetooth/BCM43430A1.hcd /lib/firmware/brcm/
-ln -s %{_prefix}/etc/bluetooth/BCM4345C0.hcd /lib/firmware/brcm/
+rm -rf %{_hal_sysconfdir}/bluetooth/bt-dev-start.sh
+rm -rf %{_hal_sysconfdir}/bluetooth/bt-dev-end.sh
+ln -s %{_hal_sysconfdir}/bluetooth/bt-dev-start-rpi3.sh %{_hal_sysconfdir}/bluetooth/bt-dev-start.sh
+ln -s %{_hal_sysconfdir}/bluetooth/bt-dev-end-rpi3.sh %{_hal_sysconfdir}/bluetooth/bt-dev-end.sh
+mkdir -p {_hal_libdir}/firmware/brcm
+ln -s %{_hal_sysconfdir}/bluetooth/BCM43430A1.hcd %{_hal_libdir}/firmware/brcm/
+ln -s %{_hal_sysconfdir}/bluetooth/BCM4345C0.hcd %{_hal_libdir}/firmware/brcm/
 
 %files rpi3
 %manifest %{name}.manifest
-%license LICENSE.APLv2 LICENSE.Broadcom
-%defattr(-,root,root,-)
-%{_prefix}/etc/bluetooth/BCM43430A1.hcd
-%{_prefix}/etc/bluetooth/BCM4345C0.hcd
-%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-end-rpi3.sh
-%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-start-rpi3.sh
-%manifest %{name}.manifest
-/hal/lib/*.so*
+%{_hal_licensedir}/%{name}/LICENSE.APLv2
+%{_hal_licensedir}/%{name}/LICENSE.Broadcom
+%{_hal_sysconfdir}/bluetooth/BCM43430A1.hcd
+%{_hal_sysconfdir}/bluetooth/BCM4345C0.hcd
+%{_hal_sysconfdir}/bluetooth/bt-dev-end-rpi3.sh
+%{_hal_sysconfdir}/bluetooth/bt-dev-start-rpi3.sh
+%{_hal_libdir}/*.so*
diff --git a/packaging/bluetooth-hci-device.service b/packaging/bluetooth-hci-device.service
deleted file mode 100644 (file)
index 2b259e0..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=hciattach service for Broadcom BT/FM requested
-StopWhenUnneeded=yes
-
-[Service]
-Type=oneshot
-SmackProcessLabel=System
-ExecStart=/usr/etc/bluetooth/bt-dev-start.sh
-ExecStop=/usr/etc/bluetooth/bt-dev-end.sh
-RemainAfterExit=yes
-StandardOutput=journal+console
-StandardError=inherit
diff --git a/packaging/bluetooth-hciattach@.service b/packaging/bluetooth-hciattach@.service
deleted file mode 100644 (file)
index 9d49d09..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=hciattach service requested by %I
-Requires=bluetooth-hci-device.service
-After=bluetooth-hci-device.service
-
-[Service]
-Type=oneshot
-SmackProcessLabel=System
-ExecStartPre=-/bin/mkdir -p /run/bluetooth/
-ExecStart=/bin/touch /run/bluetooth/%I
-ExecStop=/bin/rm /run/bluetooth/%I
-RemainAfterExit=yes
-StandardOutput=journal+console
-StandardError=inherit
index a088f04..a86f027 100755 (executable)
@@ -1,14 +1,14 @@
 # install firmware
-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)
 
 #IF (TIZEN_WEARABLE)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start-exynos3250.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start-exynos7270.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start-artik.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start-exynos3250.sh DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start-exynos7270.sh DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start-artik.sh DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
 #ENDIF (TIZEN_WEARABLE)
 
 # RPI3
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start-rpi3.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-end-rpi3.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start-rpi3.sh DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-end-rpi3.sh DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
index ae8f86c..08baa91 100755 (executable)
@@ -20,11 +20,28 @@ if [ $REVISION_NUM == "0006" ]; then
        exit 0
 fi
 
-#if [ -e /sys/class/gpio/gpio17/value ]
-#then
-#      # Reset BT chip
-#      echo 0 > /sys/class/gpio/gpio17/value
-#      sleep 0.1
-#      echo 1 > /sys/class/gpio/gpio17/value
-#fi
+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
 
index c89346d..009ee46 100644 (file)
@@ -6,8 +6,6 @@ BT_UART_DEVICE=/dev/ttyAMA0
 BT_CHIP_TYPE=bcm43xx
 BT_MAC_FILE=/opt/etc/.bd_addr
 
-BT_PLATFORM_DEFAULT_HCI_NAME="TIZEN-Mobile"
-
 HCI_CONFIG=/usr/bin/hciconfig
 HCI_ATTACH=/usr/bin/hciattach
 
@@ -42,7 +40,6 @@ else
         echo "RPI3 B+ or RPI4 model"
         FLOW_CONTROL=flow
         UART_SPEED=2000000
-
 fi
 
 if [ ! -e "$BT_MAC_FILE" ]
@@ -57,28 +54,40 @@ fi
 echo $BT_MAC
 
 echo "Check for Bluetooth device status"
-if ($HCI_CONFIG | grep hci); then
-       echo "Bluetooth device is UP"
-       $HCI_CONFIG hci0 up
+if (${HCI_CONFIG} | grep hci); then
+       echo "Bluetooth device already exist"
+       ${HCI_CONFIG} hci0 up
 else
-       echo "Bluetooth device is DOWN"
-       echo "Registering Bluetooth device"
-
-       # Attaching Broadcom device
-       flag=0
+       echo "Attaching Broadcom device"
        for ((i=0; i<2; i++))
        do
                if ($HCI_ATTACH $BT_UART_DEVICE $BT_CHIP_TYPE $UART_SPEED $FLOW_CONTROL nosleep $BT_MAC -t 5); then
                        sleep 0.1
-                       $HCI_CONFIG hci0 up
-                       echo "HCIATTACH success"
-                       flag=1
+                       ${HCI_CONFIG} hci0 up
                        break
                fi
        done
+fi
 
-       if [ $flag -eq 0 ]
+if !(${HCI_CONFIG} | grep hci); then
+       echo "Did not attach HCI"
+       exit 1
+fi
+
+TIMEOUT=20
+for ((i=1; i<=$TIMEOUT; i++))
+do
+       /bin/sleep 0.1
+       if [ $i -eq $TIMEOUT ]
        then
-               echo "HCIATTACH failed"
+               echo "time expired happen $i"
+               exit 2
        fi
-fi
+       if (${HCI_CONFIG} | grep UP); then
+               echo "Bluetooth device is made"
+               break
+       fi
+       echo "Continue...$i"
+done
+
+exit 0
index 2ff386b..2544f1e 100644 (file)
@@ -20,5 +20,5 @@ ADD_DEFINITIONS("-DDEBUG_EN")
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${package_LDFLAGS})
 
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
 
index ca1fc73..964fe52 100644 (file)
@@ -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)
index cd71c84..b62024a 100644 (file)
@@ -14,7 +14,7 @@
 static int bluetooth_bcm_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_bcm_start(void)
 static int bluetooth_bcm_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;
index 2e7f39e..8e795f8 100644 (file)
@@ -31,5 +31,5 @@ TARGET_LINK_LIBRARIES(${BCMTOOL_4343W} ${package_LDFLAGS})
 TARGET_LINK_LIBRARIES(${BCMTOOL_4358A1} ${package_LDFLAGS})
 
 # install binary file
-INSTALL(TARGETS ${BCMTOOL_4343W} DESTINATION ${PLUGIN_INSTALL_PREFIX}/bin)
-INSTALL(TARGETS ${BCMTOOL_4358A1} DESTINATION ${PLUGIN_INSTALL_PREFIX}/bin)
+INSTALL(TARGETS ${BCMTOOL_4343W} DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)
+INSTALL(TARGETS ${BCMTOOL_4358A1} DESTINATION ${HAL_SYSCONF_DIR}/bluetooth)