forked from pr3y/Bruce
-
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.
read decoded ir signals (pr3y#216), serial fixes
- Loading branch information
Showing
8 changed files
with
272 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# args checking | ||
if [ -z "$1" ] || [ ! -f "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then | ||
echo "usage: $(basename $0) INPUT_FILE" | ||
echo | ||
exit 0 | ||
fi | ||
|
||
|
||
INPUTFILE="$1" | ||
INPUTFILEEXT=$( echo -n "$INPUTFILE" | rev | cut -d'.' -f1 | rev ) | ||
INPUTFILEEXT=$( echo -n $INPUTFILEEXT | tr '[A-Z]' '[a-z]' ) # force lowercase extension | ||
SERIAL_CMD="" | ||
|
||
# try to detect the input file type according on its extension (useful if file is missing or buggy) | ||
case $INPUTFILEEXT in | ||
sub ) SERIAL_CMD="subghz tx_from_buffer" ;; | ||
ir ) SERIAL_CMD="ir tx_from_buffer" ;; | ||
txt ) SERIAL_CMD="badusb run_from_buffer" ;; | ||
js|bjs ) SERIAL_CMD="js run_from_buffer" ;; | ||
esac | ||
|
||
if [ -z "$SERIAL_CMD" ]; then | ||
echo "$(basename $0) err: unsupported file format: $INPUTFILEEXT" | ||
exit 1 | ||
fi | ||
|
||
echo "$SERIAL_CMD" | busybox microcom -s 115200 /dev/ttyACM0 -t 1000 | ||
|
||
sleep 1 | ||
|
||
cat "$INPUTFILE" | busybox microcom -s 115200 /dev/ttyACM0 -t 1000 | ||
|
||
echo "EOF" | busybox microcom -s 115200 /dev/ttyACM0 | ||
#echo -e '\x04' | busybox microcom -s 115200 /dev/ttyACM0 |
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
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
Oops, something went wrong.