AmitPr
Posts: 1
Joined: Thu Aug 15, 2019 2:44 am

USB OTG not working with pi 0w and Ubuntu host

Thu Aug 15, 2019 2:49 am

Hey guys, I'm trying to connect my RPI 0W using DietPi via USB OTG to my Ubuntu 19.04 laptop. I've gotten an interface to show up on the ubuntu laptop, (enp...) as well as a "usb0" interface on the raspberry pi. However, nowhere I look can I find any mention of the raspberry pi showing up on my laptop, through avahi-browse I find nothing, and through lsusb I only see a generic "usb rndis" device warning. In the syslog of my laptop I can see the device being connected followed by DHCPDISCOVER packets and then a timeout, rinse and repeat. Also, new interfaces "Wired Connection X" are being created every time I connect the pi again.

I'll try and post any commands you guys need in my morning.
Thanks!

User avatar
thagrol
Posts: 3077
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: USB OTG not working with pi 0w and Ubuntu host

Thu Aug 15, 2019 12:07 pm

Sounds like DietPi doesn't have the necessary software for avahi to work. Can't help with that as I don't use it. The alternative would be to configure static IP address on each end.

Regarding
new interfaces "Wired Connection X" are being created every time I connect the pi again.
that's expected behaviour especially if the pi is shutdown/rebooted/powered off between connections to the host.

In its default configuration the ethenet gadget driver on the Pi generates random MAC addresses for each end of the link every time it starts. You can force MAC addresses by setting the host_addr and dev_addr parameters when loading g_ether. How you do that specifically depends on how you're loading that module.

Make sure that both MAC addresses are unique, both in relation to each other and to your entire LAN. It's probably best to use MAC addresses in the localy administered range e.g MAC addresses staring 02 or 06.

If ti helps, I have code here to generate MAC addresses from the Pi's serial number and load the ethernet gadget: https://github.com/thagrol/usb-gadget
Arguing with strangers on the internet since 1993.

Return to “Troubleshooting”