Skip to content

Dell LCD Display

Dell LCD Display control from shell.

#!/bin/bash

# Max length the LCD can accept. Typically 62
MAXLENGTH=62

# Read from first argument if present, else take first line of stdin
if [ $# -lt 1 ]; then
	read INPUT
	INPUT=$(echo $INPUT | tr -d [:cntrl:])
else
	INPUT=$(echo $1 | tr -d [:cntrl:])
fi

# Check if we respected the max length after removing control chars
if [ ${#INPUT} -gt $MAXLENGTH ]; then
	echo "Cannot use more than $MAXLENGTH characters"
	exit 1
fi

# Split by bytes and encode them as hex strings (0xff)
BYTES=$(echo -n $INPUT | od --width=1 -v -t x1 | grep " " |
	awk '{print $2}' | awk '{print "0x"$1}')

# Encode length of string as hex digit also
LENGTH=$(printf "0x%x" ${#INPUT})

# Go through all bytes, grouping them by chunk of 16 bytes
i=3
CMD="0x0 0x0 $LENGTH"
LINES=()
for BYTE in $BYTES; do
	# Chunk ready, append it to array and reset counters
	if [ $i -gt 16 ]; then
		LINES[${#LINES[*]}]="$CMD"
		CMD=$(printf "0x%x" ${#LINES[*]})
		i=1
	fi

	# Push byte on accumulator
	CMD="$CMD $BYTE"
	let i+=1
done

# Put last chunk into array
LINES[${#LINES[*]}]="$CMD"

# Tell BMC text to print on LCD, chunk by chunk
for i in "${LINES[@]}"; do
	/usr/bin/ipmitool raw 0x6 0x58 0xc1 $i > /dev/null
done

# Tell BMC to output our User String on LCD
/usr/bin/ipmitool raw 0x6 0x58 0xc2 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 > /dev/null


Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Form options