Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A1016 Keyboard and Ventura #71

Open
jwrw opened this issue Jan 27, 2023 · 33 comments
Open

A1016 Keyboard and Ventura #71

jwrw opened this issue Jan 27, 2023 · 33 comments

Comments

@jwrw
Copy link

jwrw commented Jan 27, 2023

I've a M1 Mac with 13.1 Ventura. I originally used blueutil to get my nice old A1016 keyboard connected. However, something changed and I ended up losing connectivity, deleted the pairing but couldn't get it back. Judging by comments on various forums, there's been a lot of work around the BT stack that has been breaking things. On the latest O/S, blueutil itself does seem to behave slightly differently than I might have expected. (e.g. why do I have to turn off BlueTooth to get the scan results to appear?)

Back to the A1016... I'm not sure if this counts as an issue but I wanted to share something that worked. I think the keyboard sends a PIN when you connect, which may conflict with the newer BT standards. If you just do blueutil --pair <kdb Mac> 0000 then switch on the keyboard and hit <return> on the A1016, you get an authentication failure.

BUT If you immediately repeat the blueutil --pair <kdb Mac> 0000 command and type 0000<return> on the A1016 keyboard, pairing is successful. You can then connect the keyboard using the BT panel in System Settings.

[NB.You will clearly need a connected keyboard to enter the blueutil command]

@toy
Copy link
Owner

toy commented Jan 27, 2023

Normally it is expected for devices that have a screen to present the pin for confirmation and for devices that can input numbers to input the same pin. So blueutil --pair ID PIN expects for pairing with a keyboard the PIN to be typed on the keyboard. Not sure if PIN can be only numbers on any characters, but not reqired to be 0000. You then should be able to also use blueutil --connect ID to connect without opening System Setting/System Preferences.

@jwrw
Copy link
Author

jwrw commented Jan 28, 2023

Agree - the behaviour is 'abnormal' - it's quite an old keyboard. Other keys are ignored when you switch it on but the first press of return initiates a pairing with key 0000 from the keyboard. This fails, because blueutil like most hosts expects to initiate pairing with a keyboard. I guess any PIN would do in the command - as the first one is ignored when pairing fails and you can enter the second one on the A1016. Using the standard Apple Bluetooth pairing, MacOS throws up a PIN code in a pop-up when you initiate the connection with the <return> key. However, this immediately then disappears, as the keyboard sends its '0000' PIN and authentication fails. So blueutil has certainly dug me out of a hole and allowed be to get paired! Thx!

@vlastoun
Copy link

I have the same problem with Logitech mouse MX3 and keyboard Logitech Mechanical. I am not able to --inquiry or --pair them ( they can be paired over macos bluetooth ui). I found that its address is changed after every successfull paired atempt. Last two digits are increasing. But when running inquiry it does not work.. If i guess next correct adress then I try to pair and no success. I also try to put pin there and no success.

Is there any way I can debug it? or more verbose?

@toy toy mentioned this issue Mar 4, 2023
@toy
Copy link
Owner

toy commented Mar 5, 2023

@vlastoun One of the first links in search suggests that Logitech devices can do something odd about their mac address https://unix.stackexchange.com/q/690808. Problem with pairing is maybe the yet unresolved issue on newer osx versions.

@a2mta
Copy link

a2mta commented Jun 24, 2023

Hello @jwrw.
I wanted to ask if you were able to do that trick once or if it's something that works all the time.
It's just I bought the same keyboard the other day and was disappointed by the lack of macos support and don't want to throw it in the closet because of that.
I have the same issue you described with almost the same setup (M1 mac pro with macos Ventura 13.4.1), and I could not reproduce your solution.
blueutil just fails with two different errors ("Unspecified Error" and "No connection")
Maybe it has something to do with the timings when you have to press "return" or something else. ?

@vlastoun
Copy link

vlastoun commented Jun 28, 2023 via email

@tamruta
Copy link

tamruta commented Oct 4, 2023

I was able to connect my A1061 with M2 Mac Pro 2022 using blueutil --pair <kdb Mac> 0000

I've done this a few times now and my pairing has been stable. The kb connects automatically to my mac once I have paired

edit: 13.1 Ventura

@toy
Copy link
Owner

toy commented Oct 5, 2023

@tamruta Great to hear that it works for you. Do you mean A1016? Also see my comment about the pin.

@jwrw
Copy link
Author

jwrw commented Oct 5, 2023

I think I managed the trick with the A1016 a couple of times - but once I got it paired I didn't want to risk trying it over and over. It is quite likely that you need to be a little lucky with the timing?!?!

@tamruta
Copy link

tamruta commented Oct 6, 2023

@toy Sorry I meant A1016

