usb 的总线驱动程序和usb设备驱动程序分析,usb interface and driver
来源:互联网 发布:tomcat配置数据库 编辑:程序博客网 时间:2024/04/27 17:52
6. USB总线驱动程序的作用
a. 识别USB设备
1.0 USB通过端口0 ,给USB分配新的地址,set address
2.0 发出命令,获取设备描述符。
b. 查找并安装对应的设备驱动程序
c. 提供USB读写函数
在分析USB设备驱动程序的时候,肯定会遇到Hub.c
hub_port_connect_change method
hub_port_init
hub_set_address
在内核目录下搜:
grep "USB device using" * -nR
drivers/usb/core/hub.c:2186: "%s %s speed %sUSB device using %s and address %d\n",
hub_irq
kick_khubd
hub_thread
hub_events
hub_port_connect_change
udev = usb_alloc_dev(hdev, hdev->bus, port1);
dev->dev.bus = &usb_bus_type;
dev->dev.type = &usb_device_type; 这个目前还不知道在哪里用到
这个地方把device的bus总线赋值成usb_bus_type,说明是USB总线
看这个usb_bus_type,其实是一个结构体,里面有名字和match函数。
这也就是后面说的 usb_bus_type总线的左边是USB interface 和 usb的driver
的id_table进行比较 usb_drv->id_table
请看这个函数
下面五个函数在 usb_device_match 里面。
struct usb_interface *intf;
struct usb_driver *usb_drv; usb_driver 里面就有id_table和probe函数
intf = to_usb_interface(dev);
usb_drv = to_usb_driver(drv);
id = usb_match_id(intf, usb_drv->id_table);
这个地方就usb_interface和drive的id_table
choose_address(udev); // 给新设备分配编号(地址)
hub_port_init // usb 1-1: new full speed USB device using s3c2410-ohci and address 3
hub_set_address // 把编号(地址)告诉USB设备
usb_get_device_descriptor(udev, 8); // 获取设备描述符
retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE);
usb_new_device(udev)
err = usb_get_configuration(udev); // 把所有的描述符都读出来,并解析
usb_parse_configuration
device_add // 把device放入usb_bus_type的dev链表,
// 从usb_bus_type的driver链表里取出usb_driver,
// 把usb_interface和usb_driver的id_table比较
// 如果能匹配,调用usb_driver的probe
<LINUX内核源代码情景分析>
- usb 的总线驱动程序和usb设备驱动程序分析,usb interface and driver
- USB设备驱动程序-USB Gadget Driver(二)
- USB设备驱动程序-USB Gadget Driver(三)
- USB设备驱动程序-USB Gadget Driver(四)
- USB设备驱动程序-USB Gadget Driver(二)
- USB设备驱动程序-USB Gadget Driver(三)
- USB设备驱动程序-USB Gadget Driver(四)
- USB设备驱动程序-USB Gadget Driver(二)
- USB设备驱动程序-USB Gadget Driver(三)
- USB设备驱动程序-USB Gadget Driver(四)
- USB设备驱动程序-USB Gadget Driver
- USB驱动----USB总线驱动程序
- USB驱动程序之USB总线驱动程序
- Linux驱动USB驱动程序-USB总线驱动程序
- USB总线驱动程序
- USB总线驱动程序
- USB设备驱动程序的设计
- USB驱动程序之USB设备驱动程序
- 早做完早完事。
- 通过web.xml中的监听器加载spring配置文件
- 使用Powerline为VIM和Bash注入强劲动力
- 去除有道词典底部广告栏
- 42翻转单词
- usb 的总线驱动程序和usb设备驱动程序分析,usb interface and driver
- 《活着》
- thinkphp5未定义变量会抛出异常,页面错误,请稍后再试!
- ITOO云平台--新生入学-split对空字符分割处理
- 如何查看mapreduce日志
- C#程序的打包和异地发布
- 对于Java程序猿学习的建议
- 关于面向对象中的代码审查(Code Review)
- java泛型----冒泡排序+选择排序