[BUG] No USB Connectivity.
shir0tetsuo opened this issue · 7 comments
Describe the bug
No connectivity between device and computer (USB).
To Reproduce
Steps to reproduce the behavior:
0. Flash Micro SD, Assemble device incl. Pisugar module & Waveshare 2.13in V4, Create config.toml, place in boot directory over Micro SD while plugged into main machine;
- Plug in the RPi02W to a power source. Device powers on as normal, display activates and appears to work as normal.
- Plug in the RPi02W into the USB Port of an Ubuntu machine from the data port.
- Computer indicates it failed to form a connection. ngrep shows there is nothing coming from the device. Cannot ping device.
- Tried to mess a little with the ipv4 settings on the Ubuntu side.
Expected behavior
Device begins communicating with main Ubuntu machine.
Environment (please complete the following information):
- Pwnagotchi version 1.8.3
- OS version Ubuntu
- Type of hardware RPi02W, WS 2.13in V4, PiSugar module
- Any additional hardware used 2 Data USB Cable
I was wondering if maybe there's something I can do with the configuration files to enable a Bluetooth connection or something. Let me know of any solutions, also, I am afraid to power off my device simply by pulling the power cable out, haha..
I've not seen this as an issue. Are you sure you are connecting to the OTG port. Only one of them provides power and data lanes. The other only provides power. In every test I've done, OTG USB connectivity is available right out of the box.
By the way, I'll note that my network is 10.0.0.* 255.255.255.0 as well, maybe that is conflicting with the connection. Is there a way to force a specific IP on the device from the Micro SD directly? That may work.
By the way, I'll note that my network is 10.0.0.* 255.255.255.0 as well, maybe that is conflicting with the connection. Is there a way to force a specific IP on the device from the Micro SD directly? That may work.
Oh it might be interfering. See the original instructions here from evilsocket. I wonder if you're getting a conflict because your network matches the network pwnagotchi tries to set up locally.
I have run the linux connection script, however over time the connection drops automatically by whatever Ubuntu thinks is right, I believe being not connected to my local network may open up a window for SSH login; I think the first thing I'll try to do with it is change the default IP address on the device.. Finicky at best but now there is possibility of connecting. Will have to come back with updated progress
By the way, I'll note that my network is 10.0.0.* 255.255.255.0 as well, maybe that is conflicting with the connection. Is there a way to force a specific IP on the device from the Micro SD directly? That may work.
Oh it might be interfering. See the original instructions here from evilsocket. I wonder if you're getting a conflict because your network matches the network pwnagotchi tries to set up locally.
After messing around for a little while I came up with a working solution. This might be useful infos for other people having similar issues being on the same network config I have being 10.0.0.0/24 on my home network:
- Disconnect from default internet connection.
- Remove all pre-existing configurations if necessary.
- Use the Linux connect script (on Ubuntu host machine), In my case, it was:
#!/usr/bin/env bash
set -e
# name of the ethernet gadget interface on the host
USB_IFACE=${1:-enxfec40b5b3a66}
USB_IFACE_IP=10.0.0.1
USB_IFACE_NET=10.0.0.0/24
# host interface to use for upstream connection
UPSTREAM_IFACE=${2:-enp4s0}
ip addr add "$USB_IFACE_IP/24" dev "$USB_IFACE"
ip link set "$USB_IFACE" up
iptables -A FORWARD -o "$UPSTREAM_IFACE" -i "$USB_IFACE" -s "$USB_IFACE_NET" -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o "$UPSTREAM_IFACE" -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "The process completed successfully. Made changes to ip and iptables."
- SSH into the device with 10.0.0.2 (or hostname.local).
- Reconfigure the usb0 connection expecting a disconnect (at /etc/network/interfaces.d/usb0-cfg )
allow-hotplug usb0
iface usb0 inet static
address 10.0.1.2
netmask 255.255.255.0
network 10.0.1.0
broadcast 10.0.1.255
gateway 10.0.1.1
metric 20
sudo ifconfig usb0 10.0.1.2 netmask 255.255.255.0
- (On Ubuntu host machine):
#!/usr/bin/env bash
set -e
# name of the ethernet gadget interface on the host
USB_IFACE=${1:-enxfec40b5b3a66}
USB_IFACE_IP=10.0.1.1
USB_IFACE_NET=10.0.1.0/24
# host interface to use for upstream connection
UPSTREAM_IFACE=${2:-enp4s0}
ip addr add "$USB_IFACE_IP/24" dev "$USB_IFACE"
ip link set "$USB_IFACE" up
iptables -A FORWARD -o "$UPSTREAM_IFACE" -i "$USB_IFACE" -s "$USB_IFACE_NET" -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o "$UPSTREAM_IFACE" -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "The process completed successfully. Made changes to ip and iptables."
- Reconnect standard internet connection.
The device can now be pinged/connected while also simultaneously being connected to the internet.
I have resolved my connection issues please see the above for details 👍