Reference: memfault-device-info
Useful links:
Purpose of memfault-device-info
memfault-device-info
is a program that memfaultd
depends on to retrieve
static information about the device it is running on. When memfaultd
(or
memfaultctl
) runs, it will execute memfault-device-info
and parse the output
to collect this information.
As an integrator, you will need to implement this program and make it available
on the PATH
of the memfaultd
process. (By default on Yocto for systemd
units, this is /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
).
Implementing memfault-device-info
-
When executed,
memfault-device-info
should print out the device's unique identifier (for example, its serial number) and its Hardware Version in the following format:MEMFAULT_DEVICE_ID=<device identifier>
MEMFAULT_HARDWARE_VERSION=<Hardware Version>For example, an output might look like this:
MEMFAULT_DEVICE_ID=1234-example-serial
MEMFAULT_HARDWARE_VERSION=thingy-evt2 -
The
MEMFAULT_DEVICE_ID
value should be unique to the device. It should not change over the lifetime of the device. The value must be between 1 and 128 characters long and can only contain the following characters:a-z
,A-Z
,0-9
,-
and_
. IfMEMFAULT_DEVICE_ID
is not set bymemfault-device-info
,memfaultd
will default to the value in/etc/machine-id
. -
The
MEMFAULT_HARDWARE_VERSION
value should be a string that identifies the Hardware Version of the device. It should not change over the lifetime of the device. See this page for more details and examples. IfMEMFAULT_HARDWARE_VERSION
is not set bymemfault-device-info
,memfaultd
will default to the output of the commanduname -n
.
From Linux SDK 1.8.0 on, memfault-device-info
can also override the following
values that are set in memfaultd.conf
:
- Software Version: can be set with
MEMFAULT_SOFTWARE_VERSION
- Software Type: can be set with
MEMFAULT_SOFTWARE_TYPE
Testing
To test whether you have correctly implemented memfault-device-info
, you can
run memfaultctl show-settings
on the device. This will print out the device
info that memfaultctl
has parsed and collected from memfault-device-info
:
$ memfaultctl show-settings
...
Device configuration from memfault-device-info:
MEMFAULT_DEVICE_ID=1234-example-serial
MEMFAULT_HARDWARE_VERSION=thingy-evt2
...