USB device has a configuration, which we mentioned earlier, and there is another setting (setting ). A little strange, aren't these two words the same thing? Let's take our most familiar mobile phone for example. If you don't talk about the configuration, you just need to set it. Various configurations of a mobile phone may have been determined. For example, the vibration or ringtones are determined, and various functions are determined. However, the
unsigned int delay_use = 5;
111 module_param (delay_use, uint, s_irugo | s_iwusr );
112 module_parm_desc (delay_use, "seconds todelay before using a new device ");
Set delay_use to 5, while module_param is a macro provided by Linux kernel 2.6, so that delay_use can be set when the module is loaded. (If this parameter is not set, the value 5 indicates that a new device is waiting for a delay of 5 seconds .) Why latency? When the inserted
-storage: devicescan complete \ n ");
936
937/* shocould we unbind if no devices weredetected? */
938}
939
940 scsi_host_put (us_to_host (us ));
941 complete_and_exit ( threads_gone, 0 );
942}
Row 3, where does delay_use come from? In the same file, a static variable is defined at the beginning:
110 static unsigned int delay_use = 5;
111 module_param (delay_use, uint, S_IRUGO | S_IWUSR );
112 MODULE_PARM_DESC (delay_use, "seconds todelay before using a new device ");
Set delay_use to
This story uses kernel code 2.6.22. In the Linux kernel code directory, all the Code related to the device driver is under the drivers/directory. Using the ls command in this directory, you can see many subdirectories:
Lfg1:/usr/src/linux-2.6.22/drivers # ls
Kconfig acpi atm block char cpufreq dma fc4 hid ide
Input leds md mfd mtd oprofile pci ps3 s390 serial spi
Us
Capture the USB flash drive as an iso file in linux and copy the USB flash drive in batches using iso
Sometimes we need to capture the entire USB flash drive as an iso file. This iso can be used to burn the disc. Of course, we can also use the software to burn it back to another US
We followed storage_probe () almost completely, and it seems that everything is about to end, but do you think you haven't understood how the device works so far? USB flash disks, not just USB devices or disks, must comply with the USB massstorage protocol and...
We followed storage_probe () almost completely, and it seems that everything is about to end, but do
Create a Windows 7 installation USB flash drive and a Windows 7 installation USB flash drive in linux
Http://blog.csdn.net/pipisorry/article/details/41369821
Linux is installed, and win7 is installed with a USB flash drive (network installation should be acceptable ),
First,
impossible for you to pull it out. hot swapping is a major feature of USB devices.
Row 3 and host are also locks, so we can check the lock at the end.
Lines 326 to 330 are used to determine whether another flag has been set. the meaning of the flag US_FLDX_TIMED_OUT is also as literal, that is, timeout. The concept of timeout is everywhere in the computer world. However, for this flag, the function for setting it is command_abort. This function is
module_exit (usb_stor_exit );
In fact, module_init/module_exit is just a macro. generally, to show your own personality, the module writer will name their own initialization function and deregister function. for example, module_init (usb_stor_init) and module_exit (usb_stor_exit) is actually telling the world that the real functions are usb_stor_init and usb_stor_exit. This kind of trick is not uncommon in Linux kernel code, so you don't have to worr
usb_stor_exit (void)
1083 {
1084 US_DEBUGP ("usb_stor_exit () called/n ");
1085
1086/* Deregister the driver
1087 * This will cause disconnect () to be called for each
1088 * attached unit
1089 */
1090 US_DEBUGP ("-- calling usb_deregister ()/n ");
1091 usb_deregister ( usb_storage_driver );
1092
1093/* Don't return until all of our control and scanning threads
1094 * have exited. Since each thread signals threads_gone as its
1095 * last act, we have to call wait_for_completion the right number
course, after the value is assigned, it represents an array name, just as we have defined the value assigned in struct usb_driver usb_storage_driver ,. id_table = storage_usb_ids. Well, let's take a look at the structure of usb_device_id.
Struct usb_device_id from include/Linux/mod_devicetable.h:
98 struct usb_device_id {
99/* whichfields to match against? */
100 _ match_flags;
101
102/* used for product specificmatches; range is random */
103 _ 16id
We followed storage_probe () almost completely, and it seems that everything is about to end, but do you think you haven't understood how the device works so far? USB flash drives are not only USB devices but also "disks". They also need to comply with the USB Mass Storage protocol and Transparent SCSI specifications. From the driver's perspective, it is similar
unsigned int delay_use = 5;
111 module_param (delay_use, uint, S_IRUGO | S_IWUSR );
112 MODULE_PARM_DESC (delay_use, "seconds todelay before using a new device ");
Set delay_use to 5, while module_param is a macro provided by Linux Kernel 2.6, so that delay_use can be set when the module is loaded. (If this parameter is not set, the value 5 indicates that a new device is waiting for a delay of 5 seconds .) Why latency? When the inserted
USB flash drive to install Linux system, unplug the USB drive system cannot bootProblem Description:Use a USB stick to install the Linux operating system, excluding the USB stick, unable to boot the system normally, you must inser
Objective: To study USB in depth and take notes here. Welcome to the discussion.
[Linux 3.2] [Driver/USB/CORE/hub. C]
Function: usb_hub_init
int usb_hub_init(void){if (usb_register(hub_driver)
Usb_hub_init mainly implements two functions: one is to register the hub driver, and the other is to start a kernel thread named khubd (this thread can be seen through P
threads_gone as its
1095* Last act, we have to call wait_for_completion the rightNumber
1096* Of times.
1097*/
1098While(Atomic_read ( total_threads)> 0 ){
1099Wait_for_completion ( threads_gone );
1100Atomic_dec ( total_threads );
1101}
1102
1103Usb_usual_clear_present (usb_us_type_stor );
1104}
1105
1106 module_init (usb_stor_init );
1107 module_exit (usb_stor_exit );
In fact,Module_init/module_exitIt's just a macro. Generally, a module writer will give his own initialization function and log
U disk boot and installation of Linux (not to install Linux on the u disk) 1. DiskGenius.exe this software can meet my needs, try it, it is still very useful.DiskGenius Software InterfaceCreate a usb hdd boot diskUse this software to make the USB flash drive into a usb hdd b
Let's continue with the previous section. Fill_inquiry_response (), which is from drivers/USB/storage/USB. C.
266 void fill_inquiry_response (struct us_data * us, unsigned char * data,
267 unsigned int data_len)
268 {
269 If (data_len
270 return;
271
272 if (data [0] 0x20) {/* USB device currently not connected. Return
273 peripheral qualifier 001b (".
Let's continue with the previous section. Fill_inquiry_response (), which is from drivers/usb/storage/usb. c.
266 void fill_inquiry_response (struct us_data * us, unsigned char * data,
267 unsigned int data_len)
268 {
269 if (data_len
270 return;
271
272 if (data [0] 0x20) {/* USB device currently not connected. Return
273 peripheral qualifier 001b ("..
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.