DEVICE_GET_PROPERTY(9)
π device_get_property β access device specific data π
okay so bestie, we're in section 9 of the Kernel Developer's Manual today (that's the DEVICE_GET_PROPERTY(9) one, yes ma'am π) and it's literally all about peeking at the device-specific data your parent bus handed you. no cap, it's giving "backstage pass to the hardware" energy.
β¨ NAME β¨
device_get_property, device_has_property β access device specific data π«Ά
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/bus.h>
ssize_t
device_get_property(device_t dev, const char *prop, void *val,
size_t sz, device_property_type_t type);
bool
device_has_property(device_t dev, const char *prop);
look at those two little icons, so clean, so demure π
π¦ DESCRIPTION π¦
So the whole vibe here is: you get access to device specific data that the parent bus provides. Drivers can use these properties to obtain device capabilities and set necessary quirks. like, the bus is your bestie and it's handing you the tea π΅
You tell it what kind of data you're expecting with the type argument. Currently the following types are supported:
DEVICE_PROP_BUFFERβ the underlying property is a string of bytes. literally just bytes, iconic β¨DEVICE_PROP_ANYβ wildcard property type. anything goes, main character energy πDEVICE_PROP_HANDLEβ following a reference, the underlying property is a handle of the respective bus.DEVICE_PROP_UINT32β the underlying property is an array of unsigned 32 bit integers. and heads up: theszargument shall be a multiple of4. that's not a suggestion bestie, that's the law π¨DEVICE_PROP_UINT64β the underlying property is an array of unsigned 64 bit integers. same deal, theszargument shall be a multiple of8. do the math or get wrecked π
π NOTES π
- You can pass
NULLas pointer to property's value when callingdevice_get_property()to obtain its size. cute little trick, zero-capitalism way to just ask "how big is it tho" π - Currently this interface is implemented by
simplebus(4)andacpi(4). those are the two that showed up to the party π
β RETURN VALUES β
device_get_property()β if successful returns property's size, otherwise returns-1. so either you get the size or you get the-1of shame πdevice_has_property()β returnstrueif given property was found. simple, honest, no drama πΈ
π₯ SEE ALSO π₯
acpi(4), simplebus(4), device(9)
π§ AUTHORS π§
This manual page was written by Bartlomiej Grzesik. absolute legend, ate and left no crumbs π
and that's the whole page bestie, no gatekeeping π this beauty came to you from the Debian fam, dated September 29, 2022 β so yeah, she's got a lil vintage moment going on, but the info is still slaying fr fr ππ¦β¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- π the page's license: BSD-2-Clause
- Copyright (c) 2021 Semihalf
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms