Compile and use dnw in Linux

Source: Internet
Author: User

Baidu Linux dnw can find a lot of download information. The download file contains two files, one is the dnw USB driver secbulk, and the other is the dnw application. The two files must be compiled separately.

The method used to compile secbulk is the same as that used to compile the kernel driver. You can directly use the GCC-O dnw. C command to compile the dnw application.

Note that the USB driver downloaded on the internet is generally based on 2240, and the situation varies with Samsung's 6410, so you need to make a slight modification: In the secbulk. c file

Static struct usb_device_idsecbulk_table [] = {
{Usb_device (0x04e8, 0x1234 )},
{}
}; Samsung 6410 needs to be changed to 0x04e8 & 0x1234

 

Second, after the secbulk. c downloaded from the internet is compiled, the device node cannot be automatically created. You need to manually create the device node. You can use the following method to automatically create the device node when loading the driver.

 

Struct class * my_class;

Add the following to the _ init function:

My_class = class_create (this_module, "my_class ");

If (is_err (my_class ))

{

Printk ("Err: failedin creating class. \ n ");

Return-1;

}

Device_create (my_class, null, mkdev (hello_major, 0), "hello", "% d", 0 );

 

Add the following to the _ exit function:

Device_destroy (my_class, mkdev (adc_major, 0); // deletedevice node under/dev

Class_destroy (my_class); // Delete class created by us

 

Other drivers can also be used as above.

After compilation, copy the dnw executable file generated under dnw to/usr/local/bin and use insmod to load the generated secbulk. Ko module.

Use the sudo dnw file name directly when you need to download the image file via USB.

Has been engaged in the simulation of the original Linux system can also use dnw, learning, reproduced from: http://blog.csdn.net/xyl_nuaa/article/details/6636076

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.