Recovered from the older tannerjc.net wiki snapshot dated January 23, 2016.

http://d4wiki.goddamm.it/index.php?title=Howto:_Mac_OSX_on_KVM

http://alex.csgraf.de/qemu/getkey

#!/bin/bash

APPLESMC=/sys/devices/platform/applesmc.*

if [ ! -e $APPLESMC/key_count ]; then
	echo please load the applesmc module.
	exit 1
fi

for i in $(seq `cat $APPLESMC/key_count`); do
	echo $i  $APPLESMC/key_at_index
	case $(cat $APPLESMC/key_at_index_name) in
	    OSK0)
		OSK0=$(cat $APPLESMC/key_at_index_data)
		;;
	    OSK1)
		OSK1=$(cat $APPLESMC/key_at_index_data)
		break
		;;
	esac
done

echo ${OSK0}${OSK1}