{"id":2446,"date":"2011-12-15T16:48:28","date_gmt":"2011-12-15T07:48:28","guid":{"rendered":"http:\/\/blog.bitmeister.jp\/?p=2446"},"modified":"2011-12-15T16:48:28","modified_gmt":"2011-12-15T07:48:28","slug":"linux%e3%81%a7usbserial%e3%83%a2%e3%82%b8%e3%83%a5%e3%83%bc%e3%83%ab%e3%81%abl-02c%e3%82%92%e8%87%aa%e5%8b%95%e3%81%a7%e8%aa%8d%e8%ad%98%e3%81%95%e3%81%9b%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.bitmeister.jp\/?p=2446","title":{"rendered":"Linux\u3067usbserial\u30e2\u30b8\u30e5\u30fc\u30eb\u306bL-02C\u3092\u81ea\u52d5\u3067\u8a8d\u8b58\u3055\u305b\u308b"},"content":{"rendered":"<p>Linux\u3067Docomo\u306e\u901a\u4fe1\u30c7\u30d0\u30a4\u30b9L-02C\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u73fe\u72b6\u3001usbserial\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5f15\u6570\u4ed8\u304d(<strong>vendor=0x1004 product=0x618f<\/strong>)\u3067\u30ed\u30fc\u30c9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u8af8\u4e8b\u60c5\u306b\u3088\u308a\u5f15\u6570\u4ed8\u304d\u3067\u30ed\u30fc\u30c9\u3059\u308b\u8a33\u306b\u306f\u3044\u304b\u306a\u3044\u306e\u3067\u3001\u81ea\u52d5\u3067\u8a8d\u8b58\u3055\u305b\u308b\u3088\u3046\u306b\u3057\u305f\u6642\u306e\u65b9\u6cd5\u3092\u307e\u3068\u3081\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p><strong>\u524d\u63d0\u6761\u4ef6<\/strong><br \/>\n\u30ab\u30fc\u30cd\u30eb\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306f\u3001linux-2.6.37\u3067\u3059\u3002<br \/>\n\u30ab\u30fc\u30cd\u30eb\u304a\u3088\u3073\u30ab\u30fc\u30cd\u30eb\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u7b49\u306e\u77e5\u8b58\u3092\u4fdd\u6709\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u524d\u63d0\u3067\u3059\u3002<br \/>\n<strong style=\"color: #ff0000;\">\u30ab\u30fc\u30cd\u30eb\u304a\u3088\u3073\u30ab\u30fc\u30cd\u30eb\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5165\u308c\u66ff\u3048\u306b\u306f\u8d77\u52d5\u3057\u306a\u304f\u306a\u308b\u7b49\u306e\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u81ea\u5df1\u8cac\u4efb\u3067\u4f5c\u696d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/strong><\/p>\n<p><strong>usbserial.ko\u306e\u8abf\u67fb<\/strong><br \/>\n\u5bfe\u8c61\u306e\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\u306f\u3001drivers\/usb\/serial\/generic.c\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u90e8\u5206(\u5b9f\u969b\u306f\u300134\u884c\u76ee\u304b\u308943\u884c\u76ee)\u3067\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306evendorID\u3001productID\u304c\u5ba3\u8a00\u3055\u308c\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3082\u53d7\u3051\u4ed8\u3051\u3089\u308c\u308b\u3088\u3046\u306b\u8a18\u8ff0\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"c\" name=\"code\">\r\nstatic __u16 vendor  = 0x05f9;\r\nstatic __u16 product = 0xffff;\r\n\r\nmodule_param(vendor, ushort, 0);\r\nMODULE_PARM_DESC(vendor, \"User specified USB idVendor\");\r\n\r\nmodule_param(product, ushort, 0);\r\nMODULE_PARM_DESC(product, \"User specified USB idProduct\");\r\n\r\nstatic struct usb_device_id generic_device_ids[2]; \/* Initially all zeroes. *\/\r\n<\/pre>\n<p>\u91cd\u8981\u306a\u306e\u306f\u3001generic_device_ids\u914d\u5217\u3067\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u767b\u9332\u51e6\u7406\u6642\u306eusb_serial_generic_register\u95a2\u6570\u5185\u306b\u304a\u3044\u3066\u3001generic_device_ids\u306e0\u756a\u76ee\u306e\u8981\u7d20\u306b\u5f15\u6570\u6307\u5b9a\u3055\u308c\u305f\u5834\u5408\u306f\u305d\u306e\u5024\u304c\u3001\u3055\u308c\u306a\u3044\u5834\u5408\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u5024\u304c\u767b\u9332\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u3053\u3068\u304b\u3089\u3001generic_device_ids\u914d\u5217\u306b\u81ea\u52d5\u8a8d\u8b58\u3055\u305b\u305f\u3044\u30c7\u30d0\u30a4\u30b9\u306evendorID\u3001productID\u3092\u5165\u308c\u308c\u3070\u3088\u3044\u3068\u3044\u3046\u3053\u3068\u304c\u63a8\u6e2c\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><strong>generic.c\u306e\u5909\u66f4\u70b9<\/strong><br \/>\n\u5b9f\u969b\u306b\u884c\u3063\u305f\u5909\u66f4\u306f\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n<pre class=\"c\" name=\"code\">\r\ndiff -ruaN .\/bkup\/generic.c .\/change\/generic.c\r\n--- .\/bkup\/generic.c    2011-12-15 14:53:42.726830743 +0900\r\n+++ .\/change\/generic.c  2011-12-15 15:03:28.654831284 +0900\r\n@@ -40,7 +40,17 @@\r\n module_param(product, ushort, 0);\r\n MODULE_PARM_DESC(product, \"User specified USB idProduct\");\r\n\r\n-static struct usb_device_id generic_device_ids[2]; \/* Initially all zeroes. *\/\r\n+#define BM_VENDOR_DEFAULT      0x05f9\r\n+#define BM_PRODUCT_DEFAULT     0xffff\r\n+#define BM_VENDOR_L02C         0x1004\r\n+#define BM_PRODUCT_L02C        0x618f\r\n+\r\n+static struct usb_device_id generic_device_ids[] = {\r\n+       { USB_DEVICE(BM_VENDOR_DEFAULT, BM_PRODUCT_DEFAULT) }, \/\/ for arguments.\r\n+       { USB_DEVICE(BM_VENDOR_DEFAULT, BM_PRODUCT_DEFAULT) },\r\n+       { USB_DEVICE(BM_VENDOR_L02C, BM_PRODUCT_L02C) },\r\n+       {} \/* Terminating entry *\/\r\n+};\r\n\r\n \/* we want to look at all devices, as the vendor\/product id can change\r\n  * depending on the command line argument *\/\r\n<\/pre>\n<p>\u3053\u3053\u3067\u3001generic_device_ids\u306e0\u756a\u76ee\u30681\u756a\u76ee\u306e\u8981\u7d20\u304c\u91cd\u8907\u3057\u3066\u3044\u308b\u306e\u306f\u3001\u5f15\u6570\u6307\u5b9a\u3055\u308c\u305f\u6642\u306e\u305f\u3081\u3067\u3059\u3002\u5fc5\u8981\u306a\u3051\u308c\u3070\u3001\u524a\u3063\u3066\u3057\u307e\u3063\u3066\u3082\u554f\u984c\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u5225\u306e\u30c7\u30d0\u30a4\u30b9\u306evendorID\u3001productID\u3092\u6307\u5b9a\u3057\u3066\u30ed\u30fc\u30c9\u3067\u304d\u308b\u3053\u3068\u306f\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059(<strong>\u305d\u306e\u5834\u5408\u3067\u3082\u3001L-02C\u306f\u81ea\u52d5\u3067\u8a8d\u8b58\u3055\u308c\u307e\u3059<\/strong>)\u3002<\/p>\n<p>\u5909\u66f4\u3057\u305f\u30bd\u30fc\u30b9\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u3066\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u3001\u5bfe\u8c61\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5165\u308c\u66ff\u3048\u308c\u3070\u3001vendorID\u3001productID\u3092\u6307\u5b9a\u305b\u305a\u3068\u3082\u3001eject\u3059\u308b\u3060\u3051\u3067L-02C\u304c\u81ea\u52d5\u3067\u8a8d\u8b58\u3055\u308c\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u3067Docomo\u306e\u901a\u4fe1\u30c7\u30d0\u30a4\u30b9L-02C\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u73fe\u72b6\u3001usbserial\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5f15\u6570\u4ed8\u304d(vendor=0x1004 product=0x618f)\u3067\u30ed\u30fc\u30c9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 \u3057\u304b\u3057\u3001\u8af8\u4e8b\u60c5\u306b\u3088 [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-2446","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/blog.bitmeister.jp\/index.php?rest_route=\/wp\/v2\/posts\/2446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bitmeister.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bitmeister.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bitmeister.jp\/index.php?rest_route=\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bitmeister.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2446"}],"version-history":[{"count":18,"href":"https:\/\/blog.bitmeister.jp\/index.php?rest_route=\/wp\/v2\/posts\/2446\/revisions"}],"predecessor-version":[{"id":2465,"href":"https:\/\/blog.bitmeister.jp\/index.php?rest_route=\/wp\/v2\/posts\/2446\/revisions\/2465"}],"wp:attachment":[{"href":"https:\/\/blog.bitmeister.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bitmeister.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bitmeister.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}