forked from Moddable-OpenSource/moddable
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
144 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
port=$(findUSBLinux $1 $2 cdc_acm) | ||
while [ "" == "${port}" ]; do | ||
sleep 0.1 | ||
port=$(findUSBLinux $1 $2 cdc_acm) | ||
done | ||
|
||
sleep 2 | ||
|
||
${MODDABLE}/build/bin/lin/release/serial2xsbug ${port} 921600 8N1 $3 | ||
|
||
# -dtr $3 |
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
if [ "$#" -lt 2 ] ; then | ||
echo "Usage: $0 <vid> <pid> [<driver>]" | ||
echo " returns path of USB device matching <vid> and <pid>" | ||
echo " <driver> is cdc_acm or usb-storage" | ||
exit 1 | ||
fi | ||
|
||
for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do | ||
( | ||
syspath="${sysdevpath%/dev}" | ||
devname="$(udevadm info -q name -p $syspath)" | ||
[[ "$devname" == "bus/"* ]] && exit | ||
# echo "$(udevadm info -q property --export -p $syspath)" | ||
eval "$(udevadm info -q property --export -p $syspath)" | ||
[[ "$ID_VENDOR_ID" != "$1" || "$ID_MODEL_ID" != "$2" ]] && exit | ||
[[ "$3" != "" && "$ID_USB_DRIVER" != "$3" ]] && exit | ||
echo "/dev/$devname" | ||
) | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
vid=$1 | ||
pid=$2 | ||
name=$3 | ||
volumefile=$4 | ||
serial=$( findUSBLinux $vid $pid cdc_acm ) | ||
|
||
rm "$volumefile" 2> /dev/null | ||
|
||
volume=$( df -P | grep "$name" | awk '{print($6)}' ) | ||
if [ -d "$volume" ]; | ||
then | ||
echo "Already in programming mode." | ||
else | ||
if [ -z "$serial" ]; | ||
then | ||
echo "If led is not blinking, please double-tap the reset button to enter programming mode." | ||
else | ||
echo "Triggering serial port $serial." | ||
serial2xsbug $serial 921600 8N1 -programming | ||
fi | ||
|
||
echo -n "Waiting for $name." | ||
# echo -n "Double-tap the reset button to enter programming mode." | ||
set -o pipefail | ||
volume=$( df -P | grep "$name" | awk '{print($6)}' ) | ||
while [ -z "$volume" ]; do | ||
echo -n "." | ||
sleep 1 | ||
volume=$( df -P | grep "$name" | awk '{print($6)}' ) | ||
done | ||
echo | ||
fi | ||
|
||
echo $volume >> "$volumefile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
MISSING=0 | ||
|
||
while [[ "$#" -gt 2 ]] | ||
do | ||
case "$1" in | ||
-x|--missing) | ||
MISSING=1 | ||
shift; | ||
;; | ||
*) | ||
;; | ||
esac | ||
done | ||
|
||
name=$1 | ||
volumefile=$2 | ||
|
||
if [[ -f "$volumefile" ]] | ||
then | ||
rm "$volumefile" 2> /dev/null | ||
fi | ||
|
||
volume=$( df -P | grep "$name" | awk '{print($6)}' ) | ||
set -o pipefail | ||
|
||
if [[ $MISSING == 0 ]] | ||
then | ||
echo "Waiting for $name." | ||
echo -n "Double-tap the reset button to enter programming mode." | ||
while [ -z "$volume" ]; do | ||
echo -n "." | ||
sleep .1 | ||
volume=$( df -P | grep "$name" | awk '{print($6)}' ) | ||
done | ||
else | ||
echo -n "Waiting for copy to complete." | ||
while [ ! -z "$volume" ]; do | ||
echo -n "." | ||
sleep .1 | ||
volume=$( df -P | grep "$name" | awk '{print($6)}' ) | ||
done | ||
fi | ||
echo | ||
|
||
if [[ -f "$volumefile" ]] | ||
then | ||
echo $volume >> "$volumefile" | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters