try to look into "/proc/acpi/button/lid/LID/state" to get the LID state. Path may be different on pyra, I don't know.