Thank you in advance for reading this!
I am using a java app to send bytes through the usb interface to an EPSON TM-T88V receipt printer using esc/pos commands
The behaviour is different when executed on the raspberry pi compared to when executed on my dev laptop (which is super strange!)
When the bytes are printed from the raspberry pi - it stops before completing
The code is as below:
public void sendToPrinter(byte[] message) throws UsbException {
UsbDevice device = getPrinterDevice(); //find the usb using usb4java
UsbConfiguration configuration = device.getActiveUsbConfiguration();
UsbInterface iface = configuration.getUsbInterfaces().get(0); //There was only 1
if (!iface.isClaimed()) {
iface.claim(usbInterface -> true);
}
UsbEndpoint endpoint = (UsbEndpoint) iface.getUsbEndpoints().get(0);
UsbPipe pipe = endpoint.getUsbPipe();
pipe.open();
try {
LOG.info(Arrays.toString(message));
int sent = pipe.syncSubmit(message);
LOG.info("Bytes Sent: " + sent);
} finally {
pipe.close();
}
iface.release();
}
Things I have investigated:
- I read on about java8 that during heavy processing, the pi might lose power to usb devices and I have upgraded the power source to the pi so that it is receiving 2A
- I have tried comparing the bytes sent to the printer from my dev machine and the pi and they are identical (the bytes sent and the number of bytes sent are identical)
I can provide more info on the bytes I sent to the printer, although the esc/pos commands sent from my laptop work as expected so I don't believe that could be the cause - but may be wrong!
Thanks again for all your help!