Skip to main content

I need to setup extension attribute to monitor for bad display dongles.
Using fitHeadless4k display dongles.



system_profiler SPDisplaysDataType shows both good and bad macs reporting the same "Display". However, the color profile on the bad macs is sRGB IEC61966-2.1 and the good macs is fitHeadless4k.

@keric The following is largely untested as I don't find a match for "color" in my output for system_profiler SPDisplaysDataType, so I searched for the display's serial number. Change "Display Serial Number" to your search term. (Remove set -x and set +x when you're done testing.) As always, YMMV.



#!/bin/bash

####################################################################
# An Extension Attribute to detect external display serial number. #
# If not applicable, "Not Applicable" will be returned. #
####################################################################

set -x

RESULT="Not Applicable"

displayTypeData=$( /usr/sbin/system_profiler SPDisplaysDataType )

displaySerialNumber=$( /bin/echo ${displayTypeData} | /usr/bin/grep "Display Serial Number" | /usr/bin/awk -F ': ' '{print $NF}' )

if [[ -n "${displaySerialNumber}" ]]; then
RESULT=${displaySerialNumber}
fi

echo "<result>$RESULT</result>"

set +x

exit 0

@dan-snelson Thanks so much had to change a few things this is what I ended up with using.



#!/bin/zsh

####################################################################
# An Extension Attribute to detect external display dongle. #
# If not present, "No" will be returned.#
####################################################################

RESULT="No"

displayTypeData=$( /usr/sbin/system_profiler SPDisplaysDataType | /usr/bin/grep "fit" )

displayinfo=$( /bin/echo ${displayTypeData} )

if [[ -n "${displayinfo}" ]]; then
RESULT="Yes"
fi

echo "<result>$RESULT</result>"

exit 0