This is the documentation for the latest (master) development branch of Zephyr. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

Hardware Information

Overview

The HW Info API provides access to hardware information such as device identifiers.

Configuration Options

Related configuration options:

API Reference

group hwinfo_interface

Hardware Information Interface.

Functions

ssize_t hwinfo_get_device_id(u8_t *buffer, size_t length)

Copy the device id to a buffer.

This routine copies “length” number of bytes of the device ID to the buffer. If the device ID is smaller then length, the rest of the buffer is left unchanged. The ID depends on the hardware and is not guaranteed unique.

Drivers are responsible for ensuring that the ID data structure is a sequence of bytes. The returned ID value is not supposed to be interpreted based on vendor-specific assumptions of byte order. It should express the identifier as a raw byte sequence, doing any endian conversion necessary so that a hex representation of the bytes produces the intended serial number.

Parameters
  • buffer: Buffer to write the ID to.

  • length: Max length of the buffer.

Return Value
  • size: of the device ID copied.

  • -ENOTSUP: if there is no implementation for the particular device.

  • any: negative value on driver specific errors.