Skip to content

Commit

Permalink
feat: use lshw to detect model number if installed
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenmiller committed Dec 9, 2024
1 parent 2ad9b57 commit fde5672
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/scripts.d/50_c8y_Hardware
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ hardware_info_device() {
REVISION=$(grep "^Revision" /proc/cpuinfo | cut -d: -f2- | xargs)
SERIAL=$(grep "^Serial" /proc/cpuinfo | cut -d: -f2- | xargs)

if [ -z "$MODEL" ]; then
if command -V lshw >/dev/null 2>&1; then
# Example product: Sipeed Lichee RV Dock, licheerv
MODEL=$(lshw -C system 2>/dev/null | grep product | cut -d: -f2- | xargs)
fi
fi

echo "model=\"$MODEL\""
echo "revision=\"$HARDWARE-$REVISION\""
echo "serialNumber=\"$SERIAL\""
Expand Down

0 comments on commit fde5672

Please sign in to comment.