When my kb is low on battery it disconnects more easily. If I don't type something as soon as it connects, the connection is lost. In that situation I just keep an eye on the green light by the power switch to connect.

I think I needed more luck to get the mac address of the kb than to pair with it. I was using --inquiry and it wouldn't show up unless the kb was switched as soon as I had ran --inquiry.

@toy
Copy link
Owner

toy commented Oct 6, 2023

@tamruta Unless you unpair the keyboard, you shouldn't need to pair it to connect, so --connect NAME should be enough, also you can use name and not the address for that.

@tamruta
Copy link

tamruta commented Oct 6, 2023

@toy Ah sorry for the confusion, I was just mentioning that for notes. I've not had any trouble connecting once it has been paired. Thanks for the tip! I haven't tried using the name

@strangerbit
Copy link

strangerbit commented Oct 21, 2023

Hello @jwrw. I wanted to ask if you were able to do that trick once or if it's something that works all the time. It's just I bought the same keyboard the other day and was disappointed by the lack of macos support and don't want to throw it in the closet because of that. I have the same issue you described with almost the same setup (M1 mac pro with macos Ventura 13.4.1), and I could not reproduce your solution. blueutil just fails with two different errors ("Unspecified Error" and "No connection") Maybe it has something to do with the timings when you have to press "return" or something else. ?

I have exactly the same issue.

blueutil --pair 00-01-A4-xx-xx-xx 0000
Failed to pair "00-01-A4-xx-xx-xx" with error 0x02 (No Connection)

@jwrw
Copy link
Author

jwrw commented Oct 26, 2023

Config

Apple Studion M1 Max, Sonoma 14.0 (recently upgraded from Ventura but steps are the same)

blueutil 2.9.1
Apple Wireless Keyboard (aka A1016) 1.1.0

(My A1016 was connected and working fine so I went to bluetooth settings, clicked the little 'i' next to the keyboard and selected 'Forget Device...' and clicked the scary red 'Forget Device' on the warning dialog.)

Preamble

Plug in a generic USB keyboard - all typing is on that keyboard unless specified. If you're doing this on a laptop, then you don't need the USB keyboard, the input will be on that laptop keyboard.

Get the keyboard mac address

Terminal Terminal 2 A1016 Note
Open a Terminal window Open a second terminal window A1016 switched off
Enter blueutil --inquiry Get 1 line confirmation inquiry is running
Switch on keyboard
After 10s enter blueutil -p 0 Power off bluetooth
Results of inquiry now appear
Enter blueutil -p 1 Put bluetooth back on
Find mac address of keyboard here You can close Terminal 2 now Switch off keyboard

Pair the A1016

You're using the USB (or laptop) keyboard to enter Terminal commands and the A1016 is switched off.

Terminal A1016 Note
Type blueutil --pair 00-0a-95-xx-xx-xx 0000 BUT DON'T HIT 'Enter' YET
Swtch on keyboard
Hit 'Enter' Within a few seconds
Get message Input pin 0000 on "Apple Wireless Keyboard" (00-0a-95-xx-xx-xx)
Hit 'Enter'
Get message Failed to pair "00-0a-95-xx-xx-xx" with error 0x1f (Unspecified Error)
Fairly quickly press 'Up Arrow' then 'Enter' to repeat the blueutil --pair 00-0a-95-xx-xx-xx 0000 command This is just what I did - I don't know how fast you need to be but a few seconds seems OK
Get message Input pin 0000 on "Apple Wireless Keyboard" (00-0a-95-xx-xx-xx)
Type 0000 and press 'Enter' Send the PIN from the A1016, again fairly quickly after entering the pair command

If you have the bluetooth settings open you should see the keyboard appear as connected. Hit 'Enter' and it should all be OK.

@adamesq
Copy link

adamesq commented Oct 27, 2023

Unfortunately, I cannot get this to work on M2 Mac Mini running Ventura...I've tried over 20 times. I've got the MAC address using the method above (and double-checked with a mid-2014 MBP), but almost always gives a no connection error on the M2. Occasionally, I get Unspecified Errors, but NEVER get prompted for the Input pin. Just a big fail on this end.

@toy
Copy link
Owner

toy commented Oct 29, 2023

@jwrw About «Get the keyboard mac address» - inquiry gets stuck or just takes much more time?
About «Pair the A1016» - does it not work if typing 0000 and pressing 'Enter' on first attempt?

@adamesq Do you have bluetooth permission on for your terminal? See #82 (comment)

@jwrw
Copy link
Author

jwrw commented Oct 31, 2023

Hi @toy, I tried leaving the command for a good 10 minutes and got no response, other than the initial confirmation

~ % blueutil --inquiry
2023-10-31 09:17:28.028 blueutil[81517:1660588] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x6000026bc080

