The HW Info API provides access to hardware information such as device identifiers.
Hardware Information Interface.
hwinfo_get_device_id(uint8_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.
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.