diff --git a/README.md b/README.md index 1a4c9b2..74a76da 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ You will need: - insert the SD card into a different computer to perform the first few steps: - Download link is [here](https://www.raspberrypi.org/downloads/raspberry-pi-os/). - Follow Raspbianā€™s directions [here](https://www.raspberrypi.org/documentation/installation/installing-images/README.md). -- Eject and re-insert the SD card, and use your PC's file explorer to open the SD card - should be called *boot*. +- Eject and re-insert the SD card, and use your PC's file explorer to open the SD card which should be called *boot*. - Add the following to the end of the first line in the `/boot/cmdline.txt` file: - modules-load=dwc2,g_serial - Save and close *cmdline.txt* @@ -119,7 +119,7 @@ Reboot your Pi when the upgrade is complete. --- **NOTE** -Do Not forget the fact that you changed the password and hostname of your *bridge*! +Do Not forget that you just changed the password and hostname of your *bridge*! --- @@ -154,14 +154,9 @@ cd ser2bt-bridge/ sudo ./upgrade basic ``` ###### We're Done! -If everything went as planned, your *raspberry pi zero w* should be acting like a bluetooth to serial bridge, allowing you to connect to a switches console port via bluetooth from your computer. -- Now, reboot your *bridge*. -- After the raspberry pi has rebooted, use your PC/laptop to pair with it. -- Look for a device advertising your pi's *hostname* -- The Pi should advertise that it supports serial communications, so you'll be able to pair it with your PC's serial ports. - - Keep in mind, that no pin will be requested. Your PC should just pair with the pi. - - Under Widows 10, after pairing, select *More Bluetooth Settings*, under *Related settings*, on the right side of the settings window. -- Once that's done, go ahead and open your favorite terminal program, and point it to the com/ttyUSBx/tty/ACMx port, and set it up to connect at 115200 bps, n/8/1, xterm. +If everything went as planned, your *raspberry pi zero w* should be acting like a bluetooth to serial bridge, allowing you to connect to a switche's console port via bluetooth from your computer. +- Now, reboot your *bridge* and skip down to How to use: + ### Full setup: #### Installation of the *UPS* & *e-ink screen*: The addition of am e-paper screen and ups backup will allow you to continue providing power to the Pi while not being plugged into a power source, and to easily tell the status of the bridge (Pi) without having to login to check. @@ -178,7 +173,7 @@ Coming soon! ![Raspberry Pi Zero usb port location and definition:](/readme_md_images/rpi0_diagram_port.png) ### Power on the *bridge*: 1. Different ways, depending on your setup: - 1. For the basic *bridge* option, Plug the power into the *bridges* power port. See + 1. For the basic *bridge* option, Plug the power into it's power port. See the diagram here: 2. If your version of the *bridge* has a UPS, then slide the switch to the on position. 3. To charge the UPS, insert the power cord into the UPS's power input plug, do not power the pi using the pi's power port. 4. It will take up to 30 seconds to boot to a point where a *master* can connect to it via bluetooth. diff --git a/screen_get_baud b/screen_get_baud index 43359e9..6196371 100755 --- a/screen_get_baud +++ b/screen_get_baud @@ -1,5 +1,6 @@ #! /bin/bash -# I saved this as 'screen_backtick_battery' +# I saved this as 'screen_get_baud' # 2021-06-02: get the rfcomm0 serial interface baud rate for a backtick command in the ser2bt_bridge screen config. +# 2021-07-27: change name of file referenced above. stty < /dev/rfcomm0 | grep speed | cut -d ";" -f 1 | grep -o "[0-9]\+" -exit 0 \ No newline at end of file +exit 0 diff --git a/ser2bt_status b/ser2bt_status index d66969e..94c0be7 100755 --- a/ser2bt_status +++ b/ser2bt_status @@ -246,6 +246,7 @@ try: draw = ImageDraw.Draw(image) epd.init(epd.FULL_UPDATE) + #Draw the non variablers to the to the screen draw.text((0, 0), host_name, font = f_top_line_font16, fill = 0) draw.text((50, 0), 'Bat:', font = f_top_line_font16, fill = 0) @@ -259,14 +260,10 @@ try: draw.text((50, 80), 'BT', font = f_var_font18, fill = 0) draw.text((153, 80), 'ser2net', font = f_var_font18, fill = 0) draw.text((0, 100), 'TTY:', font = f_title_font18, fill = 0) - epd.displayPartBaseImage(epd.getbuffer(image)) #This is the command to actually place the above to the e-ink display. + epd.init(epd.PART_UPDATE) #Initialize the partial screen - #This following coommandis just enough to get to the first iteration of the loop without dumping out and powering down. while True: - # Grab initial information - #This part grabs the active network interface. - epd.init(epd.PART_UPDATE) #Initialize the partial screen try: draw.rectangle((82, 0, 120, 16), fill=255) draw.text((82, 0), bat_lvl(), font=f_top_line_font16, fill=0) @@ -302,7 +299,7 @@ try: bt_serial_port, bt_serial_status_pos, bt_serial_connect, bt_serial_status = cap_bt_serial_port() total_serial_lines = int(usb_serial_status) + int(acm_serial_status) # first, if nothing is connected, then just say that: - #IF there are no tty connections, then display full_tty_status variable (saying nothing is attached). + #If there are no tty connections, then display full_tty_status variable (saying nothing is attached). if bt_serial_connect is False and usb_serial_connect is False and acm_serial_connect is False: full_tty_status = "No tty Connections" if old_full_tty_status != full_tty_status: @@ -310,25 +307,20 @@ try: draw.rectangle((50, 99, 245, 122), fill=255) draw.text((50, 100), full_tty_status, font=f_var_font18, fill=0) old_total_serial_lines = 'XX' -# old_bt_serial_port = 'XX' else: #Otherwise, display the inidividual state of the ttys. full_tty_status = "" old_full_tty_status = full_tty_status -# if old_bt_serial_port != bt_serial_port: draw.rectangle((50, 99, 152, 122), fill=255) draw.text((50, 100), bt_ser_short_label + ' In:', font=f_var_font18, fill=0) draw.text((bt_serial_status_pos, 100), bt_serial_status, font=f_var_font18, fill=0) -# old_bt_serial_port = bt_serial_port if old_total_serial_lines != total_serial_lines: draw.rectangle((153, 99, 245, 122), fill=255) draw.text((153, 100), 'Serial Out:', font=f_var_font18, fill=0) draw.text((usb_serial_status_pos, 100),str(total_serial_lines), font=f_var_font18, fill=0) old_total_serial_lines = total_serial_lines - #This block draws the rectangles, then places the refreshable text/variables into them. - epd.displayPartial(epd.getbuffer(image)) #update the screeen to actually print the above to the e-ink display. - epd.sleep() +# epd.sleep() except IOError as e: syslog.syslog(syslog.LOG_INFO, 'traceback.format_exc():\n%s',traceback.format_exc()) diff --git a/rfcomm.service b/services/rfcomm.service similarity index 100% rename from rfcomm.service rename to services/rfcomm.service diff --git a/ser2bt-battery.service b/services/ser2bt-battery.service similarity index 100% rename from ser2bt-battery.service rename to services/ser2bt-battery.service diff --git a/ser2bt-button.service b/services/ser2bt-button.service similarity index 100% rename from ser2bt-button.service rename to services/ser2bt-button.service diff --git a/ser2bt-e-paper-init.service b/services/ser2bt-e-paper-init.service similarity index 100% rename from ser2bt-e-paper-init.service rename to services/ser2bt-e-paper-init.service diff --git a/ser2bt-e-paper.service b/services/ser2bt-e-paper.service similarity index 92% rename from ser2bt-e-paper.service rename to services/ser2bt-e-paper.service index 5e53d83..f78c624 100644 --- a/ser2bt-e-paper.service +++ b/services/ser2bt-e-paper.service @@ -19,4 +19,4 @@ RestartSec=10 KillMode=mixed [Install] -WantedBy=ser2bt-e-paper-init.service \ No newline at end of file +WantedBy=ser2bt-e-paper-init.service diff --git a/upgrade b/upgrade index cea8f5d..fc51888 100755 --- a/upgrade +++ b/upgrade @@ -17,6 +17,7 @@ dev_folder="/dev/" boot="/boot/" bt_folder="bluetooth/" project_folder="${home}Projects/ser2bt-bridge/" +project_service_folder="${project_folder}services/" support_folder="${home}Projects/support/" logging_folder="${home}console_logs/" bin_folder="/usr/local/bin/" @@ -507,14 +508,14 @@ fi fi done - printf "\nCopy service files to the ${cyn}${etc_service_folder} ${nor}directory, then disable and enable copied services:\n" | fmt --goal=91 --width=${last_col} + printf "\nCoping service files to the ${cyn}${etc_service_folder} ${nor}directory, then disable and enable copied services:\n" | fmt --goal=91 --width=${last_col} svc_count=0 for svc_file in ${service_files[@]} ; do - if cmp --silent "${etc_service_folder}${svc_file}" "${project_folder}${svc_file}" ; then + if cmp --silent "${etc_service_folder}${svc_file}" "${project_service_folder}${svc_file}" ; then printf " ${nor}Both versions of ${yel}${svc_file} ${nor}are the same, Skipping...\n" let svc_count++ else - cp ${project_folder}${svc_file} ${etc_service_folder} && printf " ${yel}${svc_file} ${nor}copied.\n" || break + cp ${project_service_folder}${svc_file} ${etc_service_folder} && printf " ${yel}${svc_file} ${nor}copied.\n" || break systemctl disable ${svc_file} > /dev/null 2>&1 && printf " ${nor}${svc_file} ${drk_grn}successfully ${nor}disabeled.\n" || break systemctl enable ${svc_file} > /dev/null 2>&1 && printf " ${nor}${svc_file} ${drk_grn}successfully ${nor}enabeled.\n" || break fi