Difference between revisions of "EMAC OE USB Gadget Connections"

From wiki.emacinc.com
Jump to: navigation, search
(added Ethernet section)
(added to ethernet gadget section)
Line 2: Line 2:
  
 
== USB Gadget Ethernet ==
 
== USB Gadget Ethernet ==
The USB Gadget Ethernet driver allows a device to enumerate and communicate as an Ethernet device over the USB link.
+
The USB Gadget Ethernet driver allows a device to enumerate and communicate as an Ethernet device over the USB link. On the host system, this requires the usbnet driver for a Linux system or the RNDIS driver for Windows hosts.
 +
 
 +
To establish a connection, first create an entry in the <code>/etc/network/interfaces</code> file on the device system for the usb0 interface. An example of this configuration is shown below. Note that in almost all circumstances you will want to use a different subnetwork for the USB Ethernet link than what is used for the LAN connection on either the host or device system.
 +
allow-hotplug usb0
 +
iface usb0 inet static
 +
address 192.168.0.2
 +
netmask 255.255.255.0
 +
gateway 192.168.0.1
 +
 
 +
Also, add a configuration for the device connection on the host. The configuration will vary depending on the host operating system and flavor. The IP address of the host should be set to the value used for the gateway setting on the device (192.168.0.1 using the example above). An example configuration for a system that uses the <code>/etc/network/interfaces</code> networking configuration is shown below.
 +
allow-hotplug usb0
 +
iface usb0 inet static
 +
address 192.168.0.1
 +
netmask 255.255.255.0
 +
gateway 192.168.0.1
 +
 
 +
Once the configuration is finished and the host and device systems are connected via a USB cable, load the gadget Ethernet driver on the device with the following command.
 +
root@emac-oe:~# modprobe g_ether
 +
After loading the driver, <code>ifconfig</code> should show an entry for the usb0 interface. Depending on the configuration, you may need to run <code>ifup usb0</code> to configure the device.
 +
 
 +
The host system will most likely automatically detect and load the appropriate drivers. If this does not occur, verify that the usbnet driver is installed and loaded on a Linux distribution. See the [http://msdn.microsoft.com/en-us/library/windows/hardware/gg463293.aspx Microsoft RNDIS driver documentation] for more information on configuring this driver for Windows hosts.

Revision as of 08:16, 26 March 2013

Systems that have a USB device port can be connected to a PC or other system through a USB host port. A USB cable will need to be connected between the USB device port on the board and a USB host port on the other system. This page covers the process of establishing a connection using the gadget Ethernet driver and several of the available USB gadget function drivers. More information regarding the USB Gadget drivers for Linux can be found at the Linux USB Project.

USB Gadget Ethernet

The USB Gadget Ethernet driver allows a device to enumerate and communicate as an Ethernet device over the USB link. On the host system, this requires the usbnet driver for a Linux system or the RNDIS driver for Windows hosts.

To establish a connection, first create an entry in the /etc/network/interfaces file on the device system for the usb0 interface. An example of this configuration is shown below. Note that in almost all circumstances you will want to use a different subnetwork for the USB Ethernet link than what is used for the LAN connection on either the host or device system.

allow-hotplug usb0
iface usb0 inet static

address 192.168.0.2 netmask 255.255.255.0 gateway 192.168.0.1

Also, add a configuration for the device connection on the host. The configuration will vary depending on the host operating system and flavor. The IP address of the host should be set to the value used for the gateway setting on the device (192.168.0.1 using the example above). An example configuration for a system that uses the /etc/network/interfaces networking configuration is shown below.

allow-hotplug usb0
iface usb0 inet static

address 192.168.0.1 netmask 255.255.255.0 gateway 192.168.0.1

Once the configuration is finished and the host and device systems are connected via a USB cable, load the gadget Ethernet driver on the device with the following command.

root@emac-oe:~# modprobe g_ether

After loading the driver, ifconfig should show an entry for the usb0 interface. Depending on the configuration, you may need to run ifup usb0 to configure the device.

The host system will most likely automatically detect and load the appropriate drivers. If this does not occur, verify that the usbnet driver is installed and loaded on a Linux distribution. See the Microsoft RNDIS driver documentation for more information on configuring this driver for Windows hosts.