1 year ago

#367984

test-img

switch_on

MacOS is scrambling bluetooth PINs if they contain char values greater than 0x7E

I'm trying connect a MacOS Monterey 12.3 (M1, 2020) laptop to a bluetooth device typically intended for embedded applications.

The device's bluetooth PIN is the device's address and therefore has char values in the range 0x00 to 0xFF.

If I enter a PIN into the System Preferences > Bluetooth settings GUI such as 0000, I can see the same pin in Xcode PacketLogger (included in Additional Tools for Xcode):

PIN Code Length: 0x04
PIN Code: 0000 (0x30 0x30 0x30 0x30)

However if I send a code such as ¡¡¡¡ ( equivalent to [0xA1, 0xA1, 0xA1, 0xA1]) then in PacketLogger I see:

PIN Code Length: 0x06
PIN Code: ¡¡¡ (0xC2 0xA1 0xC2 0xA1 0xC2 0xA1)

To enter a pin of ¡¡¡¡ I've tried three approaches:

  1. Converting and copy-pasting from an online tool such as RapidTables
  2. Converting in a python terminal and copy-pasting
  3. Setting the Keyboard to "Unicode Hex Input" and directly typing it in by holding down option and typing 00A1

I'm new to MacOS so not sure if its quirk about how it handles text encodings. Can someone explain to me what I'm seeing?

macos

bluetooth

embedded

ascii

hardware

0 Answers

Your Answer

Accepted video resources