If I leave the command for a little time (e.g. 1 minute) then try the blueutil -p off ; blueutil -p on trick, I get to see only the BT devices that are not connected (i.e. I don't see the BT keyboard and mouse that are connected)

In this case the output is like...

~ % blueutil --inquiry
2023-10-31 09:32:36.621 blueutil[83381:1678866] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x6000001c8050
address: 90-0f-0c-xx-xx-xx, not connected, not favourite, not paired, name: "the big TV", recent access date: 2023-10-31 09:32:58 +0000
address: 00-1d-df-xx-xx-xx, not connected, not favourite, not paired, name: "SoundSticks Wireless", recent access date: 2023-10-31 09:32:58 +0000
2023-10-31 09:32:58.125 blueutil[83381:1678866] -[IOBluetoothDeviceInquiry dealloc] -  0x6000001c8050

@jwrw
Copy link
Author

jwrw commented Oct 31, 2023

Re: pairing - I tried all sorts of combinations, certainly 0000<enter> was the first thing, but the keyboard BT doesn't seem to be active until that first <enter>. Doing it a second time immediately after, as per the above, was what worked for me.

@adamesq
Copy link

adamesq commented Oct 31, 2023

@jwrw About «Get the keyboard mac address» - inquiry gets stuck or just takes much more time? About «Pair the A1016» - does it not work if typing 0000 and pressing 'Enter' on first attempt?

@adamesq Do you have bluetooth permission on for your terminal? See #82 (comment)

Thank you for the suggestion. I had not, but after adding the permission, I now get Connection Errors. In both cases (before and after enabling, I never get to the request to enter 0000. 🤔

EDIT: After posting the reply above, I tried just hitting "enter" after inputting the pair request. Between the connection errors, I started seeing the request to enter 0000. After about 15 randomly timed requests, I hit "0000 " while waiting for a connection error. It just happened to be timed correctly. 'Input pin 0000 on "00:0x:xx:xx:xx:xx"' just happened to show up while I was inputing and...now connected. Kinda hit and miss. I appreciate the help here, but not the hoops we are all having to jump through in lieu of a simple fix in the Mac OS!

@lnealan
Copy link

lnealan commented Nov 3, 2023

Thank you for the suggestion. I had not, but after adding the permission, I now get Connection Errors. In both cases (before and after enabling, I never get to the request to enter 0000. 🤔

EDIT: After posting the reply above, I tried just hitting "enter" after inputting the pair request. Between the connection errors, I started seeing the request to enter 0000. After about 15 randomly timed requests, I hit "0000 " while waiting for a connection error. It just happened to be timed correctly. 'Input pin 0000 on "00:0x:xx:xx:xx:xx"' just happened to show up while I was inputing and...now connected. Kinda hit and miss. I appreciate the help here, but not the hoops we are all having to jump through in lieu of a simple fix in the Mac OS!

I had the same issue of never getting the Input pin prompt and was only able to finally get it after resetting the PRAM on my macbook pro. Once that was working i was able to successfully pair as well.

@hou-mon
Copy link

hou-mon commented Nov 7, 2023

I too had the same issues of never getting the input pin prompt. A solution that's worked for me and seems reproducible was to add the device as a favorite BEFORE attempting to pair. The keyboard doesn't need to be on to do this:

blueutil --add-favourite 00-0a-95-xx-xx-xx

From that point I would follow @jwrw pair instructions.

@paulzaptec
Copy link

I had a similar problem with only ever getting "No Connection" or "Unspecified Error" on macOS Sonoma / MBP M1. This seems to be because I had the Bluetooth settings window open.

Closing the Bluetooth settings window allowed me to successfully pair an A1016 keyboard with:
blueutil --pair 00-0a-95-xx-xx-xx 0000

@dariolob
Copy link

dariolob commented Dec 6, 2023

Hey there. I've tried every possibile combination but I'm still unable to pair my A1016 to Sonoma 14.1 on Mac Mini M1. I followed @jwrw instructions religiously, bluetooth permissions are in place, I've tried with the BT settings window both open and closed, also tried adding the device as a favorite like suggested by @hou-mon... nothing. Do I have to give up? :(

@alexcu
Copy link

alexcu commented Aug 20, 2024

@dariolob probably a bit late I also had this issue. I just managed to get my A1016 keyboard set up in 14.6.1 with blueutil following these instructions and similar to this comment — note the dashes not colon in the address, it's easy to miss.

I did, however, do a few things beforehand which may have impacted the connectivity issues:

  1. Turn on the A1016 keyboard.
  2. Use --inquiry to get the MAC address:
    $ sudo BLUEUTIL_ALLOW_ROOT=1 blueutil --inquiry
    address: 00-0a-95-4b-dd-b1, not connected, not favourite, not paired, name: "00:0A:95:4B:DD:B1", recent access date: 2024-08-20 02:01:23 +0000
  3. Add it as a favourite:
    $ blueutil --add-favourite 00:0A:95:4B:DD:B1
  4. Pair with 0000:
    $ blueutil --pair 00-0a-95-4b-dd-b1 0000
    Input pin 0000 on "00:0A:95:4B:DD:B1" (00-0a-95-4b-dd-b1)
    
    Note the command above will immediately run and not pause until you type in 0000 on the A1016.
  5. Type 0000 on the top row of the A1016 (i.e., not the numeric keypad) and hit return. (You won't be typing anywhere or not into a prompt, just type it and hit enter.)
  6. The "Connected" pop up appears (interestingly with a A1255 keyboard outline, not the A1016).

All seems to work now, typing this out on an A1016 😊 Hope it works for you!

@toy
Copy link
Owner

toy commented Aug 22, 2024

@alexcu What happens if inquiry is done without sudo?

@a2mta
Copy link

a2mta commented Sep 16, 2024

@alexcu wow thank you so much for sharing these guide, idk how but i did manage to connect my keyboard (M1 mac book with 14.6.1 MacOS) after a year of trying every couple of month.
Too bad I've already changed a few different keyboards and now the apple one doesn't seem so comfortable to use lol

@alexcu
Copy link

alexcu commented Sep 16, 2024

@alexcu What happens if inquiry is done without sudo?

Sorry, I missed this reply, @toy. Seems to work in either case for me 🤷

❯ blueutil --inquiry
2024-09-17 09:31:27.078 blueutil[74469:4271813] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x600003070040
<devices>
2024-09-17 09:31:37.616 blueutil[74469:4271813] -[IOBluetoothDeviceInquiry dealloc] -  0x600003070040
❯ sudo BLUEUTIL_ALLOW_ROOT=1 blueutil --inquiry
2024-09-17 09:32:23.768 blueutil[76254:4274982] -[IOBluetoothDeviceInquiry initWithDelegate:] -  0x600001bb4030
<devices>
2024-09-17 09:32:34.300 blueutil[76254:4274982] -[IOBluetoothDeviceInquiry dealloc] -  0x600001bb4030

@alexcu
Copy link

alexcu commented Sep 16, 2024

now the apple one doesn't seem so comfortable to use lol

@a2mta the exact same thing happened to me 😂 Wondering if I can take the keyboard apart and adjust some of the rubber domes.

@s1eelra1
Copy link

s1eelra1 commented Oct 7, 2024

@alexcu Thanks for the tips. I just was successfully able to pair a couple of older MS mice that are "replacement" units. I followed your instructions, and just removed the 0000 (mice can't enter that of course). This is on 14.7 as well.

@trmorrisnd
Copy link

trmorrisnd commented Dec 14, 2024

Newbie here. Not a programmer! I've got an M1 running Ventura (14.6). I want to connect a A1016 I bought at a yard-sale.

A keyboard does show up in bluetooth-settings nearby-devices as: "jvburke's keyboard". The Connect button does nothing--that I can see. And the keyboard often disappears from the nearby devices list.

When I type 0000 on the A1016 and hit enter, about 10% of the time, a small popup comes up with a random 6 digit code and some instructions, but it disappears after ~0.25 seconds--and that's not long enough for me to read the 6 digits or the @#$#ing! instructions. The 6-digit code is different every time.

Lil' help please?

And how exactly would I follow the advice above?? E.G.: "blueutil --pair "
Do I need to find a command line, install a blueutil app? I need someone to break it down for me, newbie style.

@toy
Copy link
Owner

toy commented Dec 15, 2024

@trmorrisnd The behaviour you describe suggests to me either hardware/firmware problem with keyboard or some problem with the mac. Do you have access to some other mac or other bluetooth keyboard or other device to try to identify where lies the problem?

@Barack02
Copy link

hello guys, I've been reading all the previous instructions to connect the wirless keyboard, I'don't undertand why it doesen't work.
So this is the resume of my process:
-I correctly installed blueutil

  • I've done the permission on > setting >privacy >terminal turn on, and then see if it works by turn on and off the bluethoot whit blueutil
  • I've found the ID with blueutil
    -I've add the device in my favourite
    -Then i tried to pair with and without the 0000 at the end
    but nothing change

Some information:

  • my device is a Macbook Pro with intel processor from 2018
    -when i try to connect with the Bluethoot setting i see the device and i can see the pin code by tap 0000 in the keyboard but after a millisecond it disappera

@toy
Copy link
Owner

toy commented Dec 21, 2024

@Barack02 As it doesn't work from settings too, I also suggest checking if the keyboard can be connected to another mac or if another keyboard/device can be connected to the mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests