diff --git a/drc-sim.py b/drc-sim.py index 7302fc3..aa3e6f8 100644 --- a/drc-sim.py +++ b/drc-sim.py @@ -34,7 +34,7 @@ def udp_service(ip, port): # hack for now, replace with dhcp result WII_LOCAL_IP = '192.168.1.11' -OUT_LOCAL_IP = '127.0.0.1' +OUT_LOCAL_IP = '0.0.0.0' WII_MSG_S = udp_service(WII_LOCAL_IP, WII_PORT_MSG) WII_VID_S = udp_service(WII_LOCAL_IP, WII_PORT_VID) @@ -544,7 +544,7 @@ def scale_stick(OldValue, OldMin, OldMax, NewMin, NewMax): report[0x3f] = 0xe000 #print report.tostring().encode('hex') WII_HID_S.sendto(report, ('192.168.1.10', WII_PORT_HID)) - hid_seq_id += 1 + #hid_seq_id += 1 EVT_SEND_HID = pygame.USEREVENT pygame.time.set_timer(EVT_SEND_HID, int((1. / 180.) * 1000.)) diff --git a/util/route.sh b/util/route.sh new file mode 100755 index 0000000..df96514 --- /dev/null +++ b/util/route.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Wii NIC +wiiface="wlx687f747d2e59" + +# Normal NIC +interface="eth0" +ip="192.168.2.137" +subnet="192.168.2.0/24" # subnet? terminology might be wrong +gateway="192.168.2.1" + +# These are for the Wii U and gamepad. +# They appear to be static but here Justin Case. +WII_LOCAL_IP="192.168.1.11" +WII_SUBNET="192.168.1.0/24" +WII_GATEWAY="192.168.1.1" + +# Assign an ip to the interface. +sudo ifconfig $wiiface $WII_LOCAL_IP + +# This creates two different routing tables, that we use based on the source-address. +sudo ip rule add from $ip table 1 +sudo ip rule add from $WII_LOCAL_IP table 2 + +# Configure the two different routing tables +sudo ip route add $subnet dev $interface scope link table 1 +sudo ip route add default via $gateway dev $interface table 1 + +sudo ip route add $WII_SUBNET dev $wiiface scope link table 2 +sudo ip route add default via $WII_GATEWAY dev $wiiface table 2 + +# default route for the selection process of normal internet-traffic +sudo ip route add default scope global nexthop via $gateway dev $interface + +# Setup dhcp +sudo dhclient diff --git a/test-stream.py b/util/test-stream.py similarity index 83% rename from test-stream.py rename to util/test-stream.py index 3ab3afc..e8156c2 100644 --- a/test-stream.py +++ b/util/test-stream.py @@ -2,12 +2,13 @@ import socket import sys -IP = "127.0.0.1" +IP = "0.0.0.0" VIDEO_PORT = 50000 pygame.init() screen = pygame.display.set_mode((854, 480)) pygame.display.set_caption("test-stream") +clock = pygame.time.Clock() while True: for event in pygame.event.get(): @@ -28,3 +29,5 @@ image = pygame.image.fromstring(imageBuffer, (854, 480), "RGB") screen.blit(image, (0, 0)) pygame.display.flip() + clock.tick() + pygame.display.set_caption("test-stream - fps: " + str(round(clock.get_fps())))