line has its own story. In this section, we will only talk about one line of code. Yes, it is a line of code, because we need to introduce a term, a well-known name, which is the legendary "urb ", USB RequestBlock. The USB device needs to communicate with each other. to transmit data, you need to use urb. Specifically
1. URB Structural BodyUSB Request block (USB requestor block,urb) is a USB device driver used to describe the basic carrier and core data structure for communication with USB devices, very similar to the SK_BUFF structure in network device drivers. struct
Usb_alloc_urb
Usb_free_urb
Allocate and release
Urb filling:Specify the urb type, which can be Ctrl, bulk, Int, or ISO.Enter the callback function.
Usb_submit_urbUsb_unlink_urbFill the urb structure or remove it from the USB system.
When the urb type is ISO or Int, an
It indicates that any short read that may occur on an in endpoint should be treated as an error by the USB core. this value is only useful for reading urb from a USB device, not for writing URBS.
Urb_iso_asapIf this urb is synchronized, this bit can be set. If the driver wants this
for each configuration unsigned short bus_ma; Bus current available for use
U8 Portnum; Parent port numberU8 level; Number of layers in the USB hub unsigned can_submit:1; URB can be submitted flagunsigned discon_suspended:1; Break flag when pausedunsigned persist_enabled:1; Usb_persist Enable flagunsigned have_langid:1; String_langid Presence Flagunsigned authorized:1;unsigned authenticated:1;unsigned wu
]; // The Sub-device connected to the hub.Int pm_usage_cnt; // use count for automatic suspensionU32 quirks;Atomic_t urbnum; // The urb count submitted by this device Unsigned long active_duration; // use timing after activation
# Ifdef config_pm // related to power managementStruct delayed_work autosuspend; // automatic suspension DelayStruct work_struct autoresume; // (interrupted) Automatic wake-up requestStruct mutex pm_mutex; // The mutex of the
1. Environment:Upper machine: ubuntu16.04Linux Jello 4.4.0-89-generic #112-ubuntu SMP Mon Jul 19:38:41 UTC x86_64 x86_64 x86_64 gnu/linuxLower machine:/home/jello # Uname-aLinux 3.10.0 #2 SMP Mon Mar 6 17:52:09 CST armv7l gnu/linux2. Background:The host computer through the USB to the serial port to connect the lower machine, uses the Kermit carries on the serial port interaction, suddenly in the upper computer cannot interact, the serial port does no
kernel version, the same as below)/drivers/usb, file name is usb-skeleton.c. Write a USB driver mostThere are four things to do: the device to be supported by the driver, the USB driver to be registered, the detection and disconnection, the submission and control of urb (
complete the communication.The so-called function driver is what this USB device is for, such as a USB camera, or a USB keyboard.function driven on the bus driver above, the USB interface protocol is a standard common protocol, generally with USB interface devices, the unde
guarantee that the transmission is completed within a specific time range. If there is not enough space on the bus to send the entire BULK package, it is divided into multiple packages for transmission. These endpoints are generally used on printers, USB Mass Storage, and USB network devices.4) When ISOCHRONOUS is used, the endpoint also transfers a large amount of data in batches, but this data cannot be
);Usb_set_intfdata (interface, null );Usb_deregister_dev (interface, skel_class );Then, he will use kref_put ( Dev-> kref, skel_delete) to clean up. For details about kref_put, refer to the previous article.So far, we have analyzed the main operations required by the USB subsystem. The next section will discuss the I/O operations on the USB device.When talking about the I/O operation of the
Previous article: http://www.2cto.com/ OS /201511/114321.htmlin usb_stor_bulk_transport (), the first most important function called in this function is usb_stor_bulk_transfer_buf (). Still from drivers/usb/stroage/transport. c: previous: http://www.2cto.com/ OS /201112/114321.html
In usb_stor_Bulk_transport (), the first most important function called in this function is usb_stor_bulk_transfer_buf (). Still from drivers/
;//Descriptor Type _ _le16 wdata [1];
/* encoded with Utf-16le */ 2 USB Host Drive USB host controllers are available in 3 sizes: OHCI (Open Host controller Interface), UHCI (Universal hosts controller Interface) and EHCI (Enhanced host Co Ntroller Interface).2.1 Host Controller DriverIn the Linux kernel, the USB_HCD structure is used to describe the U
usb_device stores information about a USB device, including the device address, device descriptor, configuration descriptor, and so on.
The USB bus system usb_bus stores information about a USB Bus System, including the device address information on the bus, the root hub, and bandwidth usage. A usb bus system must ha
urb_list; //URB for this endpoint, maintained by the USB core
void *hcpriv;
struct Ep_device *ep_dev; / * for SYSFS info * /
unsigned Char*extra; /* Extra descriptors * /
int Extralen;
int enabled;
};
an int usb_hcd_link_urb_to_ep (struct USB_HCD *hcd, struct URB *urb) is called to add this
The usb_stor_bulk_transfer_sglist () function is confusing. We have mentioned that sglist is used to improve transmission efficiency. As we know, SG aims to transmit a bunch of discontinuous buffers in one DMA Operation. In fact, this is not the case in the story of USB. However, if you don't care about the behavior in the USB core, it doesn't matter.
Row 3 and row 3 do not pass data if you exit or break th
when the controller driver is added, and when a hub insertion is detected on the root hub port, a USB hub is created, which is applied to the root hub or the normal hub when it is configured for interrupt Endpoint application URB Related resources:[HTML]View Plaincopy
hub->urb = usb_alloc_urb (0, Gfp_kernel);
if (!hub->
reprint Please indicate source: Http://blog.csdn.net/Righthek Thank you! The previous article has mentioned that the most important two functions of the USB interface in the WiFi module are Usb_read_port () and Usb_write_port (). So how do they relate to WiFi? We can analyze from the following three aspects:1, the first need to clear the WiFi module is a USB device, the main control (CPU) side is a
/seconds.Let's introduce Dosusb. Dosusb's official website is as follows:Http://www.usbdos.netThe latest version of DOGUSB can be downloaded from its official website, and the current version is 1.1.1. or download this version of DOSUSB below at the following URL. Http://blog.hengch.com/software/dosusb/dosusb.zipDosusb can be used free of charge in non-commercial areas, if willing to spend money, can purchase to source code, from its official website of the Forum to see, in September 2006 the
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.