{"id":2800,"date":"2022-05-24T22:18:40","date_gmt":"2022-05-24T14:18:40","guid":{"rendered":"https:\/\/lixinsheng.cn\/?p=2800"},"modified":"2022-05-25T08:34:32","modified_gmt":"2022-05-25T00:34:32","slug":"airprint-%e6%89%8b%e6%9c%ba%e4%b9%9f%e8%83%bd%e9%a9%b1%e5%8a%a8usb%e6%89%93%e5%8d%b0%e6%9c%ba","status":"publish","type":"post","link":"https:\/\/lixinsheng.cn\/index.php\/2022\/05\/24\/airprint-%e6%89%8b%e6%9c%ba%e4%b9%9f%e8%83%bd%e9%a9%b1%e5%8a%a8usb%e6%89%93%e5%8d%b0%e6%9c%ba\/","title":{"rendered":"AirPrint &#8211; \u624b\u673a\u4e5f\u80fd\u9a71\u52a8USB\u6253\u5370\u673a"},"content":{"rendered":"<p>USB\u6253\u5370\u673a\u53d8\u8eab\u65e0\u7ebf\u6253\u5370\u673a\u53ef\u4ee5\u901a\u8fc7openwrt\u7684\u6253\u5370\u673a\u6a21\u5757\u5b9e\u73b0\u3002\u8fd9\u79cd\u5b9e\u73b0\u5728PC\u4e0a\u6ca1\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u4f46\u662f\u624b\u673a\u5c31\u4e0d\u597d\u4f7f\u4e86\uff0c\u56e0\u4e3a\u624b\u673a\u4e0d\u50cfPC\u673a\u53ef\u4ee5\u5b89\u88c5\u6253\u5370\u673a\u9a71\u52a8\u7a0b\u5e8f\u3002AirPrint\u662f\u4e2a\u534f\u8bae\uff0c\u5b9e\u73b0\u7684\u5c31\u662f\u5728\u6ca1\u6709\u9a71\u52a8\u7684\u73af\u5883\u4e0b\u6253\u5370\u3002\u652f\u6301AirPrint\u7684\u6253\u5370\u673a\u65e0\u975e\u5c31\u662f\u628a\u9a71\u52a8\u548cAirPrint\u96c6\u6210\u5230\u4e86\u6253\u5370\u673a\u91cc\u9762\uff0c\u7136\u540e\u5356\u4e2a\u597d\u4ef7\u94b1\u3002\u81f3\u4e8e\u4ec0\u4e48\u624d\u662fAirPrint\uff0c\u4e0d\u662f\u672c\u6587\u7684\u91cd\u70b9\uff0c\u81ea\u5df1baidu\u3002<\/p>\n<p><strong>USB\u65e0\u7ebf\u6253\u5370\u8fc7\u7a0b<\/strong>\uff1a<br \/>\nPC\u00a0 &#8211;&gt; printer driver &#8211;&gt; network &#8211;&gt; openwrt printer device &#8211;&gt; USB printer<br \/>\n<strong>AirPrint\u7684\u6253\u5370\u8fc7\u7a0b\uff1a<\/strong><br \/>\nPhone\/PC &#8211;&gt; network &#8211;&gt; openwrt CUPS\u00a0 &#8211;&gt; openwrt printer device &#8211;&gt; USB printer<\/p>\n<p>\u5728\u8def\u7531\u5668\u7684openwrt\u4e0a\uff0c\u9700\u8981\u5b89\u88c5CUPS\u548cAvahi\u3002<br \/>\nCUPS &#8211; Unix\u7684\u901a\u7528\u6253\u5370\u670d\u52a1<br \/>\nAvahi &#8211; AirPrint\u76f8\u5173\u7684\u5f00\u6e90\u5b9e\u73b0<\/p>\n<p>CUPS\u5728openwrt\u7684\u5b98\u65b9\u7248\u672c\u5df2\u7ecf\u53bb\u6389\u4e86\u3002 \u5b98\u65b9\u7684\u8bf4\u6cd5\u662f\uff0cCUPS\u5360\u7528\u592a\u591a\u7684\u8d44\u6e90\u8fdb\u884c\u6253\u5370\u7684pooling\uff0c\u4e0eopenwrt\u4e3b\u8981\u7528\u5728\u8d44\u6e90\u6709\u9650\u7684\u8def\u7531\u5668\u4e0a\u662f\u51b2\u7a81\u7684\u3002\u6211\u7528\u7684\u8f6f\u8def\u7531\u672c\u8eab\u5c31\u662f\u4e00\u4e2aPC\u673a\uff0c\u4e0d\u5b58\u5728\u8d44\u6e90\u4e0d\u8db3\u7684\u95ee\u9898\uff0c\u800c\u4e14github\u4e0a\u8fd8\u662f\u80fd\u627e\u5230\u53ef\u4ee5\u7f16\u8bd1\u7684CUPS\u7684\u6e90\u7801\u914d\u7f6e\u3002\u6211\u5f00\u59cb\u5c1d\u8bd5\u7528openwrt\u7684SDK\u53bb\u7f16\u8bd1CUPS\u7684ipk\uff0c\u6539\u4e86\u4e00\u4e2a\u5c0f\u7684\u7f16\u8bd1\u9519\u8bef\u540e\uff0cipk\u53ef\u4ee5\u6b63\u5e38\u5b89\u88c5\u5230openwrt\u4e0a\uff0c\u800c\u4e14\u8fd0\u884c\u6b63\u5e38\u3002Avahi\u7684\u672c\u8eab\u5c31\u6709\uff0c\u76f4\u63a5\u5b89\u88c5\u3002\u6700\u5927\u7684\u95ee\u9898\u6765\u4e86\uff0c \u6211\u7684\u6253\u5370\u673a\u6ca1\u6709openwrt\u7684\u9a71\u52a8\uff0c\u591a\u6b21\u5c1d\u8bd5\u540e\u53d1\u73b0\uff0c\u9002\u914d\u6253\u5370\u673a\u7684\u9a71\u52a8\u95e8\u69db\u6bd4\u8f83\u9ad8\uff0c\u641e\u4e0d\u5b9a\u3002<\/p>\n<p>https:\/\/github.com\/fengchen-github\/openwrt-cups.git<\/p>\n<p>\u7b2c\u4e8c\u4e2a\u65b9\u6cd5\u662f\u5229\u7528docker\uff0c\u6709\u9ad8\u4eba\u5df2\u7ecf\u628a\u8fd9\u4e24\u4e2a\u670d\u52a1\u548c\u7edd\u5927\u90e8\u5206\u7684\u6253\u5370\u673a\u9a71\u52a8\u96c6\u6210\u5230\u4e00\u4e2aubuntu\u7684docker\u91cc\u9762\u3002\u53ea\u8981\u628adocker\u5f00\u542f\uff0c\u5c31\u53ef\u4ee5\u76f4\u63a5\u7528\u4e86\uff0c\u57fa\u672c\u65e0\u96be\u5ea6\u3002\u6211\u5c31\u662f\u7528\u8fd9\u4e2a\u65b9\u6cd5\u641e\u5b9a\u4e86AirPrint\u3002<\/p>\n<p>https:\/\/hub.docker.com\/r\/tigerj\/cups-airprint<\/p>\n<p><strong>\u53ef\u80fd\u9047\u5230\u7684\u5751\uff1a<\/strong><br \/>\n1.\u00a0 \u9a71\u52a8\u4e0d\u5728docker image\u4e2d\u3002 \u53bb\u6253\u5370\u673a\u5b98\u7f51\u4e0b\u8f7ddeb\u683c\u5f0f\u7684\u9a71\u52a8\u7a0b\u5e8f\uff0c\u624b\u52a8\u5b89\u88c5\u5230docker \u7684container\u4e2d\u3002<br \/>\n2.\u00a0 USB\u6253\u5370\u673a\u4e0b\u7535\u540e\uff0cdocker\u53ef\u80fd\u4f1a\u51fa\u9519\uff0c\u8bbe\u5907\u4e22\u5931\u3002 \u6211\u7684\u89e3\u51b3\u65b9\u6cd5\u662fusb <strong>\u63d2\u5165\/\u62d4\u51fa<\/strong>\u65f6\u5206\u522b<strong>\u542f\u52a8\/\u505c\u6b62<\/strong> docker\u7684container\uff0c\u4ee3\u7801\u5982\u4e0b\u3002\uff08<strong>\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u4fee\u6539\uff01<\/strong>\uff09<\/p>\n<pre>\/etc\/hotplug.d\/usb\/10-usb_printer\r\n\r\n#!\/bin\/sh\r\n# Copyright (C) 2005-2014 NowRush Studio\r\n# Author: hackpascal &lt;<a href=\"mailto:hackpascal@gmail.com\" target=\"_blank\" rel=\"nofollow noopener\">hackpascal@gmail.com<\/a>&gt;\r\n\r\nif [ x\"$INTERFACE\" = x\"7\/1\/1\" ] || [ x\"$INTERFACE\" = x\"7\/1\/2\" ]; then\r\n\/usr\/bin\/usb_printer_hotplug \"$PRODUCT\" \"$ACTION\"\r\nfi\r\n\r\n#Add by lxs for restart cups\r\nif [ -n \"$DEVNAME\" ] &amp;&amp; [ x\"$PRODUCT\" = x\"4a9\/2795\/0\" ] ; then\r\n  if [ x\"$ACTION\" = x\"bind\" ]; then\r\n    echo \"start docker cups...\" &gt; \/dev\/kmsg\r\n    docker start cups\r\n  fi\r\n  if [ x\"$ACTION\" = x\"unbind\" ]; then\r\n    echo \"stop docker cups...\" &gt; \/dev\/kmsg\r\n    docker stop cups\r\n  fi\r\nfi<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>USB\u6253\u5370\u673a\u53d8\u8eab\u65e0\u7ebf\u6253\u5370\u673a\u53ef\u4ee5\u901a\u8fc7openwrt\u7684\u6253\u5370\u673a\u6a21\u5757\u5b9e\u73b0\u3002\u8fd9\u79cd\u5b9e\u73b0\u5728PC\u4e0a\u6ca1\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u4f46\u662f\u624b\u673a\u5c31\u4e0d\u597d\u4f7f\u4e86\uff0c\u56e0\u4e3a\u624b\u673a\u4e0d\u50cfPC\u673a\u53ef\u4ee5\u5b89\u88c5\u6253\u5370\u673a\u9a71\u52a8\u7a0b\u5e8f\u3002AirPrint\u662f\u4e2a\u534f\u8bae\uff0c\u5b9e\u73b0\u7684\u5c31\u662f\u5728\u6ca1\u6709\u9a71\u52a8\u7684\u73af\u5883\u4e0b\u6253\u5370\u3002\u652f\u6301AirPrint\u7684\u6253\u5370\u673a\u65e0\u975e\u5c31\u662f\u628a\u9a71\u52a8\u548cAirPrint\u96c6\u6210\u5230\u4e86\u6253\u5370\u673a\u91cc\u9762\uff0c\u7136\u540e\u5356\u4e2a\u597d\u4ef7\u94b1\u3002\u81f3\u4e8e\u4ec0\u4e48\u624d\u662fAirPrint\uff0c\u4e0d\u662f\u672c\u6587\u7684\u91cd\u70b9\uff0c\u81ea\u5df1baidu\u3002 USB\u65e0\u7ebf\u6253\u5370\u8fc7\u7a0b\uff1a PC\u00a0 &#8211;&gt; printer driver &#8211;&gt; network &#8211;&gt; openwrt printer device &#8211;&gt; USB printer AirPrint\u7684\u6253\u5370\u8fc7\u7a0b\uff1a Phone\/PC &#8211;&gt; network &#8211;&gt; openwrt CUPS\u00a0 &#8211;&gt; openwrt printer device &#8211;&gt; USB printer \u5728\u8def\u7531\u5668\u7684openwrt\u4e0a\uff0c\u9700\u8981\u5b89\u88c5CUPS\u548cAvahi\u3002 CUPS &#8211; Unix\u7684\u901a\u7528\u6253\u5370\u670d\u52a1 Avahi &#8211; AirPrint\u76f8\u5173\u7684\u5f00\u6e90\u5b9e\u73b0 CUPS\u5728openwrt\u7684\u5b98\u65b9\u7248\u672c\u5df2\u7ecf\u53bb\u6389\u4e86\u3002 \u5b98\u65b9\u7684\u8bf4\u6cd5\u662f\uff0cCUPS\u5360\u7528\u592a\u591a\u7684\u8d44\u6e90\u8fdb\u884c\u6253\u5370\u7684pooling\uff0c\u4e0eopenwrt\u4e3b\u8981\u7528\u5728\u8d44\u6e90\u6709\u9650\u7684\u8def\u7531\u5668\u4e0a\u662f\u51b2\u7a81\u7684\u3002\u6211\u7528\u7684\u8f6f\u8def\u7531\u672c\u8eab\u5c31\u662f\u4e00\u4e2aPC\u673a\uff0c\u4e0d\u5b58\u5728\u8d44\u6e90\u4e0d\u8db3\u7684\u95ee\u9898\uff0c\u800c\u4e14github\u4e0a\u8fd8\u662f\u80fd\u627e\u5230\u53ef\u4ee5\u7f16\u8bd1\u7684CUPS\u7684\u6e90\u7801\u914d\u7f6e\u3002\u6211\u5f00\u59cb\u5c1d\u8bd5\u7528openwrt\u7684SDK\u53bb\u7f16\u8bd1CUPS\u7684ipk\uff0c\u6539\u4e86\u4e00\u4e2a\u5c0f\u7684\u7f16\u8bd1\u9519\u8bef\u540e\uff0cipk\u53ef\u4ee5\u6b63\u5e38\u5b89\u88c5\u5230openwrt\u4e0a\uff0c\u800c\u4e14\u8fd0\u884c\u6b63\u5e38\u3002Avahi\u7684\u672c\u8eab\u5c31\u6709\uff0c\u76f4\u63a5\u5b89\u88c5\u3002\u6700\u5927\u7684\u95ee\u9898\u6765\u4e86\uff0c \u6211\u7684\u6253\u5370\u673a\u6ca1\u6709openwrt\u7684\u9a71\u52a8\uff0c\u591a\u6b21\u5c1d\u8bd5\u540e\u53d1\u73b0\uff0c\u9002\u914d\u6253\u5370\u673a\u7684\u9a71\u52a8\u95e8\u69db\u6bd4\u8f83\u9ad8\uff0c\u641e\u4e0d\u5b9a\u3002 https:\/\/github.com\/fengchen-github\/openwrt-cups.git \u7b2c\u4e8c\u4e2a\u65b9\u6cd5\u662f\u5229\u7528docker\uff0c\u6709\u9ad8\u4eba\u5df2\u7ecf\u628a\u8fd9\u4e24\u4e2a\u670d\u52a1\u548c\u7edd\u5927\u90e8\u5206\u7684\u6253\u5370\u673a\u9a71\u52a8\u96c6\u6210\u5230\u4e00\u4e2aubuntu\u7684docker\u91cc\u9762\u3002\u53ea\u8981\u628adocker\u5f00\u542f\uff0c\u5c31\u53ef\u4ee5\u76f4\u63a5\u7528\u4e86\uff0c\u57fa\u672c\u65e0\u96be\u5ea6\u3002\u6211\u5c31\u662f\u7528\u8fd9\u4e2a\u65b9\u6cd5\u641e\u5b9a\u4e86AirPrint\u3002 https:\/\/hub.docker.com\/r\/tigerj\/cups-airprint \u53ef\u80fd\u9047\u5230\u7684\u5751\uff1a 1.\u00a0 \u9a71\u52a8\u4e0d\u5728docker image\u4e2d\u3002 \u53bb\u6253\u5370\u673a\u5b98\u7f51\u4e0b\u8f7ddeb\u683c\u5f0f\u7684\u9a71\u52a8\u7a0b\u5e8f\uff0c\u624b\u52a8\u5b89\u88c5\u5230docker \u7684container\u4e2d\u3002 2.\u00a0 USB\u6253\u5370\u673a\u4e0b\u7535\u540e\uff0cdocker\u53ef\u80fd\u4f1a\u51fa\u9519\uff0c\u8bbe\u5907\u4e22\u5931\u3002 \u6211\u7684\u89e3\u51b3\u65b9\u6cd5\u662fusb \u63d2\u5165\/\u62d4\u51fa\u65f6\u5206\u522b\u542f\u52a8\/\u505c\u6b62 docker\u7684container\uff0c\u4ee3\u7801\u5982\u4e0b\u3002\uff08\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u4fee\u6539\uff01\uff09 \/etc\/hotplug.d\/usb\/10-usb_printer #!\/bin\/sh &hellip; <a href=\"https:\/\/lixinsheng.cn\/index.php\/2022\/05\/24\/airprint-%e6%89%8b%e6%9c%ba%e4%b9%9f%e8%83%bd%e9%a9%b1%e5%8a%a8usb%e6%89%93%e5%8d%b0%e6%9c%ba\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;AirPrint &#8211; \u624b\u673a\u4e5f\u80fd\u9a71\u52a8USB\u6253\u5370\u673a&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,14],"tags":[],"class_list":["post-2800","post","type-post","status-publish","format-standard","hentry","category-experience","category-knowledge"],"_links":{"self":[{"href":"https:\/\/lixinsheng.cn\/index.php\/wp-json\/wp\/v2\/posts\/2800","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lixinsheng.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lixinsheng.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lixinsheng.cn\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lixinsheng.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2800"}],"version-history":[{"count":4,"href":"https:\/\/lixinsheng.cn\/index.php\/wp-json\/wp\/v2\/posts\/2800\/revisions"}],"predecessor-version":[{"id":2804,"href":"https:\/\/lixinsheng.cn\/index.php\/wp-json\/wp\/v2\/posts\/2800\/revisions\/2804"}],"wp:attachment":[{"href":"https:\/\/lixinsheng.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lixinsheng.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lixinsheng.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}