Hex to binary

Hi All,

I am trying to pair my Wii remote to and an nvidia shield.  But I don't know the bluetooth pin.

After reading several articles online it says I need to calculate it based on the MAC address.


The PIN-Code is the binary bluetooth address of the wii remote backwards. Following a short piece of C code to calculate the PIN:

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.

http://wiibrew.org/wiki/Wiimote#Bluetooth_Pairing

Could someone help me work out what the pin should be?  I've tried several online calculator but suspect I'm doing it wrong.

The MAC addresses for my two Wii controllers are;

00:19:1D:C6:EE:61
00:19:1D:B5:57:89


Many thanks
LVL 2
detox1978Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dr. KlahnPrincipal Software EngineerCommented:
I suspect that there's more to it than this, because the method described produces very non-standard and non-printable characters that are not suitable to being typed on a standard keyboard.

00:19:1D:C6:EE:61

Reverse to 61, EE, C6, 1D, 19, 00

Look up in the ASCII code table:

61 = a, EE = î, C6 = Æ, 1D = the nonprintable GS character, 19 = the nonprintable EM character
petergabrielgabrielpeterCommented:
have you tried this?


Start up your Bluetooth software and have it search for a device.
Hold down the 1 and 2 buttons on the Wii Remote. You should see the LEDs at the bottom start flashing. Do not let go of these buttons until this procedure is complete.
detox1978Author Commented:
Hi Peter, it still prompts for a PIN.  This seems to be mandatory on android since 4.2
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

Ben Personick (Previously QCubed)Lead Network EngineerCommented:
For 00:19:1D:C6:EE:61:
char pin[6];
pin[0] = 0x61;
pin[1] = 0xEE;
pin[2] = 0xC6;
pin[3] = 0x1D;
pin[4] = 0x19;
pin[5] = 0x00;

Open in new window


and for 00:19:1D:B5:57:89:

char pin[6];
pin[0] = 0x89;
pin[1] = 0x57;
pin[2] = 0xB5;
pin[3] = 0x1D;
pin[4] = 0x19;
pin[5] = 0x00;

Open in new window

detox1978Author Commented:
Thanks Ben.  The OS is android so to type the PIN in it would be in ASCII?  Any idea what i would type in?
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
yes actually on mobile had results in PS on my OS will have to post in a bit
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
Here is some Powershell code and its Output.  You can run this code yourself to make sure you are getting the correct characters instead of copying it from the text here.

Powershell Code:
$MACAddresses=@("00:19:1D:C6:EE:61","00:19:1D:B5:57:89")
foreach ($MAC in $MACs) {
	# $MAC = $MAC -split ":"
	# $ASCII = ($MAC | foreach {[char][convert]::toint16($_,16)} )
	$ASCII = ($MAC -split ":" | foreach {[char][convert]::toint16($_,16)} )
	[Array]::Reverse($ASCII)
	$ASCII=[string]::Join("",$ASCII)
	"MAC: $MAC -- Reversed ASCII Characters: '$ASCII'"
}

Open in new window


Results:
MAC: 00:19:1D:C6:EE:61 -- Reversed ASCII Characters: 'aîÆ↔↓ '
MAC: 00:19:1D:B5:57:89 -- Reversed ASCII Characters: '?Wµ↔↓ '

Open in new window


NOTE: The "00" character is actually the NULL value! Therefore you may need to simply leave the character off, otherwise, space may do, and if not then I would try the results of running the PowerShell on your system directly.

Edit:

The OS is android so to type the PIN in


I just noticed that.

Option A:

Step 1)  Take the Output (whether you copy and paste from here, or from a powershell on your own system) and paste them into a text file using a text editor (IE NotePad, Notepad++, Sublime -- Don't use other programs like Word).  ( I suggest keeping the whole line, the MAC will help you ID which remote is which, and the single quotes around them will make sure you won't be confused as to where they start and stop for step 3)

Step 2)  Save the text file, and copy it to your android device.

Step 3) Use a split screen (or you can flip back and forth between) to open the app you need the characters in, and an android text editor (I know x-plorer has a good one integrated I generally use that) where you will open the text file you created to copy out the characters. (As above if you kept the info together as shows in the post the single quotes will help make sure you get the info correctly.

Option B:

If you are unable to paste the characters as a whole, or one at a time into the application, then you might be able to find the config files for the NVidia application and edit them directly.

  (This can be done directly on the android or by copying it to windows and copying it back, both have their own caveats.)

B.1) On Android you could use X-Plorer to try to find the configs and edit them, or another file explorer and a separate android text/hex editor

B.2) On windows Use ADB to connect to the phone browse the OS, find the file, copy it to WIndows and open it in Notepad++, or Sublime, or a dedicated Hex editor (many of which are available for free online) if you want to try making sure the byte 00 is actually 00.   (However do not use the regular Microsoft notepad or any other app as the android is writing a unix file and you need an editor which will respect that for the changes you are making.)


I think that about covers it. :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
binary counting

From novice to tech pro — start learning today.