diff --git a/config.ng.functions.sh b/config.ng.functions.sh index 54a40dd0c..c45aba3e9 100644 --- a/config.ng.functions.sh +++ b/config.ng.functions.sh @@ -229,7 +229,7 @@ function connect_bt_interface(){ IFS=$'\r\n' GLOBIGNORE='*' - echo -e "\nDiscovering Bluetooth devices ... " | show_infobox + show_infobox <<< "\nDiscovering Bluetooth devices ... " BT_INTERFACES=($(hcitool scan | sed '1d')) local LIST=() @@ -244,15 +244,14 @@ function connect_bt_interface(){ LIST_LENGTH=$((${#LIST[@]}/2)); if [ "$LIST_LENGTH" -eq 0 ]; then BT_ADAPTER=${WLAN_INTERFACES[0]} - echo -e "\nNo nearby Bluetooth devices were found!" | show_message + show_message <<< "\nNo nearby Bluetooth devices were found!" else exec 3>&1 - #BT_ADAPTER=$(dialog --backtitle "$BACKTITLE" --no-collapse --title "Select interface" \ - #--clear --menu "" $((6+${LIST_LENGTH})) 50 15 "${LIST[@]}" 2>&1 1>&3) - BT_ADAPTER=$( echo "${LIST[@]}" | show_menu ) + BT_ADAPTER=$(whiptail --title "Select interface" \ + --clear --menu "" $((6+${LIST_LENGTH})) 50 $LIST_LENGTH "${LIST[@]}" 2>&1 1>&3) exec 3>&- if [[ $BT_ADAPTER != "" ]]; then - echo -e "\nConnecting to $BT_ADAPTER " | show_infobox + show_infobox <<< "\nConnecting to $BT_ADAPTER " BT_EXEC=$( expect -c 'set prompt "#";set address '$BT_ADAPTER';spawn bluetoothctl;expect -re $prompt;send "disconnect $address\r"; sleep 1;send "remove $address\r";sleep 1;expect -re $prompt;send "scan on\r";sleep 8;send "scan off\r"; @@ -260,9 +259,9 @@ function connect_bt_interface(){ send_user "\nShould be paired now.\r";sleep 2;send "quit\r";expect eof') echo "$BT_EXEC" > /tmp/bt-connect-debug.log if [[ $(echo "$BT_EXEC" | grep "Connection successful" ) != "" ]]; then - echo -e "\nYour device is ready to use!" | show_message + show_message <<< "\nYour device is ready to use!" else - echo -e "\nError connecting. Try again!" | show_message + show_message <<< "\nError connecting. Try again!" fi fi fi