You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
711 /* Submitted by Hartmut Wahl */<br />
712 UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001,<br />
713 "Samsung",<br />
714 "Digimax 410",<br />
715 US_SC_DEVICE, US_PR_DEVICE, NULL,<br />
716 US_FL_FIX_INQUIRY),<br />
Digimax 410,熟悉数码相机的哥们儿大概对三星的这款410 万像素3 倍光学变焦的产品不会陌生,<br />
不过数码相机更新得很快,这款2002 年推出的相机如今当然也算是很一般了,市场上卖的话也就1500 以<br />
下,不过当时刚推出的时候也是3000 到4000 元的.ok,我们来看这一行是什么意思.<br />
UNUSUAL_DEV 这个宏被定义过两次,当然,#define 了之后再下一次#define 之前有一个#undef,<br />
否则就重复定义了.在storage_usb_ids 之前,它的定义是<br />
116 #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \<br />
117 vendorName, productName,useProtocol, useTransport, \<br />
118 initFunction, flags) \<br />
119 { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin,bcdDeviceMax) }<br />
USB_DEVICE_VER 的定义在include/linux/usb.h 中,<br />
448 /**<br />
449 * USB_DEVICE_VER - macro used to describe a specific usb device with a<br />
version range<br />
450 * @vend: the 16 bit USB Vendor ID<br />
451 * @prod: the 16 bit USB Product ID<br />
452 * @lo: the bcdDevice_lo value<br />
453 * @hi: the bcdDevice_hi value<br />
454 *<br />
455 * This macro is used to create a struct usb_device_id that matches a<br />
456 * specific device, with a version range.<br />
457 */<br />
458 #define USB_DEVICE_VER(vend,prod,lo,hi) \<br />
459 .match_flags =<br />
USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, .idVendor = (vend), .idProduct =<br />
(prod), .bcdDevice_lo = (lo), .bcdDevice_hi = (hi)<br />
所以这行最终出现在storage_usb_ids 中的意思就是令match_flags 为<br />
USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION,idVendor 为0x0839,idProduct 为<br />
0x000a,bcdDevice_lo 为0x0001,bcdDevice_hi 为0x0001.<br />
43<br />
而在us_unusal_dev_list 这张表之前,UNUSUAL_DEV 又被定义为:<br />
168 #undef UNUSUAL_DEV<br />
169 #define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \<br />
170 vendor_name, product_name, use_protocol, use_transport,<br />
\<br />
171 init_function, Flags) \<br />
172 { \<br />
173 .vendorName = vendor_name, \<br />
174 .productName = product_name, \