Byte Code Commands/Responses to a USB Printer

%3CLINGO-SUB%20id%3D%22lingo-sub-1231682%22%20slang%3D%22en-US%22%3EByte%20Code%20Commands%2FResponses%20to%20a%20USB%20Printer%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1231682%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20USB%20printer%20I%20would%20like%20to%20send%20byte%20codes%20for%20information%2Fstatus%20to.%3C%2FP%3E%3CP%3EIt%20works%20great%20over%20a%20serial%20com%20connection%2C%20but%20the%20new%20target%20machine%20we%20moved%20the%20printer%20too%20doesn't%20have%20Serial%20DB9%20ports%2C%20only%20USB.%3C%2FP%3E%3CP%3ESo%20this%20use%20to%20work%20fine%3A%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%5BByte%5B%5D%5D%20%24paperRollStatus%20%3D%200x10%2C04%2C0x4%3CBR%20%2F%3E%24port%20%3D%20new-Object%20System.IO.Ports.SerialPort%20COM5%2C9600%2CNone%2C8%2Cone%3CBR%20%2F%3E%24port.Open()%3CBR%20%2F%3E%24port.Write(%24paperRollStatus%2C%200%2C%20%24paperRollStatus.Count)%3CBR%20%2F%3EStart-Sleep%20-Milliseconds%201000%3CBR%20%2F%3E%24data%20%3D%20%24port.ReadExisting()%3CBR%20%2F%3EWrite-Output(%22%5D%20DEBUG%3A%22%20%2B%20%24data)%3CBR%20%2F%3E%24port.Close()%3CBR%20%2F%3EWrite-Output%20(%22%5D%20DEBUG%3A%20Done.%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20would%20would%20be%20an%20equivalent%20way%20for%20USB%20Printer%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1231682%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

I have a USB printer I would like to send byte codes for information/status to.

It works great over a serial com connection, but the new target machine we moved the printer too doesn't have Serial DB9 ports, only USB.

So this use to work fine:


[Byte[]] $paperRollStatus = 0x10,04,0x4
$port = new-Object System.IO.Ports.SerialPort COM5,9600,None,8,one
$port.Open()
$port.Write($paperRollStatus, 0, $paperRollStatus.Count)
Start-Sleep -Milliseconds 1000
$data = $port.ReadExisting()
Write-Output("] DEBUG:" + $data)
$port.Close()
Write-Output ("] DEBUG: Done.")

 

What would would be an equivalent way for USB Printer?

0 Replies