6 ms·
Why do Macs ask you to press random keys when connecting a new keyboard?
- alsetmusic 7mo agoMapping to ensure that it has the correct layout applied.
- Our_Benefactors 7mo agoYes, but this doesn’t answer why I only have to do this on Mac and not windows/linux, where I have literally never run into an issue as a result of not doing it.
- QuercusMax 7mo agoI assume for some nonzero percentage of folks it doesn't work right and they have to manually go and set their keyboard layout. Of course, when you're setting up your OS initially, it will ask you questions about language and keyboard layout. I suspect most people don't switch keyboards after install, and of those who do, the most common case is another keyboard with a compatible layout.
- HPsquared 7mo agoI assume you have a standard US keyboard.
- jasonjayr 7mo agoMost non-Apple branded keyboards are NOT tested with mac; so it doesn't trust any electronic tags/labels, nor does it keep a database. Easiest thing to make it work 100% without asking the user to identify their layout, is to press random keys so the mac knows where things are mapped.
- masfuerte 7mo agoWindows and Linux both ask for your language and locale during setup and default to the typical matching keyboard. I'm nearly sure Debian also asks you to confirm the keyboard it picked, but it's always the right one so I just hit enter.
- thebruce87m 7mo agoDo you live in a country where the default always maps correctly? My UK keyboards will always have specific keys wrong.
- dlcarrier 7mo agoIf you're using a US English keyboard layout, it's the default and you won't have to deal with changing it. The most likely reason it would be a problem then would be that some Raspberry Pi images have defaulted to British English keyboard layouts. Otherwise you may be sailing through life unburdened by what can be a major pain to anyone anywhere else in the world, like a resident of Arizona wondering why the rest of the world keeps messing with their clocks.
- altairprime 7mo agoSee also the layout identifier manual-elsif/elsif/elsif workflow here, last updated November 2023: https://support.apple.com/en-us/102743 https://support.apple.com/en-us/102743
- deleted 7mo ago[deleted]
- throwaway27448 7mo agoRandom ≠ arbitrary
- chimeracoder 7mo ago> Random ≠ arbitrary Sure, though if you're looking to be pedantic, the keys they're asking you to press are neither random nor arbitrary
- throwaway27448 7mo agoHow are they not arbitrary? Apple tells you a specific key to press, which is a choice. It is by definition arbitrary. Edit: perhaps you're making the case that the user doesn't choose which key. This is true—but the important point is that one of the two parties did choose the specific key to press. Edit2: For those downvoting, perhaps you could articulate why.
- lgas 6mo agoArbitrary and random are basically the same in this context. The person you're replying to is pointing out they are specific keys for specific reasons because those specific keys can be used to figure out which kind of keyboard it is, they are not random or arbitrary, they are chosen with a specific reason in mind. If they were really chosen arbitrarily, they would not be able to accomplish the goal.
- toast0 6mo agoMy impression is that Apple's choice of keys was constrained. The American Heritage® Dictionary of the English Language, 5th Edition defines arbitrary as > Determined by chance, whim, or impulse, and not by necessity, reason, or principle. But the choices seem to be based on reason or principle.
- dylan604 6mo agothey are not random requests. they are keys known to have different locations depending on the locale. by seeing what the values sent when the requested key is pressed, they know how to map the inputs from the keyboard. that definitely does not sound arbitrary to me.
- emeraldd 7mo agoHonestly, the mac approach makes much more sense from an ease of use perspective for non-experts. On other platforms, you have to know the layout to choose and hope things work until you do or have a second keyboard that's close enough tl the default to get by. On Mac, it just figures it out based on the information you tell it when the keyboard is connected. Much less error prone in the majority of cases.
- srean 7mo agoAh! Thanks for the stimulation. That's an interesting problem that I had not thought of before. In fact a few related problems. What's the minimum set of requested key presses that will uniquely identify a keyboard layout from a set of known types. Given a budget of k key strokes what's the most informative subset that will reduce the ambiguity about layout. Given the measurement from the requested key strokes find the posterior over the set of known keyboard layouts. Given that the user is typing some free form text in his language how soon can one nail the layout when the user's language, the layout and the text are unknown. Will make a good practice exercise for hobbyist codebreaking.
- dirasieb 7mo agothey don't ask you to press random keys
- ginko 7mo agoI guess the moment has passed by now but I wish there were a USB HID protocol for keyboards to identify their layout, or even better yet make the keyboard protocol layout agnostic so that keyboards send the high-level unicode character / modifier instead of a physical key code.
- weinzierl 7mo agoI think every OS should ask you to press a freshly generated sequence of keys when connecting a keyboard to prevent BadUSB attacks. Does any system do this?
- avidiax 7mo agoThat would break credit card readers, barcode scanners, and special purpose keyboards (like video workstations). I suppose you could rely on a binary code, where the user is instructed to press any two keys to repeat the code, or if there is only one key (or it's a barcode scanner), to enter the same input multiple times, separated by long and short pauses. Still seems like it would be difficult for the average user.
- dylan604 6mo agoHaving those devices ID themselves to the OS as a keyboard sounds like an idea where someone said "it'll be fine" rather than doing something more specific. sure, hindsight is 20/20 and all.
- MBCook 6mo agoThere must be a way to tell them apart in the USB protocol because I’ve never gotten the keyboard prompt on my Mac when I plug one of those in.
- vinni2 7mo agoWhy does it sometimes ask when connecting a HDMI projector?
- leejoramo 7mo agoMany projectors include remotes that allow you to control a slide presentation. These remotes send the default keystrokes that Microsoft PowerPoint knows (and which other presentation software copied) So when you connect a projector the OS often sees a keyboard and mouse. This triggers macOS’s keyboard recognition tool. Old VGA projectors had separate keyboard/mouse ports. I assume HDMI has a USB channel?
- cesarb 6mo ago> I assume HDMI has a USB channel? No, it doesn't, it only has I2C (for display identification and control, same as VGA and DVI) and CEC (for remote control).
- tomasphan 7mo agoApple has to make it annoying to use a non-Apple device with your Apple device. That sort of friction probably nets them 2% in keyboard sales per year.
- daft_pink 7mo agoThanks I’m always worried. I do the wrong thing when that thing pops up for my mouse.
- ch_123 7mo agoIn addition to the three physical keyboard layouts in this post, there's a fourth one which has an extra key on both the right and the left side of the keyboard. An example is the Brazilian Portuguese layout Model M (pic: https://www.clickykeyboards.com/wp-content/uploads/2023/03/IMG_1176.jpeg https://www.clickykeyboards.com/wp-content/uploads/2023/03/I...). The Apple test would be able to identify it, although I've never tried it in practice. I don't think the modern Brazilian Apple keyboard uses this arrangement.
- cesarb 6mo ago> there's a fourth one which has an extra key on both the right and the left side of the keyboard. An example is the Brazilian Portuguese layout Model M (pic: ...) That's the ABNT2 keyboard layout, which is the keyboard layout used here in Brazil. AFAIK, it's the only common keyboard layout with that characteristic.
- hennell 6mo agoI feel like a UK windows keyboard and a Mac has some oddities like this. I've got a zsa split keyboard and still haven't worked out how to have punctuation the same in Mac and windows. @ and " are always flipped and I had to add additional buttons to ensure I have a | and ~ keys because who knows where the Mac thinks they are.
- Theodores 6mo agoWhy do American keyboards have that horizontal enter key? As a Brit, with plenty of notionally British keyboards to choose from (with £ signs for the price and the '3' key), too often there is this wrong-shaped horizontal enter key. What is the thinking behind that? As for the article, mystery key pressing games might be incredibly clever in the parallel universe of the Apple cult, and even quite fun, particularly if you press the wrong keys deliberately, but I prefer the Ubuntu way, where you just have the keyboard for your locale selected, with the option to change it, if you really want to.