Linux USB gadget network experience, linuxgadget
Platform: Mini2440
System: linux-2.6.32.2
HOST: Windows
When configuring USB net in the USB gadget function, the main task is to load the g_ether.ko module, but after several attempts to plug in to the computer, it does not respond, windows cannot identify the device, after checking the information, you will know that the USB interface is being pulled up. The mini2440 uses GPC5 to pull up the USB interface. Only in this way can the host identify the device and prompt to install the device. After the data is integrated, the problem is solved by the following steps:
Open mach-mini2440.c to add code:
static void s3c2410_udc_pullup(enum s3c2410_udc_cmd_e cmd){ switch (cmd) { case S3C2410_UDC_P_ENABLE : s3c2410_gpio_cfgpin(S3C2410_GPC(5), S3C2410_GPIO_OUTPUT); s3c2410_gpio_setpin(S3C2410_GPC(5), 1); break; case S3C2410_UDC_P_DISABLE : s3c2410_gpio_setpin(S3C2410_GPC(5), 0); break; case S3C2410_UDC_P_RESET : break; default: break; }}
static struct s3c2410_udc_mach_info s3c2410_udc_cfg __initdata = {.udc_command= s3c2410_udc_pullup,};Add the following sentence to the mini2440_machine_init function:
Static void _ init mini2440_machine_init (void) {# if defined (LCD _WIDTH) s3c24xx_fb_set_platdata (& mini2440_fb_info); # using (NULL); Using (S3C2410_GPC (0), success ); dependencies = & amp; dependencies; counts = & amp; mini2440_mmc_cfg; counts (& amp; s3c2410_udc_cfg); // Add platform_add_devices (mini2440_devices, ARRAY_SIZE (mini2440_devices); amp ();}Add the # include <plat/udc. h> header file at the beginning of the program and close it.
Make menuconfig configuration kernel: Device drivers-usb support-usb gadget support
Configuration
Pay attention to the configuration at the cursor, which is easy to ignore. Select the S3C2410 USB Device Controller.
Save the configuration and exit. make zImage and start linux with the new kernel.
Configuration command: ifconfig usb0 172.20.21.88 up
Use USB to connect the D interface to the Windows host. The following message is displayed:
Driver: http://download.csdn.net/detail/wu20093346/7914915
Install from the list or specified location
After the installation is complete, a new local connection appears. Modify the IP address. At this time, ping the mini2440 Board:
In the development of embedded linux gadget, when a usb device is inserted into a PC, how can the device capture the connection and disconnection from the host?
Linux itself already has support for hot swapping devices, and you can call your specified script after insertion and unplugging. google will use linux hotplug for keyword search.
G_serialko in linux_usb_gadget in Linux cannot be loaded.
You must compile the module for the current kernel.
It must be a module compiled by the same kernel version. Besides, the gcc compilation parameters must be the same (depending on the actual situation ......), In addition, if the gcc version is earlier than 3.1, the gcc version must be the same.
Otherwise, the invalid module format will easily appear.