Skip to content

Commit

Permalink
Wait for TCP connection
Browse files Browse the repository at this point in the history
  • Loading branch information
roni-kreinin committed Jan 24, 2025
1 parent 475ffae commit 47a0dbf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions clearpath_robot/scripts/vcan
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,17 @@ echo "Device: $dev";
echo "Virtual CAN: $vcan";
echo "Baud Rate: $baud";

socat TCP4-LISTEN:$port,range=192.168.131.1/24,reuseaddr pty,link=$dev &
sleep 1
# Start socket listener
socat -d -d TCP4-LISTEN:$port,range=192.168.131.1/24,reuseaddr pty,link=$dev > /tmp/socat_log.txt 2>&1 &

# Wait for client to connect to socket
tail -f /tmp/socat_log.txt | grep -m 1 --line-buffered "starting data transfer"

echo "TCP Socket connected"

# Start slcand
slcand -o -c -F -$baud $dev $vcan &

sleep 1

ip link set $vcan txqueuelen 100
Expand Down

0 comments on commit 47a0dbf

Please sign in to comment.