Skip to content Skip to sidebar Skip to footer

How Can I Run A Terminal Command Asynchronously Using Python?

I am working on a Linux environment, trying to automate these 2 Linux commands using a Python script: sudo rfcomm connect 0 XX:XX:XX:XX:XX:XX hcitool rssi XX:XX:XX:XX:XX:XX Comma

Solution 1:

It looks like you are trying to make an RFCOMM connection.

Both rfcomm and hcitool have been deprecated by the BlueZ project back in 2017 so I wouldn't recommend starting a project using these.

BlueZ has APIs that are designed to be accessed from languages like Python and these are documented at: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc and the official examples are at: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test

However, RFCOMM (or Serial Port Profile) connections can be done with the socket library in the standard Python releases. There are examples at https://stackoverflow.com/a/63382835/7721752

There are also examples in the above answer of using the Bluedot library to do the same.

Post a Comment for "How Can I Run A Terminal Command Asynchronously Using Python?"