usb_submit_urb
hub_irq() --> usb_submit_urb() usb_start_wait_urb() --> usb_submit_urb()
一旦urb被USB驱动程序正确地创建和初始化后,就可以递交到USB核心以发送到USB设备了。如果函数调用成功,当urb被HC处理结束的时候,urb的结束处理例程(urb->complete)正好被调用一次,当该结束处理函数被调用时,USB核心就结束了对urb的处理,此刻对urb的控制器权就返回给设备驱动程序了。
函数usb_submit_urb()用来递交URB,它在对URB进行设置后,调用主机控制器函数usb_hcd_submit_urb()来完成递交操作。
错误代码:
-ENOMEM 内存不足
-ENODEV 没有设备可用
-EPIPE 端点停止
-EAGAIN 排队等候同步传输的太多
-EFBIG 请求ISO frame的太多
-EINVAL 无效的中断间隔
函数usb_submit_urb递交URB后,urb->status为-EINPROGRESS.
https://www.cnblogs.com/zxc2man/p/6650505.html
urb status
int status
When the urb is finished, or being processed by the USB core, this variable is set
to the current status of the urb. The only time a USB driver can safely access this
variable is in the urb completion handler function (described in the section
“Completing Urbs: The Completion Callback Handler”). This restriction is to
prevent race conditions that occur while the urb is being processed by the USB
core. For isochronous urbs, a successful value (0) in this variable merely indi-
cates whether the urb has been unlinked. To obtain a detailed status on isochro-
nous urbs, the iso_frame_desc variables should be checked.
Valid values for this variable include:
0
The urb transfer was successful.
-ENOENT
The urb was stopped by a call to usb_kill_urb.
-ECONNRESET
The urb was unlinked by a call to usb_unlink_urb, and the transfer_flags
variable of the urb was set to URB_ASYNC_UNLINK.
-EINPROGRESS
The urb is still being processed by the USB host controllers. If your driver
ever sees this value, it is a bug in your driver.
-EPROTO
One of the following errors occurred with this urb:
? A bitstuff error happened during the transfer.
? No response packet was received in time by the hardware.
-EILSEQ
There was a CRC mismatch in the urb transfer.
-EPIPE
The endpoint is now stalled. If the endpoint involved is not a control end-
point, this error can be cleared through a call to the function usb_clear_halt.
-ECOMM
Data was received faster during the transfer than it could be written to sys-
tem memory. This error value happens only for an IN urb.
-ENOSR
Data could not be retrieved from the system memory during the transfer fast
enough to keep up with the requested USB data rate. This error value hap-
pens only for an OUT urb.
-EOVERFLOW
A “babble” error happened to the urb. A “babble” error occurs when the
endpoint receives more data than the endpoint’s specified maximum packet
size.
-EREMOTEIO
Occurs only if the URB_SHORT_NOT_OK flag is set in the urb’s transfer_flags
variable and means that the full amount of data requested by the urb was
not received.
-ENODEV
The USB device is now gone from the system.
-EXDEV
Occurs only for a isochronous urb and means that the transfer was only par-
tially completed. In order to determine what was transferred, the driver
must look at the individual frame status.
-EINVAL
Something very bad happened with the urb. The USB kernel documentation
describes what this value means:
ISO madness, if this happens: Log off and go home
It also can happen if a parameter is incorrectly set in the urb stucture or if an
incorrect function parameter in the usb_submit_urb call submitted the urb to
the USB core.
-ESHUTDOWN
There was a severe error with the USB host controller driver; it has now
been disabled, or the device was disconnected from the system, and the urb
was submitted after the device was removed. It can also occur if the configu-
ration was changed for the device, while the urb was submitted to the
device.
Generally, the error values -EPROTO, -EILSEQ, and -EOVERFLOW indicate hardware
problems with the device, the device firmware, or the cable connecting the
device to the computer.
源地址:http://hi.baidu.com/zengzhaonong/item/9fda4f191e4a79623f87ce57
usb_submit_urb的更多相关文章
- usb_submit_urb 解释的够够的
/** * usb_submit_urb - issue an asynchronous transfer request for an endpoint * @urb: pointer to the ...
- 学习Linux下s3c2440的USB鼠标驱动笔记
1.ARM-Linux下USB驱动程序开发1.1.1.linux下USB配置:*********(MassStorage:存储设备)********************************** ...
- 嵌入式Linux驱动学习之路(二十)USB设备驱动
USB在接入系统的时候,以0的设备ID和主机通信,然后由主机为其分配新的ID. 在主机端,D+和D-都是下拉接地的.而设备端的D-接上拉时,表明此设备为高速设备:12M/s. D+接上拉时则是全速设备 ...
- Linux内核USB驱动【转】
本文转载自:http://www.360doc.com/content/12/0321/14/8363527_196286673.shtml 注意,该文件是2.4的内核的驱动源文件,并不保证在2.6内 ...
- USB驱动开发大全【转】
本文转载自:http://www.360doc.com/content/12/0504/19/8363527_208666082.shtml 编写USB驱动程序步骤:1所有usb驱动都必须创建主要结构 ...
- linux驱动之USB驱动程序
1. USB是主从结构的 所有的USB传输,都是从USB主机这方发起:USB设备没有"主动"通知USB主机的能力. 例子:USB鼠标滑动一下立刻产生数据,但是它没有能力通知PC机来 ...
- usb驱动开发17之设备生命线
拜会完了山头的几位大哥,还记得我们从哪里来要到哪里去吗?时刻不能忘记自身的使命啊.我们是从usb_submit_urb()最后的那个遗留问题usb_hcd_submit_urb()函数一路走来,现在就 ...
- usb驱动开发16之设备生命线
回到struct usb_hcd,继续努力的往下看. kref,usb主机控制器的引用计数.struct usb_hcd也有自己专用的引用计数函数,看hcd.c文件. static void hcd_ ...
- usb驱动开发14之设备生命线
直接看代码吧. /*-------------------------------------------------------------------*/ /** * usb_submit_urb ...
随机推荐
- Docker源码分析(七):Docker Container网络 (上)
1.前言(什么是Docker Container) 如今,Docker技术大行其道,大家在尝试以及玩转Docker的同时,肯定离不开一个概念,那就是“容器”或者“Docker Container”.那 ...
- Intellij debug模式使用
1.这里以一个web工程为例,点击图中按钮开始运行web工程. 2.设置断点 3.使用postman发送http请求 4.请求发送之后会自动跳到断点处,并且在断点之前会有数据结果显示 5.按F8 在 ...
- 原创Java多线程详解(一)
只看书不实践是不行的.来实践一下~~~~~~(引用请指明来源) 先看看百科对多线程的介绍 多线程(英语:multithreading),是指从软件或者硬件上实现多个线程并发执行的技术.具有多线程能力的 ...
- LeetCode - Duplicate Emails
Description:Write a SQL query to find all duplicate emails in a table named Person. 找出表中重复的Email. # ...
- iOS UITextField输入后隐藏键盘
1.首先在Interface Builder中选择TextFields,然后在Text Field Attributes中找到Text Input Traits,选择Return Key为done. ...
- Android 微信分享,分享到朋友圈与分享到好友,以及微信登陆
extends:http://www.cnblogs.com/android100/p/Android-qq.html 一.申请你的AppID http://open.weixin.qq.com/ 友 ...
- KMP的next数组性质运用
hdu2594 Simpsons' Hidden Talents Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 ...
- [SQL] 让特定的数据 排在最前
MYSQL目前常用的两种方法,如下: 让值为"张三" 的数据排在最前. -- 方法一 end asc -- 方法二 select * from tableName where co ...
- Python开发【模块】:Pygal 绘制直方图
Pygal Pygal可用来生成可缩放的矢量图形文件,对于需要在尺寸不同的屏幕上显示的图表,这很有用,可以自动缩放,自适应观看者的屏幕 1.Pygal模块安装 ① Windows系统 # Pygal模 ...
- 双态运维联盟(BOA)正式成立
3月1日,由联想.新华三.华为等12家IT企业在北京正式达成协议,联合发起成立“双态运维联盟”.中国电子工业标准技术协会.信息技术服务分会数据中心运营管理工作组(DCMG)组长肖建一先生出席了会议. ...