I am using usb4java and I have used the example as described on the help page (http://usb4java.org/quickstart/javax-usb.html) to print data on a receipt printer by synchronous I/O (pipe.syncSubmit), each line ending with LF (10) to flush the output.
It works great with a Chinese 58mm model, but when I connect to an Epson 80mm printer the output is randomly cutted. Most times the last lines are missing.
I wonder if I need to do more than just send LF, close the pipe and release the UsbInterface to guarantee that all bytes are transmitted to the printer. Is there some kind of flush operation, or a write-cache on such a non-mass-storage device that I need to deactivate somehow?
Try using the pipe command with chunks of maximum of 4 bytes, e.g.
pipe.syncSubmit(new byte[] { 70, 71, 72, 73});
pipe.syncSubmit(new byte[] { 74, 75, 76, 10});
As last byte there should be 10 for line feed (which flushes thew output to the printer).
This helped for me (although the packet size announced by the USB device was 64). Not sure if there is a bug in usb4java or any other issue.