TransWikia.com

Power button on USB keyboards?

Super User Asked on December 3, 2021

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.

One Answer

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).

Answered by Austin Hemmelgarn on December 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP