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
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
Objective: To study USB in depth and take notes here. Welcome to the discussion.
[Linux 3.2] [Driver/USB/CORE/devio. C]
Definition: usbfs_driver
struct usb_driver usbfs_driver = {.name ="usbfs",.probe =driver_probe,.disconnect =driver_disconnect,.suspend =driver_suspend,.resume =driver_resume,};
[Linux 3.2] [INCLUDE/
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
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
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
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
tool for viewing all the partition tables in your system, including all USB devices, using root privileges to execute the following commands:[[emailprotected] ~]# fdisk-ldisk/dev/sda:21.5 GB, 21474836480 bytes, 41943040 sectorsunits = sectors of 1 * 512 = Bytessector Size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): bytes/512 bytesdisk Labe L type:dosdisk identifier:0x0006c7ae Device Boot Start End Blocks Id system/dev/sda1 * 2 048
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
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 ("..
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,
that Genesys Logic's products had this problem, and later we found that more products had the same problem. Therefore, the flag US_FL_GO_SLOW is used. If you are interested in looking at the early Linux Kernel, you will find that there was actually no such flag. At that time, a USB_VENDOR_ID_GENESYS is defined, directly compare whether this product is from Genesys Logic. If yes, consider this latency. Otherwise, you will not need to use it.Line 3, tr
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
drivers/usb/storage/protocol. h:
51/* struct scsi_cmnd transfer buffer accessutilities */
52 enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF };
This parameter is actually a simple enumerated data type, and its meaning is also very simple: one indicates copying to the server load balancer> request_buffer, TO_XFER_BUF; the other indicates copying from the server load balancer> request_buffer, FROM_XFER_BUF. (Digression: XFER refers to TRANSFER, which
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
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.