forked from usb-tools/USBProxy-legacy
-
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.
Merge pull request usb-tools#9 from BenGardiner/rate-limit-inject
Rate limit inject
- Loading branch information
Showing
3 changed files
with
35 additions
and
1 deletion.
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,23 @@ | ||
#!/bin/bash | ||
SCRIPT_DIR="$(readlink -m $(dirname $0))" | ||
|
||
touch /tmp/loopbacktestref | ||
${SCRIPT_DIR}/write-loopbacktest /tmp/loopbacktestref 2>/dev/null | ||
echo IRDETO Echo Test:|cat - /tmp/loopbacktestref >/tmp/tmp | ||
mv /tmp/tmp /tmp/loopbacktestref | ||
|
||
stdbuf -o0 cat /dev/ttyACM0 > /tmp/loopbacktest & | ||
sleep 2 | ||
|
||
${SCRIPT_DIR}/write-loopbacktest /dev/ttyACM0 | ||
|
||
sleep 2 | ||
|
||
if ! cmp -b /tmp/loopbacktestref /tmp/loopbacktest; then | ||
echo FAIL | ||
else | ||
echo PASS | ||
fi | ||
|
||
kill %% | ||
|
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,11 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import sys | ||
|
||
os.system("stty -F %s 115200 cs8 -icrnl ignbrk -brkint -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts" % sys.argv[1]) | ||
fd = open(sys.argv[1], 'w') | ||
for x in range(0,256): | ||
val = int(x) | ||
fd.write(chr(val)) | ||
fd.flush() |