6

I'm working with a Bluetooth LE device in my project and I want to test bluetooth-related host code without having an actual Bluetooth device.

Currently, I have a Linux machine with BT dongle as a host and BTLE sensor. On Linux machine I'm running a Python code which communicates with BTLE sensor using library called bluepy.

And the question is: Is it possible to create a simulated HCI interface in Linux, so that bluepy will think it communicates with a real BT module on my laptop, but in reality - that module will be fully virtual and it will allow Python code to communicate with virtual BTLE sensor that I written.

I already did something similar with simulating RS232 device. Back then I created pseudo TTY to represent RS232 device and my simulation code listened to commands from main code and responded exactly in the same way as real device responded.

So I want to have similar solution with Bluetooth sensor. How this could be achieved?

Update: Seems like bluez gives you a tool called "btvirt". With it you can create a pair (or more) of virtual hci interfaces. And also seems like this tool isn't quite popular as I can't find any documentation on it other than source code itself in github repo.

Ruslan
  • 81
  • 5
  • The bluetooth stack on Linux is a real mess IMHO. If you get btvirt to work, please leave an answer explaining what you did. – dirkt Jul 11 '20 at 12:33

0 Answers0