INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bcm43012/BCM43012B0_002.001.021.0081.0087.hex DESTINATION /lib/firmware/bcm43012/)
# RPI3
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpi3/BCM43430A1.hcd DESTINATION /lib/firmware/brcm)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/rpi3/BCM4345C0.hcd DESTINATION /lib/firmware/brcm)
+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)
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/
%files rpi3
%manifest %{name}.manifest
%license LICENSE.APLv2 LICENSE.Broadcom
%defattr(-,root,root,-)
-/lib/firmware/brcm/BCM43430A1.hcd
-/lib/firmware/brcm/BCM4345C0.hcd
+%{_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
# Script for registering Broadcom UART BT device
BT_UART_DEVICE=/dev/ttyAMA0
-BT_CHIP_TYPE=bcm
+BT_CHIP_TYPE=bcm43xx
BT_MAC_FILE=/opt/etc/.bd_addr
BT_PLATFORM_DEFAULT_HCI_NAME="TIZEN-Mobile"
-UART_SPEED=3000000
HCI_CONFIG=/usr/bin/hciconfig
-BT_ATTACH=/usr/bin/btattach
+HCI_ATTACH=/usr/bin/hciattach
if [ ! -e "$BT_UART_DEVICE" ]
then
BT_MAC=`printf b8:27:eb:%02x:%02x:%02x $((0x$B1 ^ 0xaa)) $((0x$B2 ^ 0xaa)) $((0x$B3 ^ 0xaa))`
}
+PIMODEL=`cat /proc/device-tree/model | awk '{print $5}'`
+echo "$PIMODEL"
+
+if [ "$PIMODEL" = "B" ]
+then
+ FLOW_CONTROL=noflow
+ UART_SPEED=460800
+else
+ FLOW_CONTROL=flow
+ UART_SPEED=2000000
+
+fi
+
if [ ! -e "$BT_MAC_FILE" ]
then
# Set BT address
echo "Registering Bluetooth device"
# Attaching Broadcom device
- $BT_ATTACH -B $BT_UART_DEVICE -P $BT_CHIP_TYPE -S $UART_SPEED > /dev/null 2>&1 &
+ flag=0
+ 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
+ break
+ fi
+ done
- sleep 0.02
-
- $HCI_CONFIG hci0 up
- $HCI_CONFIG hci0 name $BT_PLATFORM_DEFAULT_HCI_NAME
- echo "HCIATTACH success"
+ if [ $flag -eq 0 ]
+ then
+ echo "HCIATTACH failed"
+ fi
fi