Unable to get linux USB networking working on updated Apalis imx6

Using the older linux version that came on board as shipped, I was able to use ‘systemctl start usb-rndsi’ to enable usb networking so I can connect to board with host computer. I just upgraded to 2.7 version of linux, and see that this service no longer exists, and from reading the docs it looks like we are supposed to use connmanctl. But when I try running command “tether gadget on”, I get error “Error enabling gadget tethering: Method “SetProperty” with signature “sv” on interface “net.connman.Technology” doesn’t exist”, which to me means that it doesn’t know what anything about usb tethering. What am I doing wrong?

With 2.7 series USB Gadget is using ConfigFS and the libusbg library to load USB gadget configurations from /etc/usbg/. The service usbg starts and initialize USB RNDIS. See also USB Device Mode (Linux).

Unfortunately connman did not work well with the RNDIS use case we had in mind since connman always tries to have only one connection active. Therefor we disabled Gadget support and blacklisted the interface in connman (see blacklist in /etc/connman/main.conf). To bring up the RNDIS network interface the LXDE default image uses systemd-networkd (see /usr/lib/systemd/network/rndis.network). networkd assigns to the usb0 interface and runs a DHCP server to hand out an IP to the connected host (usually

Thanks for your response, but I don’t understand what I need to do to get rndis to work then. So you are saying not to use connman ok, but what do I need to do then? Currently nothing happens when I plug in cable. Maybe this is the problem, below is the systemctl status usbg:

[[0;1;31m●[[0m usbg.service - Load default USB gadget schema g1.schema
   Loaded: loaded (/lib/systemd/system/usbg.service; enabled; vendor preset: enabled)
   Active: [[0;1;31mfailed[[0m (Result: exit-code) since Tue 2017-04-11 00:30:13 UTC; 31s ago
  Process: 455 ExecStartPost=/bin/sh -c /bin/echo $((0x4000+$(cat /proc/device-tree/toradex,product-id))) >                                      /sys/kernel/config/usb_gadget/g1
/idProduct [[0;1;31m(code=exited, status=127)[[0m
  Process: 325 ExecStart=/usr/bin/gadget-import g1 /etc/usbg/g1.schema (code=exited, status=0/SUCCESS)
 Main PID: 325 (code=exited, status=0/SUCCESS)

Apr 04 15:16:56 apalis-imx6 systemd[1]: Starting Load default USB gadget schema g1.schema...
Apr 11 00:30:13 apalis-imx6 sh[455]: /bin/sh: 0x4000+0028: value too great for base (error token is "0028")
Apr 11 00:30:13 apalis-imx6 systemd[1]: [[0;1;39musbg.service: Control process exited, code=exited status=127[[0m
Apr 11 00:30:13 apalis-imx6 systemd[1]: [[0;1;31mFailed to start Load default USB gadget schema g1.schema.[[0m
Apr 11 00:30:13 apalis-imx6 systemd[1]: [[0;1;39musbg.service: Unit entered failed state.[[0m
Apr 11 00:30:13 apalis-imx6 systemd[1]: [[0;1;39musbg.service: Failed with result 'exit-code'.[[0m

Thanks for this output. It actually shows that the service has a bug which only triggers on Apalis iMX6 Quad 2GB IT and Apalis iMX6 Dual 512MB.

Edit the file /lib/systemd/system/usbg.service replace the line

ExecStartPost=/bin/sh -c '/bin/echo $((0x4000+$(cat /proc/device-tree/toradex,product-id))) > \                                             


ExecStartPost=/bin/sh -c '/bin/echo $((0x4000+10#$(cat /proc/device-tree/toradex,product-id))) > \                                             

would fix the issue. I will create a ticket for the issue and it will be fixed by default in our next release.

Also pushed the fix on our OpenEmbedded morty-next branch:

Ok a bit better, usbg loads ok, and I do see a usb0 listed as an interface, but on the other end of the usb cable, the windows host does not get indication that there is a usb ethernet interface like it used to before. Do I need to do anything else?

Hm, it seems to work here with a Windows 10 machine. The new libusgx uses Microsoft OS Descriptors which actually works with all Windows releases without installing any driver. It should just show up as a network device:

[   15.304595] configfs-gadget gadget: high-speed config #1: c
[   15.310524] IPv6: ADDRCONF(NETDEV_CHANGE): usb0: link becomes ready

Thanks, I rebooted it showed up. I am good to go.