mirror of
https://github.com/RasppleII/a2cloud.git
synced 2024-11-27 05:49:25 +00:00
Add baud to source tree
This commit is contained in:
parent
be6c1656a1
commit
6d9f608dd0
29
setup/baud.txt
Normal file
29
setup/baud.txt
Normal file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $1 == "-d" ]]; then
|
||||
shift
|
||||
setgetty=1
|
||||
else
|
||||
setgetty=
|
||||
fi
|
||||
|
||||
if [[ $1 -ne 300 && $1 -ne 1200 && $1 -ne 2400 && $1 -ne 4800 && $1 -ne 9600 && $1 -ne 19200 && $1 -ne 38400 && $1 -ne 57600 && $1 -ne 115200 ]]; then
|
||||
echo 'Usage: baud [-d] 300|1200|2400|4800|9600|19200|38400|57600|115200';
|
||||
echo ' -d sets default speed for all serial port shells (takes effect on logout)'
|
||||
echo ' omitting -d makes change temporary and immediate'
|
||||
else
|
||||
if [[ $setgetty ]]; then
|
||||
sudo sed -i "s/ttyAMA0 .* /ttyAMA0 $1 /" /etc/inittab;
|
||||
sudo sed -i "s/ttyAMA0,[0-9]*/ttyAMA0,$1/g" /boot/cmdline.txt;
|
||||
sudo sed -i "s/\(ttyUSB.*\) .* /\1 $1 /g" /etc/inittab;
|
||||
sudo init q;
|
||||
sudo pkill -f "/sbin/getty"
|
||||
else
|
||||
if [[ $(tty | grep tty) ]]; then
|
||||
stty -F $(tty) $1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "$(tput bold)$(tty) current $(stty -a -F $(tty) | grep -o 'speed .* baud')$(tput sgr0)"
|
||||
echo -e "$(tput bold)default speed at login: $(grep ttyUSB /etc/inittab | sed 's/^.*ttyUSB[^ ]* \(.*\) .*$/\1/') baud$(tput sgr0)"
|
Loading…
Reference in New Issue
Block a user