Hardware Information and Status¶
The hardware infomation and status is handled by the YANG model IETF hardware, with deviations and augmentations in infix-hardware.
Sensors¶
Temperature, fan, voltage, current, and power readings are components of
class sensor, one per reading. A sensor name is a list key and nothing
more: what a sensor measures follows from the component it belongs to,
named by its parent. Clients must select on class, never on names,
which vary with the SoC, the driver, and the board.
The SoC die temperature, for instance, is any celsius sensor whose
parent has class cpu:
with parent resolving to the component of class iana-hardware:cpu.
An SoC reporting several dies or clusters yields several such sensors,
and the hottest is the one to report. Over RESTCONF:
Which hwmon device or thermal zone belongs to which component is decided when the data is collected, and is the only place platform specific names are recognized.
Locate¶
To find a chassis, e.g., in a rack, its LEDs can be set to blink. Which LEDs blink, and how, depends on the device. Locate stops by itself after 60 seconds, unless another duration is given, or when stopped.
admin@example:/> locate
admin@example:/> locate duration 300
admin@example:/> locate stop
admin@example:/> no locate
The CLI commands call the infix-hardware:locate RPC, which takes
enable and duration, in seconds. Over RESTCONF:
curl -su admin:admin -X POST -H "Content-Type: application/yang-data+json" \
-d '{"infix-hardware:input": {"duration": 300}}' \
https://example/restconf/operations/infix-hardware:locate
The web interface has a Locate button on the Hardware page.
Users in the admin and operator NACM groups may call locate, guest
users may not. On systems where LED control is disabled, the LEDs keep
their hardware default behavior and the RPC fails with LED control is
not available on this device.
GPS/GNSS Receivers¶
Infix supports GPS/GNSS receivers for hardware status monitoring and NTP
time synchronization. USB GPS receivers using the USB ACM interface are
supported (e.g., u-blox). When connected, devices are automatically
discovered and named gps0, gps1, etc.
Current status¶
admin@example:/> show hardware
HARDWARE COMPONENTS
──────────────────────────────────────────────────────────────
GPS/GNSS Receivers
Name : gps0
Device : /dev/gps0
Driver : u-blox
Status : Active
Fix : 3D
Satellites : 10/15 (used/visible)
Position : 59.334567N 18.063456E 42.3m
PPS : Available
Available information per receiver:
| Field | Description |
|---|---|
| Name | Component name (gps0, gps1, ...) |
| Device | Device path (/dev/gps0) |
| Driver | Protocol driver (e.g., u-blox, NMEA, SiRF) |
| Status | Active or Inactive |
| Fix | NONE, 2D, or 3D |
| Satellites | Used/visible count |
| Position | Latitude, longitude, altitude (when fix acquired) |
| PPS | Pulse Per Second signal availability |
Configure GPS receiver¶
GPS receivers are hardware components with class gps. The class is
auto-inferred from the component name, similar to WiFi radios (radioN):
admin@example:/> configure
admin@example:/config/> set hardware component gps0
admin@example:/config/> leave
Anchor a GPS receiver to a USB port¶
Receivers are numbered in the order they are found, so with more than one the names can swap between boots. Anchor each receiver to the USB device it is plugged into and it keeps its name. The detail view of a receiver shows the URI of its device, copy it into the configuration:
admin@example:/> show hardware gps0
COMPONENT: gps0
Name : gps0
Class : gps
Parent : usb-1-1.2
URI : usb:///sys/bus/usb/devices/1-1.2
admin@example:/> configure
admin@example:/config/> edit hardware component gps0
admin@example:/config/hardware/component/gps0/> set uri usb:///sys/bus/usb/devices/1-1.2
admin@example:/config/hardware/component/gps0/> leave
A device with several serial ports, e.g. a cellular modem with an NMEA
port, is anchored by that port's interface: append the interface
number to the URI, usb:///sys/bus/usb/devices/1-1.2:1.1 for
interface 1.
To use a GPS receiver as an NTP reference clock source, see NTP — GPS Reference Clock.
USB Ports¶
For Infix to be able to control USB port(s), a device tree modification is needed (see alder.dtsi for full example).
Two USB ports are also exposed in QEMU for test purpose.
All USB ports in the system will be disabled during boot due to the file
board/common/rootfs/etc/modprobe.d/usbcore.conf. If you do not want
Infix to control USB port(s), remove the file or manually enable the USB
bus, here is an example:
And then enable sub-devices (e.g. USB memory)
Current status¶
admin@example:/> show hardware
HARDWARE COMPONENTS
──────────────────────────────────────────────────────────────
Board Information
Model : FriendlyElec NanoPi R2S
Manufacturer : FriendlyElec
Serial Number : 9d1fbfdab6d171ce
Base MAC Address : 4a:dc:d8:20:0d:85
──────────────────────────────────────────────────────────────
USB Ports
NAME STATE OPER
usb unlocked enabled
──────────────────────────────────────────────────────────────
Attached USB Devices
PORT BUS VID:PID SPEED AUTHORIZED DESCRIPTION
usb 1-1 05e3:0610 480M yes GenesysLogic USB2.1 Hub
usb 1-1.2 0781:5581 5G yes SanDisk Ultra
──────────────────────────────────────────────────────────────
Sensors
NAME VALUE STATUS
soc 44.1 °C ok
soc 44.5 °C ok
An USB port can be in two states unlocked and locked. When a port is locked, all connected devices will get power, but never authorized by Linux to use.
Every device plugged into a port is listed under Attached USB Devices, also
when it sits behind a hub, and also when the port is locked. On a
locked port the device shows no in the AUTHORIZED column: the system
sees it, but it cannot be used. The exception is a hub plugged into a
port that is already locked: the hub is listed, the devices behind it
only once the port is unlocked. BUS is the device's position:
1-1.2 is port 2 of the hub plugged into the USB port.
The port and each device have a detail view with everything known
about them. The URI of a device is its attachment point, which is
what a component configuration, e.g. a modem, is anchored to with
set uri:
admin@example:/> show hardware usb
COMPONENT: usb
Name : usb
Class : usb
Admin State : unlocked
Oper State : enabled
Usage State : active
──────────────────────────────────────────────────────────────
Attached USB Devices
URI VID:PID SPEED AUTHORIZED DESCRIPTION
usb:///sys/bus/usb/devices/1-1 05e3:0610 480M yes GenesysLogic USB2.1 Hub
usb:///sys/bus/usb/devices/1-1.2 0781:5581 5G yes SanDisk Ultra
admin@example:/> show hardware usb-1-1.2
COMPONENT: usb-1-1.2
Name : usb-1-1.2
Class : usb-device
Parent : usb
Model : Ultra
Manufacturer : SanDisk
Serial Number : 4C530001230920115031
Hardware Rev : 1.00
USB ID : 0781:5581
USB Version : 3.20
Speed : 5000 Mbit/s
Authorized : yes
URI : usb:///sys/bus/usb/devices/1-1.2
Interface 0 : mass-storage
A USB 3 port is one port, whether the device runs at USB 2 or USB 3 speed. Locking it locks both.
The same information is available over NETCONF and RESTCONF. Each
device is a hardware component of class infix-hardware:usb-device
whose parent is the USB port and whose uri is the attachment
point. A WiFi radio, GPS receiver or cellular modem on USB has the
device it lives on as its parent.
Configure USB port¶
Note
You can only configure USB ports known to the system. See the CLI
command show hardware in admin-exec context. (Use do prefix in
configure context.)
admin@example:/> configure
admin@example:/config/> set hardware component usb state admin-state unlocked
admin@example:/config/> leave
admin@example:/>
Using a USB Stick¶
With the USB port unlocked, a memory stick can be used to expand the
storage of the device. Plug it in, either directly, or via a USB hub.
All partitions of VFAT or exFAT type are automatically mounted to
the /media/<LABLEL> directory, e.g., /media/memorystick, or if a
partition does not have a label, using the kernel device name, e.g.,
/media/sda.
Depending on the partition type the the media is either mounted in
flush or sync mode to ensure files are properly flushed to the
backing store of the memory stick. This to protect against users
yanking out a device before file(s) have been written to it.
The only way currently to safely "eject" a USB memory stick is to use
umount command from a UNIX shell, which explicitly synchronizes any
cached data to disk before returning the prompt:
admin@example:~$ sudo umount /media/log