macOS WebHID playground

Apple silicon MacBooks route several built-in sensors through an always-on sensor coprocessor that shows up as a set of HID devices. Three of them stream data without any native help, so a web page can read them with WebHID.

Lid angle

Pick las in the device chooser, then move the lid.

–°

Session min
–
Session max
–
State
–
Report layout

A standard HID sensor (usage page 0x20, usage 0x8A, hinge angle). Input report 1 holds a 9-bit angle in whole degrees, 0 to 360, at about 10 reports per second. It reads 0 when the lid is closed.

–

Ambient light

Pick als in the device chooser, then cover the area next to the camera or shine a light at it.

–lux

–
Color temperature (likely)
Report layout

Vendor usage page 0xFF00, usage 0x04, a 122-byte report at about 10 per second. Bytes 20 to 39 are five raw light channels (32-bit integers), byte 40 is lux (32-bit float), and byte 69 is a float that tracks color temperature in kelvin.

–

Motion state

Pick cma in the device chooser, then lift or nudge the laptop.

Not connected
Pickups
0
Still since
–
Last moved for
–
    Report layout

    Vendor usage page 0xFF0C, usage 0x01, 5-byte event reports. A report starting with 03 arrives every 2.5 seconds and whenever the state changes. Its last byte is 01 while the laptop is still, 04 while it is moving right now, and 02 for a few seconds after motion pauses, before it drops back to 01. A report starting with 50 marks the change, with a non-zero payload when motion starts. Other report types also arrive and are not yet understood. The descriptor declares report ID 0, which some Chrome versions treat as a real report ID, stripping the first byte into reportId; the page puts it back.

    –