Reference

device_get_property(9)

access device specific data

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

DESCRIPTION

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.

SEE ALSO

acpi(4), simplebus(4), device(9)

AUTHORS

This manual page was written by Bartlomiej Grzesik.

History