
我有一台雷射切割機,透過通用 USB 轉並行適配器連接。碰巧,雷射切割機使用 HPGL,但由於這是雷射切割機而不是繪圖儀,因此我通常會想自己產生 HPGL,因為我關心切割的順序、速度和方向等。
在先前版本的 Ubuntu 中,我可以透過將 HPGL 檔案直接複製到相應的 USB「lp」裝置來列印到切割機。例如:
cp foo.plt /dev/usblp1
好吧,我剛剛升級到 Ubuntu 11.10 oneiric,我在 /dev 中找不到任何“lp”設備。噢!
在 Ubuntu 中將原始資料傳送到並行連接埠的首選方式是什麼?我嘗試過“系統設定”>“列印”>“+ 新增”,希望我能夠將我的設備與某種“原始印表機”驅動程式關聯起來,並使用以下命令進行列印
lp -d LaserCutter foo.plt
但我的 USB 轉並行適配器似乎沒有出現在清單中。我看到的是我的 HP Color LaserJet、兩個 USB 轉串行適配器、“輸入 URI”和“網路印表機”。
同時,在 /dev 中,我確實看到了 2 個 USB 轉串口轉接器的 /dev/ttyUSB0 和 /dev/ttyUSB1 裝置。除了通用 USB 內容之外,我沒有看到任何與 HP 印表機(升級前為 /dev/usblp0)明顯對應的內容。例如,sudo find /dev | grep lp
不產生任何輸出。不過,我似乎確實能夠很好地列印到惠普印表機。印表機設定 GUI 為其提供了一個以「hp:」開頭的裝置 URI,這對於平行適配器沒有太大幫助。
CUPS 管理員指南聽起來好像我可能需要向其提供 形式的設備 URI parallel:/dev/SOMETHING
,但當然,如果我有一個,/dev/SOMETHING
我可能會直接直接寫入它。
以下是dmesg
我從 USB 連接埠斷開並重新連接裝置後顯示的內容:
[ 924.722906] usb 1-1.1.4: USB disconnect, device number 7
[ 959.993002] usb 1-1.1.4: new full speed USB device number 8 using ehci_hcd
這是它在 lsusb -v 中的顯示方式:
Bus 001 Device 008: ID 1a86:7584 QinHeng Electronics CH340S
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x1a86 QinHeng Electronics
idProduct 0x7584 CH340S
bcdDevice 2.52
iManufacturer 0
iProduct 2 USB2.0-Print
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 96mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 7 Printer
bInterfaceSubClass 1 Printer
bInterfaceProtocol 2 Bidirectional
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)
答案1
您正在尋找的裝置檔案/dev/usb/lpX
由驅動程式提供usblp
。但在 Ubuntu 11.10 中,該驅動程式似乎已被列入黑名單。查看/etc/modprobe.d/blacklist-cups-usblp.conf
文件:
# cups talks to the raw USB devices, so we need to blacklist usblp to avoid
# grabbing them
blacklist usblp
如果還是想直接向裝置發送數據,可以暫時載入驅動程式modprobe usblp
(黑名單只是阻止自動載入驅動程式)。完成後,您可以使用 卸載它modprobe -r usblp
。