Is usbnet the driver of the wireless network card?
Source: Internet
Author: User
Whether USB net is the driver of the wireless network adapter-general Linux technology-Linux programming and kernel information. The following is a detailed description. Recently, I saw an article on Linux kernel and driver programming on the Internet about writing a usb net driver to see if it is a driver for a usb wireless Nic! Your network adapter cannot be used in linux. I would like to ask if the experts are even struggling to drive the compilation process!
It is roughly like this:
I. Implementation of the simulated USB flash drive in linux
Add code to the kernel
# Include
# Include
# Include
Modify arch/arm/mach-s3c2410/mach-smdk2410.c
/* Handle the pull-up resistor of the USB device */
Static void smdk2410_udc_pullup (enum s3c2410_udc_1__e cmd)
{
U8 * s3c2410_pullup_info [] = {
"",
"Pull-up enable ",
"Pull-up disable ",
"UDC reset, in case"
};
Printk ("smdk2410_udc: % s \ n", s3c2410_pullup_info [cmd]);
S3c2410_gpio_cfgpin (S3C2410_GPG9, S3C2410_GPG9_OUTP );
Switch (cmd)
{
Case S3C2410_UDC_P_ENABLE:
S3c2410_gpio_setpin (S3C2410_GPG9, 1); // set gpg9 output HIGH
Break;
Case S3C2410_UDC_P_DISABLE:
S3c2410_gpio_setpin (S3C2410_GPG9, 0); // set gpg9 output LOW
Break;
Case S3C2410_UDC_P_RESET:
// FIXME !!!
Break;
Default:
Break;
}
}
Static struct platform_device * smdk2410_devices [] _ initdata = {
...,
& Initi_device_usbgadget,/* register a USB gadget device */
};
Static void _ init sdmk2410_init (void)
{
U32 upll_value;
Set_s3c2410fb_info (& smdk2410_lcdcfg );
S3c24xx_udc_set_platdata (& smdk2410_udc_cfg);/* initialize */
Initi_device_sdi.dev.platform_data = & smdk2410_mmc_cfg;
/* Turn off suspend on both USB ports, and switch
* Selectable USB port to USB device mode .*/
S3c2410_modify_miscr (S3C2410_MISCCR_USBHOST |
S3C2410_MISCCR_USBSUSPND0 |
S3C2410_MISCCR_USBSUSPND1, 0x0 );
/* Set the USB clock */
Upll_value = (
0x78 <S3C2410_PLLCON_MDIVSHIFT)
| (0x02 <S3C2410_PLLCON_PDIVSHIFT)
| (0x03 <S3C2410_PLLCON_SDIVSHIFT );
While (upll_value! = Readl (S3C2410_UPLLCON )){
Writel (upll_value, S3C2410_UPLLCON );
Udelay (20 );
}
}
Modify drivers/usb/gadget/file_storage.c
Static void start_transfer (struct fsg_dev * fsg, struct usb_ep * ep,
Struct usb_request * req, int * pbusy,
Enum fsg_buffer_state * state)
{
Int rc;
Udelay (800 );
......
}
Configure the kernel to support U disk Simulation
<*> USB Gadget Support --->
USB Peripheral Controller (S3C2410 USB Device Controller) --->
S3C2410 USB Device Controller
S3C2410 udc debug messages USB Gadget Drivers File-backed Storage Gadget 3. Compile the kernel # Make zImage # Make modules G_file_storage.ko is generated under the drivers/usb/gadget directory. Load drivers and test functions Use the previous kernel to start the system and load g_file_storage.ko # Insmod g_file_storage.ko # Insmod g_file_storage.ko file =/dev/mtdblock2 stall = 0 removable = 1 0.03 USB: usb_gadget_register_driver () 'G _ file_storage' 0.04 USB: binding gadget driver 'G _ file_storage' 0.05 USB: s3c2410_set_selfpowered () G_file_storage gadget: File-backed Storage Gadget, version: 20 October 2004 G_file_storage gadget: Number of LUNs = 1 G_file_storage gadget-lun0: ro = 0, file:/dev/mtdblock3 0.06 USB: udc_enable called Smdk2410_udc: Pull-up enable Connect the device to windows. windows automatically adds the device to a new USB flash drive. Format the USB flash drive and save it to the file. After detaching a USB flash drive, perform the following operations on the target board: # Mkdir/mnt/gadget # Mount-t vfat/dev/mtdblock2/mnt/gadget/ # Ls You can see the files stored in the USB flash drive in windows. II. Implementation of USB net functions Configure the kernel to support USB net <*> USB Gadget Support ---> USB Peripheral Controller (S3C2410 USB Device Controller) ---> S3C2410 USB Device Controller
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service