0

Am looking for connecting one end of USB to a board(raspberry-pi/orange-pi) and configure it in a way so that connecting another end to a PC will be able access network(internet) directly from the board(raspberry-pi/orange-pi) , which is in turn connected to a network through onboard WiFi, so is it feasible think to do by mounting USB as notwork adapter instead of host, on either sides,so what level of modifications needs to be done either at application level or kernel level in order to achieve this.

2
  • Your text is hard to understand. Maybe you want to make a networking diagram? Commented Nov 12, 2019 at 15:16
  • 2
    You can get hardware USB to Ethernet adapters which are compatible with the Raspberry Pi, if that would help. Commented Nov 12, 2019 at 15:20

1 Answer 1

1

With traditional USB, this is ppossible only if the board has a USB OTG port. (For example, Orange Pi and Raspberry Pi Zero have an OTG-compatible port, but Raspberry Pi 3 does not.)

Using this method, you can connect the board to a PC and the computer will recognize it as a "USB Ethernet" interface – similar to Android USB tethering.

  1. Follow the board's documentation to enable the OTG capability. For example, on Pi Zero you need to enable the dwc2 Device Tree overlay and load the corresponding kernel module. On Orange Pi, it seems this instead involves writing a command to /dev/ttyGS0.

  2. Load a USB gadget module into the kernel. To provide Ethernet, load g_ether. There are quite a few other gadget modules, allowing the board to act as a USB mouse or webcam.

  3. g_ether will create a usb0 network interface – configure it like you would normally do.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .