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 ...
随机推荐
- line-height和vertical-algin
项目中,经常会用到line-height和vertical-algin来解决垂直居中的问题,但对其原理和应用限制却很少了解.因此做了一下总结: line-height具有继承性,对inline元素.t ...
- 【Android N 7.1.1】 屏幕亮和灭的处理地方
frameworks/base/services/core/java/com/android/server/display/DisplayPowerController.java private vo ...
- Python 中的线程-进程1
原文:https://www.cnblogs.com/i-honey/p/8042047.html 1. 并行和并发 并行:同时做某些事,可以互不干扰的同一时刻做几件事. 并发:也是同时做某些事,但是 ...
- EUI组件之HScrollBar VScrollBar (动态设置滑块图片)
一.常规使用 官网教程里没有这个组件的使用方法 这个组件配合Scroller使用 拖动一个scroller到exml上.scroller上已经默认存在了HScrollBar和VScrollBar 当图 ...
- eui.Button 上放置两张图片
有时按钮会有一个需求.放置一个按钮底图,按钮文字是特效字体,也是一张图. 1 1个普通按钮 <e:Button label="> <e:skinName> < ...
- 微信小程序 --- page.json文件
page.json 文件用于配置当前目录.page.json文件里的配置可以修改 app.json 配置里面的 window:不能覆盖app.json文件里面的 tabBar / 网络超时/ debu ...
- fiddler 面板内显示IP地址
1.打开fiddler, 快捷键Ctrl+R (菜单->Rules->Customize Rules…) 然后在CustomRules.js文件里Ctrl+F查找字符串:static f ...
- tomcat的server.xml中的Context节配置
Tomcat的默认网站目录是:C:\Tomcat 9.0\webapps\ROOT,里面的index.jsp,就是tomcat官方提供的默认页,如果按照默认配置,访问链接应当是http://local ...
- Oracle性能优化之表压缩及并行提高效率的测试
1.制作测试表 create table t1 as select * from FW_T_GTXLOG insert into t1 select * from t1; create table t ...
- talib 中文文档(七):Overlap Studies Functions
Overlap Studies Functions 重叠指标 BBANDS - Bollinger Bands 函数名:BBANDS 名称: 布林线指标 简介:其利用统计原理,求出股价的标准差及其信赖 ...