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的更多相关文章

  1. usb_submit_urb 解释的够够的

    /** * usb_submit_urb - issue an asynchronous transfer request for an endpoint * @urb: pointer to the ...

  2. 学习Linux下s3c2440的USB鼠标驱动笔记

    1.ARM-Linux下USB驱动程序开发1.1.1.linux下USB配置:*********(MassStorage:存储设备)********************************** ...

  3. 嵌入式Linux驱动学习之路(二十)USB设备驱动

    USB在接入系统的时候,以0的设备ID和主机通信,然后由主机为其分配新的ID. 在主机端,D+和D-都是下拉接地的.而设备端的D-接上拉时,表明此设备为高速设备:12M/s. D+接上拉时则是全速设备 ...

  4. Linux内核USB驱动【转】

    本文转载自:http://www.360doc.com/content/12/0321/14/8363527_196286673.shtml 注意,该文件是2.4的内核的驱动源文件,并不保证在2.6内 ...

  5. USB驱动开发大全【转】

    本文转载自:http://www.360doc.com/content/12/0504/19/8363527_208666082.shtml 编写USB驱动程序步骤:1所有usb驱动都必须创建主要结构 ...

  6. linux驱动之USB驱动程序

    1. USB是主从结构的 所有的USB传输,都是从USB主机这方发起:USB设备没有"主动"通知USB主机的能力. 例子:USB鼠标滑动一下立刻产生数据,但是它没有能力通知PC机来 ...

  7. usb驱动开发17之设备生命线

    拜会完了山头的几位大哥,还记得我们从哪里来要到哪里去吗?时刻不能忘记自身的使命啊.我们是从usb_submit_urb()最后的那个遗留问题usb_hcd_submit_urb()函数一路走来,现在就 ...

  8. usb驱动开发16之设备生命线

    回到struct usb_hcd,继续努力的往下看. kref,usb主机控制器的引用计数.struct usb_hcd也有自己专用的引用计数函数,看hcd.c文件. static void hcd_ ...

  9. usb驱动开发14之设备生命线

    直接看代码吧. /*-------------------------------------------------------------------*/ /** * usb_submit_urb ...

随机推荐

  1. 数据提交方式:post和get

    众所周知,在B/S应用程序中,前台与后台的数据交互,都是通过HTML中Form表单完成的.而Form提供了两种数据传输的方式——get和post.           Get请求表示客户端请求一个ur ...

  2. 条件注释判断IE浏览器版本

    lt,lte,gt,gte分别表示什么 lt:小于当前版本 lte:小于或等于当前版本,包括本身 gt:大于当前版本 gte:大于或等于当前版本,包括本身 使用格式 // 如IE9以下(不包括IE9加 ...

  3. Egret P2 ( 一) 掉落的小球

    实际效果(蛋疼这个gif制作软件,帧率太低....): 一 Egret和P2的坐标系 首先了解下P2和Egret的坐标系. 某人链接:http://blog.csdn.net/qilei2010/ar ...

  4. 使用Martix来实现缩放图片的功能

    使用Martix(android.graphics.Matrix)类中的postScale()方法结合Bitmap来实现缩放图片的功能 Bitmap bmp = BitmapFactory.decod ...

  5. 310实验室(七)OptimizationTemplateLibrary

    利用泛型编程思想,C++模板. 首先定义变量或者重新typedef variables: 模板中的变量:_TRandom.double  _TReal._TProblem::TDecision _TD ...

  6. JavaORM框架之Mybatis篇(Ibatis)

    欢迎查看Java开发之上帝之眼系列教程,如果您正在为Java后端庞大的体系所困扰,如果您正在为各种繁出不穷的技术和各种框架所迷茫,那么本系列文章将带您窥探Java庞大的体系.本系列教程希望您能站在上帝 ...

  7. Linux(Centos)下搭建SVN服务器

    鉴于在搭建时,参考网上很多资料,网上资料在有用的同时,也坑了很多人,本文的目的,也就是想让后继之人在搭建svn服务器时不再犯错,不再被网上漫天的坑爹作品所坑害,故此总结! /******开始***** ...

  8. spring-boot集成redis

    application.properties #redis 配置 # Redis数据库索引(默认为0) spring.redis.database=0 # Redis服务器地址 spring.redi ...

  9. sprintf函数详解

    转摘声明:选自<CSDN 社区电子杂志——C/C++杂志> 在将各种类型的数据构造成字符串时,sprintf 的强大功能很少会让你失望.由于sprintf 跟printf 在用法上几乎一样 ...

  10. python中super的使用

    转自:http://python.jobbole.com/86787/ super() 的入门使用 在类的继承中,如果重定义某个方法,该方法会覆盖父类的同名方法,但有时,我们希望能同时实现父类的功能, ...