Permalink
Browse files

Reworked the serial monitor to allow for user selection of port

  • Loading branch information...
1 parent 55c468d commit ac5d6cadb5654856880025c361dae40c2a54b623 @d2kagw d2kagw committed Jan 3, 2011
Showing with 37 additions and 1 deletion.
  1. +1 −1 Commands/Watch serial port.tmCommand
  2. +36 −0 Support/Monitor
@@ -5,7 +5,7 @@
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
- <string>osascript -e 'tell application "Terminal" to do script "screen /dev/tty.usbserial* 9600"'</string>
+ <string>osascript -e 'tell application "Terminal" to do script "\"${TM_BUNDLE_SUPPORT}/Monitor\""'</string>
<key>input</key>
<string>none</string>
<key>name</key>
View
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+# get the list of USB ports
+dev_list=(`ls /dev/*usb*`)
+
+
+# echo them out with their index
+counter=0
+for filename in "${dev_list[@]}"; do
+ echo "${counter}. ${filename:5}"
+ counter=`expr $counter + 1`
+done
+
+# ask the user which port they'd like to monitor
+echo "Which port would you like to monitor? [enter digit then enter, defaults to zero]:"
+read dev_port
+
+# if they didn't supply one, just use zero
+if [ -n dev_port ]; then
+ dev_port=0
+fi
+
+# ask them what baud they'd like to use
+echo "Enter the baud rate [defaults to 9600]:"
+read dev_baud
+
+# if they didn't supply one, just use 9600
+if [ -n dev_baud ]; then
+ dev_baud=9600
+fi
+
+# give them a heads up
+echo "Monitoring ${dev_list[$dev_port]:5} on ${dev_baud}"
+
+# start monitoring
+screen ${dev_list[$dev_port]} ${dev_baud}

0 comments on commit ac5d6ca

Please sign in to comment.