紀錄一下, 以免一直忘記...
我的印表機是 HP LaserJet P1006, 要配合 foo2zjs 才可以正常列印, 以下程序也可套用在 foo2zjs 支援的其它印表機
主要就是要記得改 /dev/usb/X.Y.Z 的權限& owner (via /etc/devfs.rules ), 然後不要載入 ulpt
NOTE: 如果你是用 GENERIC kernel, 記得修改 kernel config, comment out "device ulpt",
然後重新 make kernel 並 reboot
1. 依照 CUPS on FreeBSD 的說明安裝好 cups (記得要選 LIBUSB) 並設定 /etc/devfs.rules
[system=10]
add path 'unlpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'lpt*' mode 0660 group cups
add path 'usb/X.Y.Z' mode 0660 group cups
其中 X.Y.Z 可以從 dmesg 中找到, ex:
ulpt0: <Hewlett-Packard HP LaserJet P1006, class 0/0, rev 2.00/1.00, addr 2> on usbus4
表示是 usb/4.2.1, 如果實在找不到我想寫成 usb/* 也沒什麼關係 XD
2. 安裝 foo2zjs
# portmaster /usr/port/print/foo2zjs
3. 下載 firmware
# cd /tmp && getweb p1006 # 若是用別的印表機可以自行更換 # cp *.dl /usr/local/share/foo2xqx/firmware/
4. 新增 /usr/local/etc/devd/hp_p1006.conf
nomatch 16 {
match "bus" "uhub[0-9]";
match "vendor" "0x03f0";
match "product" "0x3e17";
action "cat /usr/local/share/foo2xqx/firmware/sihpP1006.dl > /dev/usb/$port.$devaddr.1";
};
5. 修改 /dev/devd/usb.conf comment out ulpt 相關的設定, 防止 devd 載入 ulpt.ko, 印象中 FreeBSD 9.0 之前不需要這一步
#nomatch 32 {
# match "bus" "uhub[0-9]+";
# match "mode" "host";
# match "intclass" "0x07";
# match "intsubclass" "0x01";
# match "intprotocol" "0x01";
# action "kldload ulpt";
#};
#
#nomatch 32 {
# match "bus" "uhub[0-9]+";
# match "mode" "host";
# match "intclass" "0x07";
# match "intsubclass" "0x01";
# match "intprotocol" "0x02";
# action "kldload ulpt";
#};
#
#nomatch 32 {
# match "bus" "uhub[0-9]+";
# match "mode" "host";
# match "intclass" "0x07";
# match "intsubclass" "0x01";
# match "intprotocol" "0x03";
# action "kldload ulpt";
#};
6. 重開 devd , unload ulpt,ko 及 重開 cupsd
# /etc/rc.d/devd restart # kldunload ulpt # /usr/local/etc/rc.d/cupsd restart
7. 接下來就可以到 cups 的管理介面 Add Printer 了, 記得Maker 選 HP, Model 選 HP LaserJet P1006 Foomatic/foo2xqx (en)
接下來就可以送個測試頁看看了










