{"id":198858,"date":"2020-08-27T09:35:39","date_gmt":"2020-08-27T01:35:39","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=198858"},"modified":"2020-08-21T20:37:17","modified_gmt":"2020-08-21T12:37:17","slug":"usb-raspberrypi","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/usb-raspberrypi.html","title":{"rendered":"\u6559\u4f60\u5982\u4f55\u4f7f\u7528\u6811\u8393\u6d3e\u642d\u5efa\u5c40\u57df\u7f51\u76d1\u63a7"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u4eca\u5929\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u6811\u8393\u6d3e\u53ca\u4e00\u4e2a USB \u6444\u50cf\u5934\u642d\u5efa\u4e00\u4e2a\u7b80\u6613\u7684\u76d1\u63a7\uff0c\u6709\u4e86\u5b83\u53ef\u4ee5\u5b9e\u73b0\u5728\u7535\u8111\u4e0a\u67e5\u770b\u6444\u50cf\u5934\u6240\u6355\u83b7\u7684\u52a8\u6001\u56fe\u50cf\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\n

1. \u6444\u50cf\u5934\u68c0\u6d4b<\/strong><\/div>\n<\/p>\n

\u6811\u8393\u6d3e\u652f\u6301\u5f88\u591a\u5e38\u89c1\u7684 USB \u6444\u50cf\u5934\uff0c\u6bd4\u5982\u826f\u8bb8\u6240\u4f7f\u7528\u7684\u8fd9\u6b3e\uff1a<\/p>\n

\"\"<\/p>\n

\u8fd9\u79cd\u7c7b\u578b\u7684\u6444\u50cf\u5934\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 USB \u4f9b\u7535\uff0c\u5e76\u901a\u8fc7 USB \u7ebf\u8fdb\u884c\u6570\u636e\u901a\u8baf\u3002\u5b83\u4e0e\u6811\u8393\u6d3e\u7684\u8fde\u63a5\u4e5f\u5341\u5206\u7b80\u5355\uff0c\u76f4\u63a5\u63d2\u8fdb\u6811\u8393\u6d3e\u7684 USB \u5b54\u5373\u53ef\u3002<\/p>\n

\u63d2\u8fdb\u53bb\u540e\u600e\u4e48\u77e5\u9053\u6709\u6ca1\u6709\u88ab\u6811\u8393\u6d3e\u6240\u8bc6\u522b\u5462\uff1f\u6211\u4eec\u6709\u4e24\u79cd\u65b9\u6cd5\u6765\u786e\u5b9a\uff1a<\/p>\n

\u65b9\u6cd5\u4e00\uff1a\u5728 \/dev\/ \u76ee\u5f55\u4e0b\u67e5\u770b\u662f\u5426\u6709 video0 \u6587\u4ef6<\/strong><\/span><\/div>\n
pi@raspberrypi:~<\/span> $ ls \/dev\/video*\r\n\/dev\/video<\/span>0<\/span>\r\n<\/code><\/pre>\n
\u65b9\u6cd5\u4e8c\uff1a\u67e5\u770b USB \u8bbe\u5907\uff0c\u770b\u662f\u5426\u6709\u65b0\u8bbe\u5907<\/strong><\/span><\/div>\n
pi@raspberrypi:~<\/span> $ lsusb\r\nBus 001<\/span> Device 004<\/span>: ID 045<\/span>8:<\/span>706<\/span>d KYE Systems Corp. (Mouse Systems) Genius iSlim 2000<\/span>AF V2\t#\u8bc6\u522b\u5230\u7684 USB \u6444\u50cf\u5934<\/span>\r\nBus 001<\/span> Device 003<\/span>: ID 0424<\/span>:ec00<\/span> Standard Microsystems Corp. SMSC9512\/9514<\/span> Fast Ethernet Adapter\r\nBus 001<\/span> Device 002<\/span>: ID 0424<\/span>:<\/span>9514<\/span> Standard Microsystems Corp. SMC9514 Hub\r\nBus 001<\/span> Device 001<\/span>: ID 1<\/span>d6b:<\/span>0002<\/span> Linux Foundation 2.0<\/span> root hub\r\n<\/code><\/pre>\n

\n

2. \u5b89\u88c5 motion \u7a0b\u5e8f<\/strong><\/div>\n<\/p>\n

\u8fd9\u91cc\u6211\u4eec\u4ee5\u5b98\u65b9\u7cfb\u7edf Raspbian \u4e3a\u4f8b\u3002\u5b89\u88c5 motion \u53ea\u9700\u8f93\u5165\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n

sudo apt-get install<\/span> motion\r\n<\/code><\/pre>\n

\u5982\u679c\u65e0\u6cd5\u5b89\u88c5\uff0c\u53ef\u80fd\u8981\u5148\u6267\u884c\u4e0b\u9762\u4e24\u6761\u547d\u4ee4\uff1a<\/p>\n

sudo apt-get update<\/span>\r\nsudo apt-get<\/span> upgrade<\/span>\r\n<\/code><\/pre>\n

\n

3. \u914d\u7f6e motion \u7684\u5b88\u62a4\u8fdb\u7a0b<\/strong><\/div>\n<\/p>\n

\u4f7f\u7528 vim \u4fee\u6539 \/etc\/default\/motion\u3002\u5982\u679c\u7cfb\u7edf\u672a\u5b89\u88c5 vim \uff0c\u9700\u63d0\u524d\u5b89\u88c5\uff0c\u6216\u4f7f\u7528 nano \u7f16\u8f91\u5668\u4e5f\u53ef\u4ee5\u3002<\/p>\n

sudo<\/span> vim \/etc\/default<\/span>\/motion\r\n<\/code><\/pre>\n

\u6211\u4eec\u628a\u91cc\u9762\u7684 no \u6539\u6210 yes \uff0c\u8ba9\u5b88\u62a4\u8fdb\u7a0b\u4e00\u76f4\u5728\u540e\u53f0\u8fd0\u884c\uff1a<\/p>\n

#<\/span> set<\/span> to 'yes'<\/span> to enable<\/span> the motion daemon<\/span>\r\nstart_motion_daemon=yes\r\n<\/code><\/pre>\n

\n

4. \u4fee\u6539 motion \u7684\u914d\u7f6e\u6587\u4ef6<\/strong><\/div>\n<\/p>\n

\u9996\u5148\uff0c\u7528 vim \u6216 nano \u6253\u5f00 motion \u7684\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n

sudo<\/span> vim \/etc\/motion\/motion.conf\r\n<\/code><\/pre>\n

\u914d\u7f6e\u6587\u4ef6\u6709\u70b9\u957f\uff0c\u4f46\u6709\u51e0\u4e2a\u5fc5\u6539\u7684\u9009\u9879\uff0c\u5176\u4f59\u7684\u9ed8\u8ba4\u5373\u53ef\u3002<\/p>\n

\u6211\u4eec\u9700\u8981\u5c06 daemon off \u6539\u6210 daemon on\uff0c\u5c06 stream_localhost on \u6539\u6210 stream_localhost off \u3002\u8fd9\u4e24\u4e2a\u4e0d\u5728\u540c\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u9700\u8981\u641c\u7d22\u786e\u5b9a\u3002<\/p>\n

# Start in<\/span> daemon (background) mode and<\/span> release<\/span> terminal (default<\/span>: off)\r\ndaemon on<\/span>\r\n\r\n# Restrict<\/span> stream connections to<\/span> localhost only (default<\/span>: on<\/span>)\r\nstream_localhost off\r\n<\/code><\/pre>\n

\u5f53\u7136\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u66f4\u6539\u5b83\u7684\u753b\u9762\u663e\u793a\u5c3a\u5bf8\uff1a<\/p>\n

# Image width<\/span> (pixels). Valid range<\/span>: Camera dependent, default<\/span>: 352<\/span>\r\nwidth<\/span> 800<\/span>\r\n\r\n# Image height (pixels). Valid range<\/span>: Camera dependent, default<\/span>: 288<\/span>\r\nheight 600<\/span>\r\n<\/code><\/pre>\n

\u66f4\u6539\u5b8c\u6bd5\u4f7f\u7528 :wq \u4fdd\u5b58\u5e76\u9000\u51fa\u3002<\/p>\n

\n

5. \u542f\u52a8\u914d\u7f6e<\/strong><\/div>\n<\/p>\n

\u9996\u5148\uff0c\u542f\u52a8 motion \u670d\u52a1\uff1a<\/p>\n

sudo service motion start<\/span>\r\n<\/code><\/pre>\n

\u7136\u540e\uff0c\u518d\u5f00\u542f motion \uff1a<\/p>\n

pi@raspberrypi:~ $ sudo motion\r\n[0:motion]<\/span> [NTC]<\/span> [ALL]<\/span> conf_load: Processing thread 0<\/span> - config file \/etc\/motion\/motion.conf\r\n[0:motion]<\/span> [NTC]<\/span> [ALL]<\/span> motion_startup: Motion 4<\/span>.0<\/span> Started\r\n[0:motion]<\/span> [NTC]<\/span> [ALL]<\/span> motion_startup: Logging to file (\/var\/log\/motion\/motion.log)\r\n<\/code><\/pre>\n

\n

6. \u67e5\u770b\u6548\u679c<\/strong><\/div>\n<\/p>\n

\u5b8c\u6210\u4ee5\u4e0a\u6b65\u9aa4\u540e\uff0c\u5c31\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u91cc\u67e5\u770b\u6548\u679c\u4e86\u3002\u4f46\u662f\uff0c\u826f\u8bb8\u4f7f\u7528360\u6d4f\u89c8\u5668\u7684\u65f6\u5019\uff0c\u5e76\u4e0d\u80fd\u770b\u5230\u6548\u679c\uff0c\u800c\u4f7f\u7528\u8c37\u6b4c\u6d4f\u89c8\u5668<\/strong>\u7684\u65f6\u5019\uff0c\u4e00\u5207\u6b63\u5e38\u3002\u7f51\u7edc\u4e0a\u8bf4\u706b\u72d0\u6d4f\u89c8\u5668\u4e5f\u53ef\u4ee5\uff0c\u6ca1\u8bd5\u8fc7\u3002<\/p>\n

\u6253\u5f00\u8c37\u6b4c\u6d4f\u89c8\u5668\uff0c\u8f93\u5165\u7f51\u5740\uff1ahttp:\/\/\u6811\u8393\u6d3eIP:8081<\/strong> \uff0c\u5373\u53ef\u67e5\u770b\u5230\u6444\u50cf\u5934\u6240\u62cd\u6444\u5230\u7684\u56fe\u50cf\u3002\u6811\u8393\u6d3e\u7684IP\u5730\u5740\u53ef\u4ee5\u5728\u8def\u7531\u5668\u7684\u540e\u53f0\u7ba1\u7406\u4e2d\u770b\u5230\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528IP\u626b\u63cf\u5668\u641c\u7d22\u5230\uff0c\u8fd9\u91cc\u4e0d\u8d58\u8ff0\u3002<\/p>\n

\"\"<\/p>\n","protected":false},"excerpt":{"rendered":"

\u6811\u8393\u6d3e\u652f\u6301\u5f88\u591a\u5e38\u89c1\u7684 USB \u6444\u50cf\u5934\uff0c\u6bd4\u5982\u826f\u8bb8\u6240\u4f7f\u7528\u7684\u8fd9\u6b3e\uff1a \u8fd9\u79cd\u7c7b\u578b\u7684\u6444\u50cf\u5934\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 USB \u4f9b\u7535\uff0c\u5e76 […]<\/p>\n","protected":false},"author":63,"featured_media":198862,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-198858","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/198858","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=198858"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/198858\/revisions"}],"predecessor-version":[{"id":198863,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/198858\/revisions\/198863"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/198862"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=198858"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=198858"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=198858"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}