acpi_dev_present(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… acpi_dev_present(9) β€” bestie's guide to the Kernel API Manual ✨

okay so real talk, this is a page from the Kernel API Manual and it's about acpi_dev_present(9), which lowkey does exactly what it says on the tin 🫢


✨ NAME ✨

acpi_dev_present β€” detect that a given ACPI device is present πŸ‘€βœ¨


🌸 SYNOPSIS 🌸

bool acpi_dev_present (const char *hid , const char *uid , s64 hrv );

like, that's the whole vibe. three args, one bool, no drama πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • hid β€” the Hardware ID of the device. the main character identifier fr πŸ”₯
  • uid β€” the Unique ID of the device. if you don't wanna check _UID, just pass NULL and keep it moving πŸ™ˆ
  • hrv β€” the Hardware Revision of the device. don't care about _HRV? pass -1 and slay πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: it returns true if a matching device was present at the moment of invocation. at the moment. like right then. ⏰

⚠️ heads up bestie: if the device is pluggable, it may have disappeared since then. it's giving "you blinked and it was gone" 😭 do NOT treat that true as a forever-promise.

also, this is not the same as acpi_dev_found β€” this one actually checks the status of the device. so for devices that are present in the DSDT but are disabled (their _STA callback returns 0), this function will return false. no cap, that's a whole different vibe check πŸ’…

for this function to work, acpi_bus_scan must have been executed, which happens in the subsys_initcall subsection. so:

  • 🚫 do not call from a subsys_initcall or earlier (use acpi_get_devices instead, king behavior πŸ‘‘)
  • βœ… calling from module_init is totally fine β€” it's synonymous with device_initcall, iykyk

🌈 SEE ALSO 🌈

the kernel file ./drivers/acpi/utils.c and honestly a whole friend group of functions:


and that's the whole page, bestie 🧚 no crumbs left, every single reference accounted for, periodt πŸ’œ

sign-off time πŸŽ€ this one lives in ./drivers/acpi, dated October 2026 β€” go check the device, have fun, don't call it too early, ily πŸ’–βœ¨

πŸ“¦ where this page comes from