ESCPOS-ThermalPrinter-Android icon indicating copy to clipboard operation
ESCPOS-ThermalPrinter-Android copied to clipboard

Use list of 'override' printers to return even if interface class is not USB_CLASS_PRINTER.

Open mcarland opened this issue 2 years ago • 2 comments

Suggestion to work around printers that are not coded with a USB_CLASS_PRINTER interface.

Originally if no interface with USB_CLASS_PRINTER was found, the first interface was returned by default. If there were other devices on the USB bus of class USB_CLASS_PER_INTERFACE or USB_CLASS_MISC that were enumerated first, those devices would be returned instead of the printer.

This code adds a check for printers currently known to no be coded USB_CLASS_PRINTER, and will default to the first interface for those, instead or returning null.

suggested fix DantSu/ESCPOS-ThermalPrinter-Android#331

mcarland avatar Sep 15 '22 15:09 mcarland

I'm pretty sure this is Epson's standard, because a while ago I tested it on the TM-88V and it had a return of 255 as well. But I can't confirm it now. When I get it, I'll take the test.

bondcs avatar Sep 16 '22 20:09 bondcs

I'm pretty sure this is Epson's standard, because a while ago I tested it on the TM-88V and it had a return of 255 as well. But I can't confirm it now. When I get it, I'll take the test.

The class/subclass of your printer are 255/255, which are defined as USB_CLASS_VENDOR_SPEC/USB_SUBCLASS_VENDOR_SPEC, so I imagine they didn't bother setting them, and depend on their driver looking for specific VID/PIDs.

I switched to this driver because the binary one I had been using (maybe Epson's?) didn't recognize our printers VID/PID, so wouldn't find it, but the interface class is USB_CLASS_PRINTER letting generic drivers find it.

mcarland avatar Sep 16 '22 20:09 mcarland