It is now possible to set the device name of the control device in the muxctrl python script.
This commit is contained in:
parent
550962d43a
commit
05dc2bf06b
3 changed files with 41 additions and 5 deletions
|
@ -1,9 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# reset the mux device to default values
|
||||
pypy ./muxctrl.py -g -m -l 0 -s 115200
|
||||
python ./muxctrl.py -g -m -l 0 -s 115200
|
||||
|
||||
# TODO start logging of the received data
|
||||
./readTTYToFile.sh /dev/ttyACM1 &
|
||||
|
||||
sleep 2
|
||||
|
||||
# read from line 0 to 7
|
||||
for i in `seq 0 7`;
|
||||
|
@ -18,6 +21,7 @@ done
|
|||
sleep 3
|
||||
|
||||
# TODO stop logging of the received data
|
||||
killall -12 readTTYToFile.sh
|
||||
|
||||
pypy ./muxctrl.py -g -m -l 0 -s 115200
|
||||
python ./muxctrl.py -g -m -l 0 -s 115200
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ parser.add_argument("-s", "--setBaudrate", type=int, help="Something like
|
|||
parser.add_argument("-m", "--getMuxLine", default=False, help="Get the current multiplexer control line state.", action='store_true')
|
||||
parser.add_argument("-l", "--setMuxLine", type=int, help="Something like 0 to 7.")
|
||||
parser.add_argument("-r", "--resetToBtldr", default=False, help="Reset the device to the LUFA bootloader.", action='store_true')
|
||||
parser.add_argument("-d", "--device", type=str, help="The control device like /dev/ttyACM0 or COM3.")
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
@ -53,7 +54,8 @@ MUX_MAX_VAL = 7
|
|||
|
||||
###############################################################################
|
||||
|
||||
ser = None
|
||||
ser = None
|
||||
device = "/dev/ttyACM0"
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
@ -308,7 +310,11 @@ def openSerialDevice(d):
|
|||
global ser
|
||||
|
||||
# Why 115200? Because the host defines the baudrate for the USB serial connection.
|
||||
ser = serial.Serial(d, 115200, timeout=0)
|
||||
try:
|
||||
ser = serial.Serial(d, 115200, timeout=0)
|
||||
except:
|
||||
print "ERROR: Can't open the serial device " + device
|
||||
exit(1)
|
||||
|
||||
#####
|
||||
def closeSerialDevice():
|
||||
|
@ -339,7 +345,9 @@ if __name__ == "__main__":
|
|||
timeout = 0
|
||||
|
||||
# 1. open serial device or abort
|
||||
openSerialDevice("/dev/ttyACM0")
|
||||
if args.device != None:
|
||||
device = args.device
|
||||
openSerialDevice(device)
|
||||
|
||||
# 2. start thread to poll cc_dataReceiverThread()
|
||||
cc_startReceiverThread()
|
||||
|
|
24
tools/readTTYToFile.sh
Executable file
24
tools/readTTYToFile.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
TTY_DEV=$1 # or /dev/ttyACM1
|
||||
OUT_FILE=$2
|
||||
|
||||
if [ -z "$TTY_DEV" ];
|
||||
then
|
||||
TTY_DEV=/dev/ttyACM1
|
||||
fi
|
||||
|
||||
if [ -z "$OUT_FILE" ];
|
||||
then
|
||||
OUT_FILE="tty_bootup_seq.log"
|
||||
fi
|
||||
|
||||
echo "Read from "$TTY_DEV" and write to "$OUT_FILE
|
||||
|
||||
while read line; do
|
||||
if [ "$line" != "EOF" ]; then
|
||||
echo "$line" >> $OUT_FILE
|
||||
else
|
||||
break
|
||||
fi
|
||||
done < $TTY_DEV
|
Loading…
Reference in a new issue