Raspberry pi zero w: ethernet gadget issue

Hiya!
I seem to be having a problem with using the OTG ethernet gadget driver where it does not transmit any bytes, yet receives them just fine.

I compiled LEDE with support for g_ether and can bring up the interface just fine it's just that the interface never sends anything out.
The same device works fine in Raspbian so it's not a hardware issue.

ifconfig output:

root@LEDE:/# ifconfig usb0
usb0      Link encap:Ethernet  HWaddr 92:3A:AA:A8:BA:03  
          inet addr:192.168.5.1  Bcast:192.168.5.255  Mask:255.255.255.0
          inet6 addr: fe80::903a:aaff:fea8:ba03/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:896 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:39543 (38.6 KiB)  TX bytes:0 (0.0 B)

tcpdump output

[ 1573.633258] device usb0 entered promiscuous mode
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on usb0, link-type EN10MB (Ethernet), capture size 262144 bytes
07:46:17.397968 ARP, Request who-has 192.168.5.1 tell 192.168.5.2, length 28
07:46:18.398364 ARP, Request who-has 192.168.5.1 tell 192.168.5.2, length 28
07:46:19.403690 ARP, Request who-has 192.168.5.1 tell 192.168.5.2, length 28
07:46:20.408980 ARP, Request who-has 192.168.5.1 tell 192.168.5.2, length 28
07:46:21.410056 ARP, Request who-has 192.168.5.1 tell 192.168.5.2, length 28

/etc/config/network

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fdfc:8387:6126::/48'

config interface 'usb0'
	option name 'usb0'
	option ifname 'usb0'
	option proto 'static'
	option ipaddr '192.168.5.1'
	option netmask '255.255.255.0'

config interface 'lan'
	option type 'bridge'
	option ifname 'wlan0'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

I've been playing with this for the past day and a half and so far no searches have helped and TX is always at 0.
Any ideas?

Would you be willing to host your image so I can try it on my Raspberry Pi Zero W?

Sure, if you know of a reputable place to host files.
Unfortunately dropbox got rid of public folders so now I can't just link to the file :frowning:

I did more testing and it seems that the TX part of all USB gadget devices could be broken.
The serial interface provided by cdc_ether (ttyGS0) seems to only receive as well.

e:
g_serial Seems to transmit just fine o_o

It sounds like you've researched this further than I can. Hopefully someone can fixed it as I think the Pi Zero W would make a damn fine little portable router.

I've tried the newly published 17.01.2 build on the Raspberry Pi 0W and it's a lot easier to get the device up and running.

I thought I would have a play with g_ether support but I guess it's not been compiled into the latest build? Is there an easier way to add support without recompiling like via opkg?

I now have this working using the latest 17.01.4 build. I'm currently working on a set of instructions to walk through:

  • Flashing the image to the MicroSD
  • Getting the WiFi working
  • Connecting the Pi to a local WiFi network
  • Downloading the required drivers
  • Changing the config.txt on the SD card via a computer

:grinning: usb0 finally working at the end of it.

It's convoluted but I now have a travel router that can ad-block and connect to either usb or wifi.

1 Like

As promised, instructions to get the Raspberry Pi Zero W working with USB Ethernet.

https://github.com/smeathers/lede-pi0w-usb/blob/master/README.md

I've tried to aim the technical level so that a little experience with either LEDE or Raspberry Pi shouldn't hopefully leave anyone too confused.