2020 UPDATE
Gadget Config
The above GitHub package contains tools for configuring Gadget USB Devices and integrating with systemd.
It relies on the Gadget ConfigFS module libcomposite to create and manage Gadget USB Devices.
--------------------------------------------------------------------------------------------------
The following is a brief overview of the simple procedure that is involved to modify the USB configuration for testing embedded Linux Devices (client) using Belcarra's USBLAN for Windows (host) Class driver.
- Setup of the Linux Gadget is provided as a guide.
- Belcarra's USBLAN CDC-ECM/EEM Class driver is available through Windows Update. A time limited version of the driver is available for evaluation and will run for 60 minutes before disconnecting.
The ethernet gadget driver can be configured in three different ways:
- RNDIS - Microsoft proprietary protocol
- CDC/ECM - USB standard protocol
- CDC/EEM - Ethernet Emulation Model protocol
On certain older platforms (e.g. PXA) full ECM can not be implemented. For these platforms Gadget automatically substitutes a Simple variant (also called SAFE) and USBLAN transparently accepts this variant. EEM is supported on ALL platforms.
Note: the EEM option enables the EEM code by default when the module is inserted, but ECM can still be used by setting the use_eem module parameter to 0
Once you have saved the configuration, rebuild the kernel and modules to produce the appropriate gadget modules. The modules need to inserted in the following order
- Low-level USB modules (musb_hdrc for OMAP 35xx)
- g_ether
Loading g_ether.ko
To test with Belcarra Standard USBLAN driver (embedded DHCP NOT be enabled) use Vendor and Product ID's: - VID: 15EC; PID: D041
insmod musb_hdrc.ko
Windows will default to DHCP configuration of its network address. You can change this to a Static IP for testing or provide a DHCP server on your device.To test with Belcarra DHCP Enabled USBLAN driver use Vendor and Product ID's - VID: 15EC; PID: D042:
insmod musb_hdrc.ko
insmod g_ether.ko idVendor=0x15ec idProduct=0xd042
This will install the DHCP enabled configuration. The embedded DHCP service will be enabled. N.B. In normal customer deployments of the USBLAN driver the DHCP Server is controlled by an INF file setting which will set a registry entry that the USBLAN driver will use.
After loading you should see:
usb0 Link encap:Ethernet HWaddr EE:5F:2A:D5:E3:51
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
To set a static IP:
root# ifconfig usb0 192.168.100.2
root# ifconfig usb0
usb0 Link encap:Ethernet HWaddr EE:5F:2A:D5:E3:51
inet addr:192.168.100.2 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Installing the Windows Driver
When you have the Gadget drivers loaded and your test device ready plug it into your test Windows system.
Windows should report that a new device has been plugged in. Depending on what version of Windows and how it is configured it may simply access Windows Update immediately and silently (default Windows 7 behavior) or display a dialog box asking what to do (default |Windows XP behavior). In that case click on the check Windows Update and OK. Windows should then find and install the new driver.
NOTE: The Windows system must be connected to the internet in order to download the driver from Windows Update.
Additional Information and Support
If you have any questions or problems send us an email.
See also:
Belcarra USB Composite Device Framework, an OS agnostic USB device stack for both Simple and Composite USB devices.Any number of USB Functions (limited only by hardware resources) can be combined to create a USB Composite Device.