1

tl;dr:

  1. Why did power-buttons disappear on keyboards?
  2. Am I correct in how to shut down a host using usb peripherals?
  3. Can a usb peripheral turn on a host? If so, what bytes does it send?

Why do I never see power buttons anymore on USB keyboards? I feel like they were very common on PS/2 keyboards.

Is it a limitation in the USB-protocol, i.e. no suitable packet "ok host, power off" exists?

I did find "system controls" in the HID Usage Tables (v1.12, section 4.5.1), but the HID itself (v.11, section 4.2) remains too vague for me.

"Because the parser for the Report descriptor represents a significant amount of code, a simpler method is needed to identify the device protocol for devices requiring BIOS support (Boot Devices). HID class devices use the Subclass part to indicate devices that support a predefined protocol for either mouse devices or keyboards (that is, the device can be used as a Boot Device). The boot protocol can be extended to include additional data not recognized by the BIOS, or the device may support a second preferred protocol for use by the HID class driver.The bInterfaceSubClass member declares whether a device supports a boot interface, otherwise it is 0."

Subclass Code Description:

  • 0 NoSubclass
  • 1 Boot Interface
  • Subclass 2-255 Reserved"

So if I get this correctly, a keyboard needs to send a descriptor with bInterfaceSubClass set to 1, as well as protocol code 1 (keyboard)?

And when a power button is pressed, it sends scancode 0x66 (KEY_POWER).

Am I correct in my assertions? If so it doesn't seem like a big deal, so why do I never find keyboards with power buttons anymore?

Still, that's just for shutting down a pc. Is there a way a usb device can turn on a host? This used to be possible with ps2 keyboards (granted, you often had to enable it in the BIOS, but still).

P.s. the reason for asking is because I'm annoyed to have to reach over the the power button. I'd much rather have a power button than a useless scroll lock or pause break.

  • I have not seen a power button on a Lenovo or common Logitech keyboard in well over a decade. I use Windows Shut Down to shut down a computer. I am probably not alone. Also power buttons can now be commonly configured to suspend as well as shut down. So the Menu approach turns out to be well designed. – John Jul 22 at 20:14
  • @John Fair enough. Usually I just alt-f4 on my desktop. But I'm still looking for an easy to reach turn-on button. – AnnoyinC Jul 22 at 20:21
  • @AnnoyinC If you want a (soft) power button, you can make one. Open your computer and find where the power button is connected to the motherboard. All you have to do is connect two wires there, run them out of your computer and connect them with a momentary switch. – Keltari Jul 24 at 2:12
4

Power buttons on PS/2 and USB keyboards were always just a different scan code from other keys, no special hardware involved. Power off support is just dependent on the OS watching for this scan code and triggering their normal shutdown dialog. Power on support involves the firmware watching for this scan code and treating it like the power button being pressed.

They've fallen out of favor as distinct keys on detatched keyboards for a couple of reasons:

  • Most users didn't really use them much. The primary use cases are either dealing with a computer where you can't easily get to the case to push the power button, or when you're dealing with a number of systems on a KVM switch that aren't always on, and neither is a common case (especially since a lot of people these days suspend to RAM instead of actually shutting down, so they don't often need to hit the power button anyway).
  • It takes up extra space. On something bit like the Logitech Wave Ergonomic Keyboard I'm using to type this, there's some extra room that can be used because of how the keys are arranged, but for the compact designs that most people tend to prefer (especially tenkeyless designs), there's often not much in the way of space space for extra keys (though maybe they could add it as a chorded key sequence with the Fn key in some cases).
  • For USB devices, there's a non-negligible power draw and extra control logic required to support this. USB is really power hungry on average (that's part of why a lot of x86 laptops still use PS/2 internally for the keyboard and trackpad connections instead of USB (though some are shifting to I²C for similar reasons)) and it's a much more complex protocol as well (you can't just watch for a specific signal sequence on the lines, you have to actually talk to the device). This makes using this with USB devices somewhat impractical due to the power draw and logic requirements.

Note, however, that some firmware implementations do support other key sequences for power on. A number of the systems where I used to work would accept Ctrl+Space to trigger a power on for example (though they required other methods for shut down).

| improve this answer | |
  • 1
    Excellent answer. I want to add that I believe power buttons were removed from keyboards due to a few other reasons. First is accidental shutdowns. I have seen people accidentally press the power button on the keyboard and turn off their computer. Additionally, media/extra keys are rarely used by the general public. People are so used to the standard 104 key keyboard, that they do not even remember the extra keys are there. – Keltari Jul 24 at 2:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.