charkster / rpi_gadget_mode

Instructions for enabling USB (ethernet) gadget mode on RPi 4 and RPi Zero 2W.
MIT License
22 stars 2 forks source link

Network cable unplugged #1

Open XtramCZ opened 1 month ago

XtramCZ commented 1 month ago

Hey, can someone help me please? My system recognizes my Pi as a RNDIS gadget, however in "Network connections" it says "Network cable unplugged", I can't even ssh into it. (after setting up the IP) Thanks.

Win 11 latest Pi Zero 2 W Raspberry Pi OS lite 64bit image image

5shreya commented 1 month ago

Hey I would like to work on this issue. Can you assign me.

charkster commented 1 month ago

@XtramCZ @5shreya Sorry I couldn't reply earlier, I was out of the country on vacation. First I would check for any typos in /boot/firmware/config.txt and /boot/firmware/cmdline.txt (note that newer RPi OS versions have put those files in the /boot/firmware directory).

Make sure that when you add the new commands to cmdline.txt, that you have space before and after the new commands that you add (no newline character, just a single whitespace character).

If that has not fixed your issue, next check /etc/udev/rules.d/90-usb-gadget.rules SUBSYSTEM=="net",ACTION=="add",KERNEL=="usb0",RUN+="/sbin/ifconfig usb0 192.168.1.2 netmask 255.255.255.0",RUN+="/usr/bin/python -c 'import time; time.sleep(20)'",RUN+="/sbin/ip route add 192.168.1.1 dev usb0"

The sleep(20) might need to be increased to sleep(30) depending on the speed of your sd card (20 seconds is fine for me on all my cards).

Hope this helps.

XtramCZ commented 1 month ago

I had to change the sleep timing, it works now, thank you!