I am trying to pair a wimmote on a linux box, bu the problem is bluetoothctl insists that I enter a pin number and the device is not provided with one.
So I understand that it can be constructed from reversing the device address, now I know nothing at all about C++ and assume that the following code is in C++.
Any chance someone can help me to convert this into python ? - I guess this is a bytearray:
Code: Select all
a = bytearray(b'\x6D\x7E\x3B\x35\x1E\x00')
This is the code I found:
Code: Select all
Lets assume the Wiimote has the bluetooth address "00:1E:35:3B:7E:6D". If you want the PIN for bluetooth pairing in a simple string, do the following:
char pin[6];
pin[0] = 0x6D;
pin[1] = 0x7E;
pin[2] = 0x3B;
pin[3] = 0x35;
pin[4] = 0x1E;
pin[5] = 0x00;
Now "pin" contains your bluetooth pin that should be used for pairing your devices.
Code: Select all
_TCHAR * FormatBTAddress(BLUETOOTH_ADDRESS address)
{
static _TCHAR ret[20];
_stprintf(ret, _T("%02x:%02x:%02x:%02x:%02x:%02x"),
address.rgBytes[5],
address.rgBytes[4],
address.rgBytes[3],
address.rgBytes[2],
address.rgBytes[1],
address.rgBytes[0]
);
return ret;
}