Skip to content

Instantly share code, notes, and snippets.

@sora
Created December 22, 2013 09:16
Show Gist options
  • Select an option

  • Save sora/8080110 to your computer and use it in GitHub Desktop.

Select an option

Save sora/8080110 to your computer and use it in GitHub Desktop.
pkt='1100000000000000 A0369F1850e5 001C7E6ABAD1 0800 45 00 00 4E 00 00 40 00 40 11 FB 32 0A 00 00 6E 0A 00 00 02 04 04 00 89 00 3A 38 03 10 FD 01 10 00 01 00 00 00 00 00 00 20 46 45 45 4E 45 42 46 45 46 44 46 46 46 4A 45 42 43 4E 45 49 46 41 43 41 43 41 43 41 43 41 43 41 00 00 20 00 01'
seq=0
for i in {0..999}; do
echo $pkt > /dev/ethpipe/0
echo -n "$seq "
cat /sys/kernel/ethpipe/local_time1
seq=$(( $seq + 1 ))
sleep 1
done
#!/bin/bash
delay=$(( 10000000 / 8 )) # 10ms
seq=0
while true
do
read line
if [[ $line =~ ^[0-9A-F]{16} ]]; then
recv_ts=${line:0:16}
frame=${line:16}
printf "%016X$frame\n" $(( 16#$recv_ts + 10#$delay )) > /dev/ethpipe/0
# echo $recv_ts
# printf "%016X$frame\n" $(( 16#$recv_ts + 10#$delay ))
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment