Byte Code Commands/Responses to a USB Printer

Copper Contributor

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