Printing using libusb

Viewed 673

Hello I am working on project that need to print directly to USB printer (POS printer). The application is running on Linux, right now i am using the usblp to print by write ESCP command directly to /dev/usb/lp0. Everything goes well, but the problem comes when user plug a printer that not detected as usblp on Linux.

So instead of depends on linux kernel usblp, I would like to directly write the data to USB device using libusb. So my question will be:

  1. Is it OK to send directly the ESCP command to printer using libusb.
  2. From the libusb docs, to open and configure usb device there are some step to do. Should I open and configure the usb when printing OR I open and configure once and keep it open so I don't need to open and close when I want to print?
  3. If I want to open and close printer when I want print, is it fast for opening, configure, and claiming an USB device using libusb?
0 Answers
Related