device_get_property(9)

device_get_property9

Access device specific data

Usage

#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);

Overview

Access device specific data provided by the parent bus. Drivers can use these properties to obtain device capabilities and set necessary quirks.

The underlying property type is specified with the type argument. Currently the following types are supported:

DEVICE_PROP_BUFFER

The underlying property is a string of bytes.

DEVICE_PROP_ANY

Wildcard property type.

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. The sz argument shall be a multiple of 4.

DEVICE_PROP_UINT64

The underlying property is an array of unsigned 64 bit integers. The sz argument shall be a multiple of 8.

Notes

You can pass NULL as pointer to property's value when calling device_get_property() to obtain its size.

Currently this interface is implemented by simplebus(4) and acpi(4).

Return values

device_get_property() if successful returns property's size, otherwise returns -1.

device_has_property() returns true if given property was found.

Releases

13 releases since FreeBSD 13.2-RELEASE; the text changed 1 time.

  1. 13.2
  2. 13.3–16.0

Authors

This manual page was written by Bartlomiej Grzesik.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.