diff --git a/README.md b/README.md index c5da2f1..6d2380b 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ Reboot your Pi when the upgrade is complete. * Select *Network at boot*, then select *No* to Disable *Waiting for network on boot*. * From the main menu, under *localization Options* verify, or set: * Setup locals. - * De-select the default selection of *en_GB.UTF-8 UTF-8* (if you are'nt from Great Briton), and select your contrie's local. + * De-select the default selection of *en_GB.UTF-8 UTF-8* (if you are'nt from Great Britain), and select your contrie's local. * Select *Ok*, then tab to and select *Ok". * Select the local you selected in the previous screen, then tab to and select *Ok". * Set timezone on the pi. @@ -260,4 +260,4 @@ Features I want to add to this project: --- ## Known issues: -- [ ] For some reason, while connected via bluetooth, one cannot update the OS, or githib repositories. A workaround, is to open a `screen` session in the bridge, then perform any update taskes. Another workaround would be to ssh into it instead of using bluetoothe. +- [ ] For some reason, while connected via bluetooth, one cannot update the OS, or githib repositories. A workaround, is to open a `screen` session in the bridge, then perform any update taskes. Another workaround would be to ssh into it instead of using bluetooth. diff --git a/screen_bat_mon b/screen_bat_mon index e906b1a..009093c 100755 --- a/screen_bat_mon +++ b/screen_bat_mon @@ -6,4 +6,5 @@ if [ -e /tmp/bat ]; then grep -Eo [0-9]+ /tmp/bat else printf "Null" -fi \ No newline at end of file +fi +exit 0 \ No newline at end of file diff --git a/screen_get_baud b/screen_get_baud new file mode 100755 index 0000000..43359e9 --- /dev/null +++ b/screen_get_baud @@ -0,0 +1,5 @@ +#! /bin/bash +# I saved this as 'screen_backtick_battery' +# 2021-06-02: get the rfcomm0 serial interface baud rate for a backtick command in the ser2bt_bridge screen config. +stty < /dev/rfcomm0 | grep speed | cut -d ";" -f 1 | grep -o "[0-9]\+" +exit 0 \ No newline at end of file diff --git a/ser2bt_bridge b/ser2bt_bridge index bbe6627..a4f578c 100755 --- a/ser2bt_bridge +++ b/ser2bt_bridge @@ -61,31 +61,33 @@ printf "\n${nor}Checking to make sure we are connected to at least one serial de #Check for USB ports: z=${max_ports} -printf " ${nor}Checking to see what ${cyn}${usb_port}${nor}'s are available:\n" +printf " ${nor}Checking to see what ${cyn}${usb_port}${nor}'s are available:" for (( a=0; a<=${max_ports}-1; a++ )); do port="${usb_port}${a}" if [[ ! -e ${port} ]]; then let z-- else - printf " ${cyn}${port}${nor} is ${drk_grn}available${nor}...\n" + printf " \n${cyn}${port}${nor} is ${drk_grn}available${nor}...\n" wire_port+=(${port}) fi done +printf " ${drk_grn}Done\n" #Check for ACM ports: z=${max_ports} -printf " ${nor}Checking to see what ${cyn}${acm_port}${nor}'s are available:\n" +printf " ${nor}Checking to see what ${cyn}${acm_port}${nor}'s are available:" for (( a=0; a<=${max_ports}-1; a++ )); do port="${acm_port}${a}" if [[ ! -e ${port} ]]; then let z-- else - printf " ${cyn}${port}${nor} is ${drk_grn}available${nor}...\n" + printf " \n${cyn}${port}${nor} is ${drk_grn}available${nor}...\n" wire_port+=(${port}) fi done -resize > /dev/null 2>&1 -printf "\n" +printf " ${drk_grn}Done\n" + +#Create screen sessions based on the USB and ACM Ports found from above: count=0 wire_count=1 for serial_port in ${wire_port[@]}; do @@ -94,8 +96,12 @@ for serial_port in ${wire_port[@]}; do let count++ let wire_count++ done - session_count=$(screen -r | grep Detached | cut -d "." -f 2 | cut -f 1 | wc -w) + +#resize the terminal for better vewing +resize > /dev/null 2>&1 + +#Determine what to do on exit - if we are connected to more than one serial device, connected to 1 serial device, or none at all: if [[ ${session_count} > 1 ]]; then screen -r | grep Detached | cut -d "." -f 2 | cut -f 1 printf "\nUse ${yel}screen -r${mag} switch_name${nor} (listed above).\n" @@ -114,4 +120,4 @@ wait exit_status=0 exit_status_reason="Successful completion." exit_script ${exit_status} ${exit_status_reason} -exit ${exit_status} +exit ${exit_status} \ No newline at end of file diff --git a/ser2bt_bridge.screenrc b/ser2bt_bridge.screenrc index 1f431a7..170cef5 100644 --- a/ser2bt_bridge.screenrc +++ b/ser2bt_bridge.screenrc @@ -52,7 +52,10 @@ bind I login on bind O login off bind } history +#Extra functionality -obtain information for the status bars: backtick 1 30 90 screen_bat_mon +backtick 2 120 300 screen_get_baud + # An example of a "screen scraper" which will launch urlview on the current # screen window # @@ -85,7 +88,7 @@ hardstatus on # #hardstatus lastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<" -hardstatus alwaysfirstline +#hardstatus alwaysfirstline # set these terminals up to be 'optimal' instead of vt100 termcapinfo xterm*|linux*|rxvt*|Eterm* OP @@ -127,5 +130,5 @@ bindkey "^[[6~" eval 'copy' 'stuff ^F' # PgDown | Enter copy/scrollback mode and # SCREEN LAYOUT # ------------------------------------------------------------------------------ hardstatus alwaysfirstline "%{= kb}[%{= kr}$USER%{+ kw}@%{+ ky}%H%{+ kb}][%=%{= kK}(%{+ km}%n %{+ kg}%t%{+ kK})%=%{+ kb}][%{+ ky}%m%{+ kw}/%{-}%d%{+ kw}/%{-}%Y %{+ kc}%c%{+ kb}]" -caption always "%{+ Bk}[%{+ Wk}Press: %{+ Yk}%{-} +%{+ Yk} a%{-}, then%{+ Yk} \%{-} to exit, or%{+ Yk} d%{-} to suspend session.%{+ Bk}][%=][%{+ Wk}Battery: %{+ Gk}%1`%:%{+ Wk}%%%{+ Bk}]" +caption always "%{+ Bk}[%{+ Wk}Baud Rate: %{+ Gk}%2`%:%{+ Bk}][%=][%{+ Wk}Press: %{+ Yk}%{-} +%{+ Yk} a%{-}, then%{+ Yk} \%{-} to %{+ Mk}exit%{-}, or%{+ Yk} d%{-} to %{+ Mk}suspend%{-} session.%{+ Bk}][%=][%{+ Wk}Battery: %{+ Gk}%1`%:%{+ Wk}%%%{+ Bk}]" #idle 300 exec termsaver starwars diff --git a/upgrade b/upgrade index 66066ea..cea8f5d 100755 --- a/upgrade +++ b/upgrade @@ -39,7 +39,7 @@ disable_svc=("keyboard-setup.service" "dphys-swapfile.service" "triggerhappy.ser "apt-daily-upgrade.service" "apt-daily-upgrade.timer" "rpi-eeprom-update.service" \ "ser2net.service") base_package_install_list=("screen" "git" "minicom" "tio" "rfkill" "dnsutils" "xterm" "telnet" "telnetd" "ser2net" "spi-tools") -base_bin_files=(ser2bt_bridge screen_bat_mon) +base_bin_files=(ser2bt_bridge screen_bat_mon screen_get_baud) #enhanc_bin_files=(ser2bt_status init_scr shutdown_scr) wavesh_bin_files=(ser2bt_status init_scr shutdown_scr) full_bin_files=( "${base_bin_files[@]}")