Communicate and manage the printer device via Bluetooth or USB

The device is a label printer. It can be connected via bluetooth and USB. I would suggest that it has some kind of linux running, since it has a rather complicated interface / screen, but I'm not sure. In fact, this is what I would like to define. But my goal is to get a shell or some kind of “meaningful” connection through which I can send commands / data that will trigger print events by the printer without using the manufacturer’s software

Connecting to a device in ubuntu via USB creates /dev/usb/lp0 . I tried connecting to this using the python serial module, but it was not able to connect to the serial port.

Via bluetooth, I also managed to connect using hcitool scan to get the MAC address of the device, and then rfcomm to connect (using this approach). This created /dev/rfcomm0 , with which I was able to connect and send data using python.

Is it possible to simulate data, usually sent via usb / bluetooth using the manufacturer's software, for printing without software? I assume that this will be possible thanks to the “sniffing” of data transmitted via Bluetooth, while the normal print command is sent by the software manufacturer (although I believe that there is no reason why this would seem understandable to a person).

If such a facial expression is possible, I wonder if, for example, sending equivalent data via bluetooth, a print event will occur. So far, I have no reason to believe that I am sending data via a Bluetooth connection, which is not accepted, but I have not yet received any answer (data or physical) from the Bluetooth connection.

Any tips / suggestions on how I could achieve my common goal would be appreciated.

+5
source share
1 answer

I'm not sure about bluetooth, but for printing via USB you can use the library of cups (licups) and use the API to perform the attraction. It uses IPP. Typically, cups use a printer-specific .ppd file (which contains printer information) to install it. For new language versions, such as PCL5, 5e, 6, etc., there are common ppd files that can be used to install any printer that uses the appropriate language.

+1
source

Source: https://habr.com/ru/post/1238353/


All Articles