#!/bin/bash

sensors=$(test-sensors | grep 'type: '| awk '{print $2}' | sort)

sensors_map=$(cat <<EOF
        Acc: accelerometer
        Mag: magnetic field
        Ori: orientation
        Gyr: gyroscope
        Lux: light
        Bar: pressure
        Tmp: temperature
        Prx: proximity
        Grv: gravity
        Lac: linear acceleration
        Rot: rotation vector
        Hum: relative humidity
        Tam: ambient temperature
EOF
)


echo "These sensors are present on this system:"

for x in $sensors; do
    echo "$sensors_map" | grep -e "$x:"
    sensors_map=$(echo "$sensors_map" | grep -v -e "$x:")
done

if test -n "$sensors_map"; then
    echo
    echo "These sensors are not found on this system:"
    echo "$sensors_map"
fi

exit 0
