Skip to content

Commit

Permalink
Add graphics card information to hardware inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
rluzuriaga authored Sep 4, 2024
1 parent c023872 commit 0efdd68
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.inventory
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[[ $deployed -eq 1 ]] && . /bin/fog.checkin
getHardDisk
doInventory
gpu_array_length=${#graphics_vendors_array[@]}
if [[ -z $1 ]]; then
echo -e "\n\n\n"
echo " +---------------------------+"
Expand Down Expand Up @@ -81,9 +82,19 @@ if [[ -z $1 ]]; then
echo "$caseserial"
dots "Case Asset Number:"
echo "$caseasset"
usleep 1000000
echo " +---------------------------+"
echo " | GPU Information |"
echo " +---------------------------+"
for (( i=0; i<$gpu_array_length; i++ )); do
dots "GPU-$i Manufacturer:"
echo ${graphics_vendors_array[$i]}
dots "GPU-$i Product:"
echo ${graphics_products_array[$i]}
done
echo -e "\n\n\n"
fi
poststring="mac=${mac}&sysman=${sysman64}&sysproduct=${sysproduct64}&sysversion=${sysversion64}&sysserial=${sysserial64}&sysuuid=${sysuuid64}&systype=${systype64}&biosversion=${biosversion64}&biosvendor=${biosvendor64}&biosdate=${biosdate64}&mbman=${mbman64}&mbproductname=${mbproductname64}&mbversion=${mbversion64}&mbserial=${mbserial64}&mbasset=${mbasset64}&cpuman=${cpuman64}&cpuversion=${cpuversion64}&cpucurrent=${cpucurrent64}&cpumax=${cpumax64}&mem=${mem64}&hdinfo=${hdinfo64}&caseman=${caseman64}&casever=${casever64}&caseserial=${caseserial64}&caseasset=${caseasset64}"
poststring="mac=${mac}&sysman=${sysman64}&sysproduct=${sysproduct64}&sysversion=${sysversion64}&sysserial=${sysserial64}&sysuuid=${sysuuid64}&systype=${systype64}&biosversion=${biosversion64}&biosvendor=${biosvendor64}&biosdate=${biosdate64}&mbman=${mbman64}&mbproductname=${mbproductname64}&mbversion=${mbversion64}&mbserial=${mbserial64}&mbasset=${mbasset64}&cpuman=${cpuman64}&cpuversion=${cpuversion64}&cpucurrent=${cpucurrent64}&cpumax=${cpumax64}&mem=${mem64}&hdinfo=${hdinfo64}&caseman=${caseman64}&casever=${casever64}&caseserial=${caseserial64}&caseasset=${caseasset64}&gpuvendors=${inventory_graphics_vendor64}&gpuproducts=${inventory_graphics_product64}"
count=0
res=""
while [[ -z $res ]]; do
Expand Down
18 changes: 18 additions & 0 deletions Buildroot/board/FOG/FOS/rootfs_overlay/usr/share/fog/lib/funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,26 @@ verifyNetworkConnection() {
validResizeOS() {
[[ $osid != @([1-2]|4|[5-7]|9|10|11|50|51) ]] && handleError " * Invalid operating system id: $osname ($osid) (${FUNCNAME[0]})\n Args Passed: $*"
}
# Gets the graphics information from the system
getGraphics() {
local graphics_info=$(lshw -json -C display | jq -r '.[] | select(.vendor != null) | "\(.vendor),\(.product)"')

graphics_vendors_array=()
graphics_products_array=()
while IFS=',' read -r vendor product; do
graphics_vendors_array+=("$vendor")
graphics_products_array+=("$product")
done <<< "$graphics_info"

inventory_graphics_vendor=$(IFS=,; echo "${graphics_vendors_array[*]}")
inventory_graphics_product=$(IFS=,; echo "${graphics_products_array[*]}")

inventory_graphics_vendor64=$(echo "$inventory_graphics_vendor" | base64)
inventory_graphics_product64=$(echo "$inventory_graphics_product" | base64)
}
# Gets the information from the system for inventory
doInventory() {
getGraphics
sysman=$(dmidecode -s system-manufacturer)
sysproduct=$(dmidecode -s system-product-name)
sysversion=$(dmidecode -s system-version)
Expand Down

0 comments on commit 0efdd68

Please sign in to comment.