Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove setting gnuio options on serial ports #883

Merged
merged 2 commits into from
May 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions functions/system.bash
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,11 @@ Finally, all common serial ports can be made accessible to the openHAB java virt
# Find current settings
if is_pi && grep -q "enable_uart=1" /boot/config.txt; then sel_1="ON"; else sel_1="OFF"; fi
if is_pithree || is_pithreeplus && grep -q "dtoverlay=pi3-miniuart-bt" /boot/config.txt; then sel_2="ON"; else sel_2="OFF"; fi
if grep -Eq "EXTRA_JAVA_OPTS=\".*-Dgnu.io.rxtx.SerialPorts=" /etc/default/openhab2; then sel_3="ON"; else sel_3="OFF"; fi

if [ -n "$INTERACTIVE" ]; then
if ! selection=$(whiptail --title "Prepare Serial Port" --checklist --separate-output "$introtext" 20 78 3 \
"1" "(RPi) Disable serial console (Razberry, SCC, Enocean)" $sel_1 \
"2" "(RPi3) Disable Bluetooth module (Razberry)" $sel_2 \
"3" "Add common serial ports to openHAB JVM (Razberry, Enocean)" $sel_3 \
3>&1 1>&2 2>&3); then echo "CANCELED"; return 0; fi
else
echo "SKIPPED"
Expand Down Expand Up @@ -334,16 +332,6 @@ Finally, all common serial ports can be made accessible to the openHAB java virt
fi
fi

if [[ $selection == *"3"* ]]; then
cond_echo "Adding serial ports to openHAB java virtual machine in /etc/default/openhab2"
# eventually keep user defined settings
sed -i "/^[[:space:]]*EXTRA_JAVA_OPTS/s/-Dgnu.io.rxtx.SerialPorts=[^ \"]*//g" /etc/default/openhab2
sed -i "/^[[:space:]]*EXTRA_JAVA_OPTS/s#EXTRA_JAVA_OPTS[[:space:]]*=[[:space:]]*\"#EXTRA_JAVA_OPTS=\"-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0 #g" /etc/default/openhab2
else
cond_echo "Removing serial ports from openHAB java virtual machine in /etc/default/openhab2"
sed -i "/^[[:space:]]*EXTRA_JAVA_OPTS/s/-Dgnu.io.rxtx.SerialPorts=[^ \"]*//g" /etc/default/openhab2
fi

if [ -n "$INTERACTIVE" ]; then
whiptail --title "Operation Successful!" --msgbox "$successtext" 16 80
fi
Expand Down