{"id":8831,"date":"2016-07-02T05:58:14","date_gmt":"2016-07-01T20:58:14","guid":{"rendered":"https:\/\/www.appliot.co.jp\/lazurite-jp\/?p=8831"},"modified":"2016-07-02T05:58:14","modified_gmt":"2016-07-01T20:58:14","slug":"%ef%bc%91%e5%8f%b7%e3%81%ae%e8%b6%b3%e8%b7%a13-lazurite%e3%81%ae%e8%87%aa%e5%8b%95%e3%83%86%e3%82%b9%e3%82%bf%e3%82%92%e3%83%a9%e3%82%ba%e3%83%91%e3%82%a4%e3%81%a7%e4%bd%9c%e3%82%8b%e3%81%9d","status":"publish","type":"post","link":"https:\/\/www.appliot.co.jp\/lazurite-jp\/%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e4%be%8b\/8831.html","title":{"rendered":"\uff11\u53f7\u306e\u8db3\u8de1(3) Lazurite\u306e\u81ea\u52d5\u30c6\u30b9\u30bf\u3092\u30e9\u30ba\u30d1\u30a4\u3067\u4f5c\u308b(\u305d\u306e2)"},"content":{"rendered":"<p>\u524d\u56de\u3001D2XX\u30e2\u30fc\u30c9\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306bLinux\u30ab\u30fc\u30cd\u30eb\u30c9\u30e9\u30a4\u30d0\u3092\u7121\u52b9\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>[bash]<\/p>\n<p>sudo rmmod ftdi_sio<br \/>\nsudo rmmod usbserial<\/p>\n<p>[\/bash]<\/p>\n<h2>\uff11\uff0e\u7121\u52b9\u306b\u3057\u305f\u30c9\u30e9\u30a4\u30d0\u306e\u4fdd\u5b58\u5834\u6240\u3092\u63a2\u3059<\/h2>\n<p>\u7121\u52b9\u306b\u3059\u308b\u3068\u304d\u306brmmod\u3092\u4f7f\u7528\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u306fftdi_sio\u3068usbserial\u306e\u30ab\u30fc\u30cd\u30eb\u30c9\u30e9\u30a4\u30d0\u3068\u547c\u3070\u308c\u308b\u3082\u306e\u3092\u7121\u52b9\u306b\u3057\u305f\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002D2XX\u3092\u4f7f\u7528\u3059\u308b\u3060\u3051\u3067\u3042\u308c\u3070\u3053\u306e\u72b6\u614b\u3067\u3082\u826f\u3044\u306e\u3067\u3059\u304c\u3001Lazurite\u306e\u30c6\u30b9\u30c8\u3092\u3059\u308b\u305f\u3081\u306b\u306fD2XX\u3092\u4f7f\u7528\u3057\u305f\u5f8c\u306b\u30b7\u30ea\u30a2\u30eb\u3092\u518d\u3073\u4f7f\u7528\u3057\u306a\u304f\u3066\u306f\u884c\u3051\u306a\u3044\u305f\u3081\u3001\u7121\u52b9\u306b\u3057\u305f\u30c9\u30e9\u30a4\u30d0\u3092\u518d\u3073\u6709\u52b9\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u30ab\u30fc\u30cd\u30eb\u30c9\u30e9\u30a4\u30d0\u3092\u6709\u52b9\u306b\u3059\u308b\u305f\u3081\u306b\u306finsmod\u3092\u4f7f\u7528\u3059\u308c\u3070\u826f\u3044\u306e\u3067\u3001\u307e\u305a\u306f\u7121\u52b9\u306b\u3057\u305f\u30c9\u30e9\u30a4\u30d0\u3092\u63a2\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u30ab\u30fc\u30cd\u30eb\u30c9\u30e9\u30a4\u30d0\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u300c\u30c9\u30e9\u30a4\u30d0\u540d.ko\u300d\u306a\u306e\u3067\u3001\u300cftdi_sio.ko\u300d\u3068\u300cusbserial.ko\u300d\u306e\u5834\u6240\u3092\u63a2\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\npi@raspberrypi ~\/develop\/miniTester\/ftdi_test\/src $ sudo find \/ | grep ftdi_sio.ko<br \/>\n\/lib\/modules\/4.1.19+\/kernel\/drivers\/usb\/serial\/ftdi_sio.ko<br \/>\n\/lib\/modules\/4.1.19-v7+\/kernel\/drivers\/usb\/serial\/ftdi_sio.ko<br \/>\n\/lib\/modules\/4.4.8-v7+\/kernel\/drivers\/usb\/serial\/ftdi_sio.ko<\/p>\n<p>pi@raspberrypi ~\/develop\/miniTester\/ftdi_test\/src $ sudo find \/ | grep usbserial.ko<br \/>\n\/lib\/modules\/4.1.19+\/kernel\/drivers\/usb\/serial\/usbserial.ko<br \/>\n\/lib\/modules\/4.1.19-v7+\/kernel\/drivers\/usb\/serial\/usbserial.ko<br \/>\n\/lib\/modules\/4.4.8-v7+\/kernel\/drivers\/usb\/serial\/usbserial.ko<\/p>\n<p>[\/bash]<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\uff13\u3064\u767a\u898b\uff01\uff01\u4e00\u756a\u4e0b\u306e\u3053\u308c\u3089\u304c\u5b9f\u969b\u306b\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u30c9\u30e9\u30a4\u30d0\u3067\u3059\u3002<br \/>\n\/lib\/modules\/4.4.8-v7+\/kernel\/drivers\/usb\/serial\/ftdi_sio.ko<br \/>\n\/lib\/modules\/4.4.8-v7+\/kernel\/drivers\/usb\/serial\/usbserial.ko<\/p>\n<h2>2.USB\u30b7\u30ea\u30a2\u30eb\u3092\u4f7f\u7528\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u672c\u4f53\u306f\u500b\u4eba\u7684\u306b\u597d\u304d\u306aruby\u3092\u4f7f\u7528\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u305d\u3053\u3067\u3001Raspberry Pi\u306eRuby\u4e0a\u3067\u30b7\u30ea\u30a2\u30eb\u7528\u306e\u30ab\u30fc\u30cd\u30eb\u30c9\u30e9\u30a4\u30d0\u3092\u6709\u52b9\u306b\u3057\u3066\u30b7\u30ea\u30a2\u30eb\u3092\u4f7f\u7528\u3059\u308b\u5b9f\u9a13\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u7c21\u5358\u306b\u52d5\u4f5c\u78ba\u8a8d\u3092\u3059\u308b\u305f\u3081\u3001Lazurite\u306b\u306f\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u306ehelloworld.c\u3092\u66f8\u304d\u8fbc\u3093\u3067\u7f6e\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3055\u3066\u3001Ruby\u304b\u3089\u30b7\u30ea\u30a2\u30eb\u30dd\u30fc\u30c8\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u306fserialport\u3068\u3044\u3046\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3059\u308c\u3070\u826f\u3055\u305d\u3046\u306a\u306e\u3067\u3059\u304c\u3001\u300cgem install usbserial\u300d\u306e\u30b3\u30de\u30f3\u30c9\u3092\u6253\u3064\u3060\u3051\u3067\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u4e0a\u624b\u304f\u884c\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002&#8221;ruby-dev&#8221;\u3068\u3044\u3046\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4e8b\u524d\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u2193\u2193\u2193\u2193\u2193\u2193\u5931\u6557\u3057\u305f\u4f8b\u2193\u2193\u2193\u2193\u2193\u2193<\/p>\n<p>[bash]<br \/>\npi@raspberrypi ~\/develop\/miniTester\/ftdi_test\/src $ sudo gem install serialport<br \/>\nFetching: serialport-1.3.1.gem (100%)<br \/>\nBuilding native extensions.  This could take a while&#8230;<br \/>\nERROR:  Error installing serialport:<br \/>\n\tERROR: Failed to build gem native extension.<\/p>\n<p>    \/usr\/bin\/ruby2.1 extconf.rb<br \/>\nmkmf.rb can&#8217;t find header files for ruby at \/usr\/lib\/ruby\/include\/ruby.h<\/p>\n<p>extconf failed, exit code 1<\/p>\n<p>Gem files will remain installed in \/var\/lib\/gems\/2.1.0\/gems\/serialport-1.3.1 for inspection.<br \/>\nResults logged to \/var\/lib\/gems\/2.1.0\/extensions\/arm-linux\/2.1.0\/serialport-1.3.1\/gem_make.out<br \/>\n[\/bash]<\/p>\n<p>\/usr\/lib\/ruby\/include\/ruby.h\u304c\u7121\u3044\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\nruby.h\u306fruby\u306e\u958b\u767a\u7528\u30b3\u30fc\u30c9\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001ruby-dev\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304b\u3089serialport\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308c\u3070\u3046\u307e\u304f\u3044\u304f\u306f\u305a\u3002<\/p>\n<p>\u2193\u2193\u2193\u2193\u2193\u2193\u6210\u529f\u3057\u305f\u4f8b\u2193\u2193\u2193\u2193\u2193\u2193<\/p>\n<p>[bash]<br \/>\npi@raspberrypi ~\/develop\/miniTester\/ftdi_test\/src $ sudo apt-get install ruby-dev<br \/>\n&#8230; \u7701\u7565 &#8230;<br \/>\npi@raspberrypi ~\/develop\/miniTester\/ftdi_test\/src $ sudo gem install serialport<br \/>\n Building native extensions. This could take a while&#8230;<br \/>\n Successfully installed serialport-1.3.1 Parsing documentation for serialport-1.3.1 Installing ri documentation for serialport-1.3.1 Done installing documentation for serialport after 2 seconds 1 gem installed<br \/>\n[\/bash]<\/p>\n<h2>3.\u307e\u3068\u3081\u3066\u52d5\u4f5c\u78ba\u8a8d<\/h2>\n<p>ruby\u3067\u3053\u3093\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>[ruby]<br \/>\n#! \/usr\/bin\/ruby<\/p>\n<p>require &#8216;serialport&#8217;<\/p>\n<p>#<br \/>\n# Halt process when CTRL+C is pushed.<br \/>\nfinish_flag=0<br \/>\nSignal.trap(:INT){<br \/>\n        finish_flag=1<br \/>\n}<br \/>\ncmd = &quot;sudo insmod \/lib\/modules\/4.4.8-v7+\/kernel\/drivers\/usb\/serial\/usbserial.ko&quot;<br \/>\nresult = system(cmd)<br \/>\np cmd<br \/>\np result<\/p>\n<p>cmd = &quot;sudo insmod \/lib\/modules\/4.4.8-v7+\/kernel\/drivers\/usb\/serial\/ftdi_sio.ko&quot;<br \/>\nresult = system(cmd)<br \/>\np cmd<br \/>\np result<\/p>\n<p># USB\u30dd\u30fc\u30c8\u3068\u901a\u4fe1\u901f\u5ea6\u306e\u8a2d\u5b9a<br \/>\n@port = &quot;\/dev\/ttyUSB0&quot;<br \/>\n@baud = 115200<br \/>\nsp = SerialPort.new(@port, @baud)<\/p>\n<p>@thread_end = false<\/p>\n<p>Thread.new{<br \/>\n        while finish_flag==0 do<br \/>\n                line = sp.readline<br \/>\n                puts line<br \/>\n        end<br \/>\n        @thread_end = true<br \/>\n}<\/p>\n<p>while @thread_end == false do<br \/>\n        line = gets<br \/>\n        sp.write line<br \/>\nend<br \/>\nsp.close<br \/>\n[\/ruby]<\/p>\n<p>\u3055\u3066\u3001\u3053\u3053\u304b\u3089\u4e00\u56de\u624b\u52d5\u3067\u30c9\u30e9\u30a4\u30d0\u3092\u5916\u3057\u3001insmod\u3057\u3066\u304b\u3089\u30b7\u30ea\u30a2\u30eb\u901a\u4fe1\u304c\u5fa9\u6d3b\u3067\u304d\u308b\u304b\u78ba\u8a8d\u3092\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\nlsmod\u3067\u306f\u3001\u30c9\u30e9\u30a4\u30d0\u304c\u5916\u308c\u3066\u3044\u308b\u306e\u3092\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\npi@raspberrypi ~\/develop\/miniTester\/ftdi_test\/src $ sudo rmmod ftdi_sio<br \/>\npi@raspberrypi ~\/develop\/miniTester\/ftdi_test\/src $ sudo rmmod usbserial<br \/>\npi@raspberrypi ~\/develop\/miniTester\/ftdi_test\/src $ lsmod<br \/>\nModule                  Size  Used by<br \/>\nbrcmfmac              186478  0<br \/>\nbrcmutil                5661  1 brcmfmac<br \/>\njoydev                  9024  0<br \/>\nevdev                  11396  8<br \/>\ncfg80211              427817  1 brcmfmac<br \/>\nrfkill                 16018  2 cfg80211<br \/>\nsnd_bcm2835            25029  3<br \/>\nsnd_pcm                75826  1 snd_bcm2835<br \/>\nsnd_timer              19160  1 snd_pcm<br \/>\nsnd                    51844  9 snd_bcm2835,snd_timer,snd_pcm<br \/>\ni2c_bcm2708             4770  0<br \/>\nspi_bcm2835             7286  0<br \/>\nbcm2835_gpiomem         3040  0<br \/>\nbcm2835_wdt             3225  0<br \/>\nuio_pdrv_genirq         3164  0<br \/>\nuio                     8000  1 uio_pdrv_genirq<br \/>\ni2c_dev                 5859  0<br \/>\nfuse                   83461  3<br \/>\nipv6                  347473  30<br \/>\npi@raspberrypi ~\/develop\/miniTester\/ftdi_test\/src $ .\/test.rb<br \/>\n&quot;sudo insmod \/lib\/modules\/4.4.8-v7+\/kernel\/drivers\/usb\/serial\/usbserial.ko&quot;<br \/>\ntrue<br \/>\n&quot;sudo insmod \/lib\/modules\/4.4.8-v7+\/kernel\/drivers\/usb\/serial\/ftdi_sio.ko&quot;<br \/>\ntrue<\/p>\n<p>hello world<br \/>\nhello world<br \/>\nhello world<br \/>\nhello world<br \/>\n^Chello world      &lt;&#8212;- Ctrl+C\u3092\u62bc\u3057\u3066\u7d42\u4e86<br \/>\n[\/bash]<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u7121\u4e8b\u306b\u52d5\u4f5c\u3057\u3066\u304f\u308c\u307e\u3057\u305f\u3002\u4eca\u65e5\u306f\u3053\u3053\u307e\u3067\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u3001D2XX\u30e2\u30fc\u30c9\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306bLinux\u30ab\u30fc\u30cd\u30eb\u30c9\u30e9\u30a4\u30d0\u3092\u7121\u52b9\u306b\u3057\u307e\u3057\u305f\u3002 [bash] sudo rmmod ftdi_sio sudo rmmod usbserial [\/bash] \uff11\uff0e\u7121\u52b9\u306b\u3057\u305f\u30c9\u30e9\u30a4\u30d0\u306e\u4fdd\u5b58\u5834\u6240\u3092\u63a2\u3059 \u7121\u52b9\u306b\u3059\u308b\u3068\u304d\u306brmmod\u3092\u4f7f\u7528\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u306fftdi_sio\u3068usbserial\u306e\u30ab\u30fc\u30cd\u30eb\u30c9\u30e9\u30a4\u30d0\u3068\u547c\u3070\u308c\u308b\u3082\u306e\u3092\u7121\u52b9\u306b\u3057\u305f\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002D2XX\u3092\u4f7f\u7528\u3059\u308b\u3060\u3051\u3067\u3042\u308c\u3070\u3053\u306e\u72b6\u614b\u3067\u3082\u826f\u3044\u306e\u3067\u3059\u304c\u3001Lazurite\u306e\u30c6\u30b9\u30c8\u3092\u3059\u308b\u305f\u3081\u306b\u306fD2XX\u3092\u4f7f\u7528\u3057\u305f\u5f8c\u306b\u30b7\u30ea\u30a2\u30eb\u3092\u518d\u3073\u4f7f\u7528\u3057\u306a\u304f\u3066\u306f\u884c\u3051\u306a\u3044\u305f\u3081\u3001\u7121\u52b9\u306b\u3057\u305f\u30c9\u30e9\u30a4\u30d0\u3092\u518d\u3073\u6709\u52b9\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 \u30ab\u30fc\u30cd\u30eb\u30c9\u30e9\u30a4\u30d0\u3092\u6709\u52b9\u306b\u3059\u308b\u305f\u3081\u306b\u306finsmod\u3092\u4f7f\u7528\u3059\u308c\u3070\u826f\u3044\u306e\u3067\u3001\u307e\u305a\u306f\u7121\u52b9\u306b\u3057\u305f\u30c9\u30e9\u30a4\u30d0\u3092\u63a2\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u30ab\u30fc\u30cd\u30eb\u30c9\u30e9\u30a4\u30d0\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u300c\u30c9\u30e9\u30a4\u30d0\u540d.ko\u300d\u306a\u306e\u3067\u3001\u300cftdi_sio.ko\u300d\u3068\u300cusbserial.ko\u300d\u306e\u5834\u6240\u3092\u63a2\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 [bash] pi@raspberrypi ~\/develop\/miniTester\/ftdi_test\/src $ sudo find \/ | grep ftdi_sio.ko \/lib\/modules\/4.1.19+\/kernel\/drivers\/usb\/serial\/ftdi_sio.ko \/lib\/modules\/4.1.19-v7+\/ [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[16],"tags":[],"class_list":["post-8831","post","type-post","status-publish","format-standard","hentry","category-16"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.appliot.co.jp\/lazurite-jp\/wp-json\/wp\/v2\/posts\/8831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appliot.co.jp\/lazurite-jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appliot.co.jp\/lazurite-jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appliot.co.jp\/lazurite-jp\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appliot.co.jp\/lazurite-jp\/wp-json\/wp\/v2\/comments?post=8831"}],"version-history":[{"count":0,"href":"https:\/\/www.appliot.co.jp\/lazurite-jp\/wp-json\/wp\/v2\/posts\/8831\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appliot.co.jp\/lazurite-jp\/wp-json\/wp\/v2\/media?parent=8831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appliot.co.jp\/lazurite-jp\/wp-json\/wp\/v2\/categories?post=8831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appliot.co.jp\/lazurite-jp\/wp-json\/wp\/v2\/tags?post=8831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}