我正在尝试在 Zebra 420 USB 打印机上使用 SGD 命令。
printf "! U1 getvar \"device.languages\"\r\n" | lpr -P myprinter -o raw
我希望这会打印当前的 lang 值,但得到空字符串。如何正确发送命令并接收响应?
更新:一些 dmesg 相关信息
[ 2.912815] usb 1-1.3: new full-speed USB device number 4 using dwc_otg
[ 3.048399] usb 1-1.3: New USB device found, idVendor=0a5f, idProduct=0065
[ 3.057429] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3.066719] usb 1-1.3: Product: ZTC ZM400-200dpi ZPL
[ 3.073649] usb 1-1.3: Manufacturer: Zebra Technologies
[ 3.080757] usb 1-1.3: SerialNumber: XXX999999
[ 3.931237] udevd[156]: starting version 175
[ 6.294509] bcm2835-rng 20104000.rng: hwrng registered
[ 8.580407] gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
[ 8.934595] random: lpinfo urandom read with 87 bits of entropy available
[ 9.215446] usblp 1-1.3:1.0: usblp0: USB Bidirectional printer dev 4 if 0 alt 0 proto 2 vid 0x0A5F pid 0x0065
[ 9.235924] usbcore: registered new interface driver usblp
[ 31.371525] usblp0: removed
[ 31.441360] usblp 1-1.3:1.0: usblp0: USB Bidirectional printer dev 4 if 0 alt 0 proto 2 vid 0x0A5F pid 0x0065
[ 31.835757] warning: process `colord-sane' used the deprecated sysctl system call with 8.1.2.
更新 2:打印到 USB 设备
root@raspberrypi:/home/pi# printf “! U1 getvar \“device.languages\“\r\n” > /dev/usb/lp0