I believe what you can do in order to set the MAC address automatically is to download bdaddr which is a tool to change your device MAC address (You can check a guide and the link to download it here: http://blog.petrilopia.net/linux/change-your-bluetooth-device-mac-address/).
Once you have dbaddr you can create an Arduino sketch that sets the MAC address to whatever you want using the command "system" to interact with the Edison's internal Linux console.
Since the Arduino sketch starts every time you boot your Edison, it'll help you set the correct MAC address every time the Edison reboots.
Hello Peter ,
Is there example of Arduino sketch which will setup bluetooth connection with device MAC address ?
I believe there are no examples for this. However what I meant was for you to use the system command on an Arduino sketch to interact with the Linux console. I mean you can write a couple of lines like:
system("date >> /home/root/time.txt");
And you'll have a file called time.txt with the output of date every five seconds. You can use this command in the setup part of the Arduino Sketch run this lines just once. This way you can set up the MAC address as you need it.
Yocto uses systemd to manage the boot process. Thus, a clean & viable solution in your case would be to create 2 dependent systemd services and enable them. The first will initialize bluetooth when the system starts and the second will run a connection scrip after bluetooth is up and running. Here's a link on how dependencies work with systemd along with plenty of other information on that page:
There are a few other threads here on the forums, when others were trying to achieve pretty much the same thing:
BlueZ also provides some python scripts and other tools (btmgmt) in their package that you can use instead of bluetoohctl to pair and connect to devices. There's also hcitool by default on the Edison. These might work better based on the scope of your project and application. You can find the details in Section 6 of the Intel Edison BT guide: http://download.intel.com/support/edison/sb/edisonbluetooth_331704004.pdf
I think what Peter is trying to suggest is that you can use a very simple Arduino sketch and simply make system() calls with the commands you enter manually now, since the sketches run automatically on boot. That might work although I suspect you'll need to add delays (e.g. when starting or scanning) and do some clever redirections if you want to support new devices with a different MAC too, hence why I suggested the other approach.