Bind a bluetooth device to a rfcomm via python

  Kiến thức lập trình

I was able to search and pair a Raspberry Pi 4 to a bluetooth 4.0 Thermal printer using the BlueZ API.
In order to use the python-escpos library I need to create a serial port /dev/rfcomm, which I can do with sudo rfcomm bind /dev/rfcomm0 XX:XX:XX:XX:XX:XX 1.
How can I do it programatically in python (without having to use python-subprocess)? Thanks!

LEAVE A COMMENT