Difference between revisions of "Category:How to - usb"
m (Protected "Category:How to - usb" [edit=sysop:move=sysop]) |
(Added usbnet section) |
||
Line 1: | Line 1: | ||
− | + | ==USBNet with Overo== | |
+ | |||
+ | The OTG USB port can be configured to support USB networking. For USB networking, the OTG port needs to be configured as a peripheral or gadget. The default kernels from Gumstix have the OTG port configured to act as a host. | ||
+ | |||
+ | The procedure for changing this involves rebuilding your kernel, so you should first be comfortable with [http://www.gumstix.net/Setup-and-Programming/view/Overo-Setup-and-Programming/Setting-up-a-build-environment/111.html setting up a build environment] and building images for your Overo. | ||
+ | |||
+ | |||
+ | The steps below assume a recent snapshot of the gumstix-oe git tree. Two recent changes in particular have simplified the process. | ||
+ | |||
+ | 1. Kernel 2.6.31 is now the default | ||
+ | |||
+ | 2. The linux-omap3_2.6.31.bb recipe now has variable whose value results in modifying the defconfig file appropriately. | ||
+ | |||
+ | |||
+ | To get started, first edit the recipe file ${OVEROTOP}/org.openembedded.dev/recipes/linux/linux-omap3_2.6.31.bb | ||
+ | |||
+ | Change the line | ||
+ | |||
+ | MUSB_MODE ?= "host" | ||
+ | |||
+ | to | ||
+ | |||
+ | MUSB_MODE ?= "peripheral" | ||
+ | |||
+ | or "otg". | ||
+ | |||
+ | |||
+ | Next rebuild the kernel and rootfs. | ||
+ | |||
+ | cd ${OVEROTOP} | ||
+ | bitbake -c clean linux-omap3-2.6.31 | ||
+ | bitbake -c rebuild linux-omap3-2.6.31 | ||
+ | |||
+ | |||
+ | And then rebuild your image. | ||
+ | |||
+ | bitbake omap3-console-image | ||
+ | |||
+ | Change omap3-console-image to whatever image you use. | ||
+ | |||
+ | |||
+ | Once you have booted the new system, you still need to load the g_ether driver since it was built as a module. | ||
+ | |||
+ | You can add g_ether to /etc/modules if you always want it loaded at boot. | ||
+ | |||
+ | root@overo# modbprobe g_ether | ||
+ | g_ether gadget: using random self ethernet address | ||
+ | g_ether gadget: using random host ethernet address | ||
+ | usb0: MAC d6:2c:8f:d9:51:32 | ||
+ | usb0: HOST MAC f2:99:dc:4c:cb:7a | ||
+ | g_ether gadget: Ethernet Gadget, version: Memorial Day 2008 | ||
+ | g_ether gadget: g_ether ready | ||
+ | |||
+ | root@overo:~# ifconfig -a | ||
+ | lo Link encap:Local Loopback | ||
+ | inet addr:127.0.0.1 Mask:255.0.0.0 | ||
+ | inet6 addr: ::1/128 Scope:Host | ||
+ | UP LOOPBACK RUNNING MTU:16436 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:0 | ||
+ | RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) | ||
+ | |||
+ | usb0 Link encap:Ethernet HWaddr D6:2C:8F:D9:51:32 | ||
+ | BROADCAST 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) | ||
+ | |||
+ | |||
+ | Configure the usb0 interface the way you would any other. | ||
+ | |||
+ | For example | ||
+ | |||
+ | root@overo:~# ifconfig usb0 192.168.20.2 netmask 255.255.255.0 | ||
+ | |||
+ | If you then plug the usb OTG cable into a host computer ready for usb networking you'll get a console message | ||
+ | |||
+ | g_ether gadget: high speed config #1: CDC Ethernet (ECM) | ||
+ | |||
+ | The rest is all standard Linux networking. |
Revision as of 08:05, 5 December 2009
USBNet with Overo
The OTG USB port can be configured to support USB networking. For USB networking, the OTG port needs to be configured as a peripheral or gadget. The default kernels from Gumstix have the OTG port configured to act as a host.
The procedure for changing this involves rebuilding your kernel, so you should first be comfortable with setting up a build environment and building images for your Overo.
The steps below assume a recent snapshot of the gumstix-oe git tree. Two recent changes in particular have simplified the process.
1. Kernel 2.6.31 is now the default
2. The linux-omap3_2.6.31.bb recipe now has variable whose value results in modifying the defconfig file appropriately.
To get started, first edit the recipe file ${OVEROTOP}/org.openembedded.dev/recipes/linux/linux-omap3_2.6.31.bb
Change the line
MUSB_MODE ?= "host"
to
MUSB_MODE ?= "peripheral"
or "otg".
Next rebuild the kernel and rootfs.
cd ${OVEROTOP} bitbake -c clean linux-omap3-2.6.31 bitbake -c rebuild linux-omap3-2.6.31
And then rebuild your image.
bitbake omap3-console-image
Change omap3-console-image to whatever image you use.
Once you have booted the new system, you still need to load the g_ether driver since it was built as a module.
You can add g_ether to /etc/modules if you always want it loaded at boot.
root@overo# modbprobe g_ether g_ether gadget: using random self ethernet address g_ether gadget: using random host ethernet address usb0: MAC d6:2c:8f:d9:51:32 usb0: HOST MAC f2:99:dc:4c:cb:7a g_ether gadget: Ethernet Gadget, version: Memorial Day 2008 g_ether gadget: g_ether ready
root@overo:~# ifconfig -a lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 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:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
usb0 Link encap:Ethernet HWaddr D6:2C:8F:D9:51:32 BROADCAST 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)
Configure the usb0 interface the way you would any other.
For example
root@overo:~# ifconfig usb0 192.168.20.2 netmask 255.255.255.0
If you then plug the usb OTG cable into a host computer ready for usb networking you'll get a console message
g_ether gadget: high speed config #1: CDC Ethernet (ECM)
The rest is all standard Linux networking.
Pages in category "How to - usb"
The following 3 pages are in this category, out of 3 total.