Jump to content

USB OTG as a network


dhlii

Recommended Posts

I have worked with a BeagleBone Black which has a very nice feature. 

Out of the box you can connect it to a laptop via USB and it sets up a network between the BBB and the laptop. 

 

Is there some kind of equivalent to allow the USB OTG ports of these boards to be used for a PC to Device network ?

I am particularly interested in the H3's

Link to comment
Share on other sites

I have worked with a BeagleBone Black which has a very nice feature. 

Out of the box you can connect it to a laptop via USB and it sets up a network between the BBB and the laptop. 

 

Is there some kind of equivalent to allow the USB OTG ports of these boards to be used for a PC to Device network ?

I am particularly interested in the H3's

 

"Out of the box" is the problem : you need to configure both end in a coherent manner. So the solution cannot be on your BBB or other "OTG board" only.

 

And if you want an automatic transparent configuration, it supposes to have a dhcp server or relay (or bootp or rarp or ...) on your laptop.

 

For me, the best solution is DOCUMENTATION ! For example "The board will configure an usb link with address xx.xx.xx.xx/mm (or launch a dhcp client). Add an udev rule or manually configure new usb interface/bridge/routing/dhcp ..."

 

N.B. I saw some WIP (not working) changes in g_ether parameters in last beta image.

Link to comment
Share on other sites

And if you want an automatic transparent configuration

 

...then use the address range that is made for exactly this: 169.254.0.0/16 (even Windows should be able to deal with that though I neither tried it nor am interested in this): https://en.wikipedia.org/wiki/Link-local_address

 

But the problem is another one (again due to Windows being crap): https://github.com/igorpecovnik/lib/issues/538

 

So g_serial should work 'out of the box' even with a crappy host OS but we get no feedback whether it would be good to enable it by default or not...

Link to comment
Share on other sites

...then use the address range that is made for exactly this: 169.254.0.0/16 (even Windows should be able to deal with that though I neither tried it nor am interested in this): https://en.wikipedia.org/wiki/Link-local_address

 

But the problem is another one (again due to Windows being crap): https://github.com/igorpecovnik/lib/issues/538

 

So g_serial should work 'out of the box' even with a crappy host OS but we get no feedback whether it would be good to enable it by default or not...

 

The g_ether module has host_addr and dev_addr parameters. Are this parameters supposed to be use by cdc_eem if passed to module ?

 

Or by udev config ?

Link to comment
Share on other sites

Sorry, I was apparently not clear. 

 

I am not expecting that a stock Armbian SDcard will provide the facilities I am looking for. 

If there is a driver that exposes a pseudo Ethernet interface and link on both ends of the Orange PI H3 USB OTG connector, I can manage all the rest of the configuration to accomplish what I am after. 

 

Further I am not looking to connect an OPI to a BBB - though what I am seeking would allow that. 

 

I am looking to be able to deliver a black bock OPI Lite based product that can be plugged into a USB port on a laptop and web browsed to setup some configuration parameters. 

 

I do not want a client to have to connect to a serial port or plug in a USB Ethernet dongle to be able to configure the Unit prior to setting up Wifi and other parameters. 

 

 

 

 

 

.

Link to comment
Share on other sites

I am not expecting that a stock Armbian SDcard will provide the facilities I am looking for. 

 

While I tried to explain to you that exactly this is happening already and how/where you would've to adjust settings to make this work for other boards as OPi Lite or NanoPi Air that are accessible through a simple USB cable. To be able to replace g_serial with g_ether also everything has already been said :)

 

I repeat myself: https://github.com/igorpecovnik/lib/issues/538 (there you can see on which side of the USB cable the problem is located)

Link to comment
Share on other sites

Until now, with default fex config I activate my connections my adding this in /etc/rc.local of OTG host

 

addr="192.168.1.70"
mlen=30
gw="192.168.1.69"

echo -n 0 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role
modprobe g_ether
echo -n 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role
ifconfig usb0 $addr/$mlen
route add default gw $gw

 

The connected host has a NEW created interface. You NEED to configure it SOMEHOW. In my example  :

 

ifconfig usb0 192.168.1.69/30

 

And to give the slave access to the other hosts in the network and Internet :

echo 1 > /proc/sys/net/ipv4/ip_forward

arp -i eth0 -Ds 192.168.1.70 eth0 pub
 

 

Now, every one has its use cases. My config is a subneted network of localnet because I use proxy routing. You can also use bridging or a 169.254.0.0/16 network without routing

Link to comment
Share on other sites

Until now, with default fex config I activate my connections my adding this in /etc/rc.local of OTG host

 

Why that complicated? See the first link above, the 1st answer to the OP's question: https://forum.armbian.com/index.php/topic/1417-testers-wanted-g-ether-driver-h3-device-as-ethernet-dongle/?p=11105

 

It's just adding a few lines to the interfaces file, adding/replacing one entry in /etc/modules and you're done. On H3 device side. If Linux or OS X is on the other end of the USB cable everything might already work, with Windows it seems to be a problem (according to others -- see the links above -- I don't deal with Windows anyway). I would fiddle around with modprobe only in more sophisticated scenarios like it's done with the BeagleBones for example: https://github.com/RobertCNelson/boot-scripts/blob/master/boot/am335x_evm.sh#L332-L339

 

BTW: Theoretically it should work to provide the necessary drivers to Windows by using the Multifunction Composite Gadget (or g_multi) functionality. This way the H3 device would appear as both an USB Mass Storage device providing the driver for the RNDIS Ethernet device. On Linux or OS X everything already works at this stage:

        RNDIS/Ethernet Gadget:

          Product ID: 0xa4a2
          Vendor ID: 0x0525  (PLX Technology, Inc.)
          Version: 3.33
          Speed: Up to 480 Mb/sec
          Manufacturer: Linux 3.4.113-sun8i with sunxi_usb_udc
          Location ID: 0x14200000 / 17
          Current Available (mA): 500
          Current Required (mA): 2
Link to comment
Share on other sites

 

Why that complicated? See the first link above, the 1st answer to the OP's question: https://forum.armbian.com/index.php/topic/1417-testers-wanted-g-ether-driver-h3-device-as-ethernet-dongle/?p=11105

 

It's just adding a few lines to the interfaces file, adding/replacing one entry in /etc/modules and you're done. On H3 device side. If Linux or OS X is on the other end of the USB cable everything might already work, ...

 

 

Why ? Because I know this way is working for me ...

 

You know, one of the problem with this type of setup is that you get lost in the tutorials about what concern one end of the link and what concern the other one.

 

Until now, I don't understand if using link local address is supposed to make auto-configuration of the host effective, possible or possibly automated. And threw which mechanism, with which OS/version/subsystem/software ...

 

Nevertheless, I think that armbian should do its best to facilitate the usage of USB networking (I use it on A20 and H3 - thanks to you !). USB networking is fast, economic, handy, power effective ...

 

But anyway my use cases are such that I never will be able to use it "out of the box" in production. But on install, it would be great. The problem is not having at present the possibility to use g_serial and g_ether simultaneously.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines