07.06.2013 Views

Scsi - Index of

Scsi - Index of

Scsi - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

91 * construct these entries. Each entry you provide will either identify<br />

92 * one or more specific products, or will identify a class <strong>of</strong> products<br />

93 * which have agreed to behave the same. You should put the more specific<br />

94 * matches towards the beginning <strong>of</strong> your table, so that driver_info can<br />

95 * record quirks <strong>of</strong> specific products.<br />

96 */<br />

97 struct usb_device_id {<br />

98 /* which fields to match against? */<br />

99 __u16 match_flags;<br />

100<br />

101 /* Used for product specific matches; range is inclusive */<br />

102 __u16 idVendor;<br />

103 __u16 idProduct;<br />

104 __u16 bcdDevice_lo;<br />

105 __u16 bcdDevice_hi;<br />

106<br />

107 /* Used for device class matches */<br />

108 __u8 bDeviceClass;<br />

109 __u8 bDeviceSubClass;<br />

110 __u8 bDeviceProtocol;<br />

111<br />

112 /* Used for interface class matches */<br />

113 __u8 bInterfaceClass;<br />

114 __u8 bInterfaceSubClass;<br />

115 __u8 bInterfaceProtocol;<br />

116<br />

117 /* not matched against */<br />

118 kernel_ulong_t driver_info;<br />

119 };<br />

实际上这个结构体对每一个usb设备来说,就相当于是她的身份证,记录了她的一些基本信息,通常我们的身<br />

份证上会记录我们的姓名,性别,出生年月,户口地址等等,而usb 设备她也有她需要记录的信息,以区分她和<br />

别的usb 设备,比如Vendor-厂家,Product-产品,以及其他一些比如产品编号,产品的类别,遵循的协议,这<br />

些都会在usb 的规范里边找到对应的冬冬.暂且先不细说.<br />

于是我们知道,一个usb_driver 会把它的这张id 表去和每一个usb 设备的实际情况进行比较,如果该设<br />

备<br />

的实际情况和这张表里的某一个id 相同,准确地说,只有这许多特征都吻合,才能够把一个usb device 和<br />

这<br />

个usb driver 进行绑定,这些特征哪怕差一点也不行.就像我们每个人都是一道弧,都在不停寻找能让彼此<br />

嵌成完整的圆的另一道弧,事实却是,每个人对Π(PI)的理解不尽相同,而圆心能否重合,或许只有痛过才知<br />

道.差之毫厘,失之交臂.<br />

那么usb 设备的实际情况是什么时候建立起来的?嗯,在介绍.probe 指针之前有必要先谈一谈另一个数据<br />

结构了,她就是struct usb_device.<br />

19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!