clockworkpi

[USB-ETH] Connect GameShell to Linux PC!

I try out a lot of stuff on the GameShell, so I flash the image over and over again.

Setting up the Wi-Fi every time on the GameShell is a pain.
So, I decided to ELIMINATE WI-FI ALTOGETHER! :smiley:

This tutorial is about fully utilizing your GNU/Linux PC, i.e.:

  • USB: List your GameShell as a USB device on your GNU/Linux PC!
  • SSH: Connect to your GameShell from your GNU/Linux PC!
  • Internet: Provide internet access to your GameShell from your GNU/Linux PC!
  • Wired: Never need Wi-Fi ever!

Here is what I did step by step:

USB card:

  1. [Optional] Flash a clean image on your usb_device (e.g. /dev/sdX).
sudo dd bs=4M if=clockworkos_v0.1.img of=${usb_device} status=progress oflag=sync
  1. Replace the file uImage on the boot partition.

  2. Find out the ip_of_your_router connected to the internet.

  3. On your CLOCKWORKPI partition, append to /etc/network/interfaces (using sudo):

allow-hotplug usb0
auto usb0
iface usb0 inet static
address 10.0.0.2
netmask 255.255.255.0
gateway 10.0.0.1
dns-nameservers ${ip_of_your_router}

This will add the GameShell to a new 10.x.x.x network with a static IP once it is connected!

  1. On your CLOCKWORKPI partition, replace line 330 of /home/cpi/apps/launcher/Menu/GameShell/10_Settings/Update/__init__.py:
             if is_wifi_connected_now():

by:

            if True:

This will enable you to use ‘Update’ from the GameShell menu using USB later on!


GNU/Linux PC:

  1. Now turn on your GameShell (with USB card in it) and hook it to your PC.

  2. Check if the GameShell shows up as a USB device:

$ lsusb
Bus 001 Device 007: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
  1. Find the internet_interface and gameshell_interface (e.g. eth0 and enps3s0):
$ ip address
1: lo: ...
2: eth0: ...
3: enp03s0: ...
  1. Create new network rules using your internet_interface and gameshell_interface:
sudo iptables -t nat -A POSTROUTING -o ${internet_interface} -j MASQUERADE
sudo iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i ${gameshell_interface} -o ${internet_interface} -j ACCEPT
  1. Assign a static IP address to your gameshell_interface. The ip 10.0.0.1 should match gateway of step 4!
sudo ip link set up dev ${gameshell_interface}
sudo ip addr add 10.0.0.1/24 dev ${gameshell_interface}
  1. Enable internet forwarding:
sudo sysctl net.ipv4.ip_forward=1
  1. Login! The ip 10.0.0.2 should match address of step 4!
ssh cpi@10.0.0.2
  1. Test if your GameShell has internet:
ping clockworkpi.com

Without ever turning Wi-Fi on you should have full access to your GameShell including internet!


Notes:

  • Tested on Ubuntu and Arch.
  • step 9 and 11 will reset after reboot.
  • step 10 will reset after unplugging.
  • Make sure /etc/resolv.conf on the GS has ip_of_your_router for DNS.

Search online how to make those steps permanent (or make a script).

Good luck! :slight_smile:

4 Likes

Many thanks for this posting, i would have been lost without it.
Managed to establish internet on my Gameshell with it, since no wifi device in my house at all seemed to work with it.
For the statistics: Ubuntu 18.04 and Gameshell OS 1.23

The newer images make it even more easy:

  • Step 2 is no longer required!
  • In Step 4 and 10 you can use the now predefined range:
address 192.168.10.1
gateway 192.168.10.2

Futhermore, adding dns-nameservers wasn’t necessary, but putting your ip_of_your_router in /etc/resolv.conf is!