Open dashwood01 opened 8 months ago
I made a change in your code and the issue was resolved.
public UsbOutputStream(UsbManager usbManager, UsbDevice usbDevice) throws IOException {
this.usbInterface = usbDevice.getInterface(0);
for (int i = 0; i < this.usbInterface.getEndpointCount(); ++i) {
UsbEndpoint ep = this.usbInterface.getEndpoint(i);
if (ep.getType() == 2) {
if (ep.getDirection() == 0) {
this.usbEndpoint = ep;
} else if (ep.getDirection() == 128) {
this.usbEndpoint = ep;
}
}
}
if (this.usbInterface == null) {
throw new IOException("Unable to find USB interface.");
}
if (this.usbEndpoint == null) {
throw new IOException("Unable to find USB endpoint.");
}
this.usbConnection = usbManager.openDevice(usbDevice);
if (this.usbConnection == null) {
throw new IOException("Unable to open USB connection.");
}
}
This change should be made within the UsbOutputStream class.
I also have an issue that is possibly related, I get the warning: java.io.IOException: Unable to find USB interface. Then I get the error: Caused by: com.dantsu.escposprinter.exceptions.EscPosConnectionException: Unable to connect to USB device.
Hello, First of all, thank you for this amazing library., I can't print through USB. It connects but doesn't write anything to the output stream. I need to mention that I connected through another method and managed to print, but unfortunately, your library doesn't provide me with this capability.