Lenovo Yoga 720: Software bypass for the "Lid-Closed" reboot hang
if you're using a Yoga 720 as a headless server, you've probably dealt with the BIOS hanging on reboot if the lid has been shut for a while.
I poked around the forums and and eventually landed on the Embedded Controller memory as the problem and found the lid status register at offset 0xB8.
0x02 = Closed (reboot hangs after ~15 mins)
0x00 = Open (reboot works)
The EC on this model is event-driven and doesn't seem to re-poll the physical hall sensor unless the lid actually moves or you pass a magnet over it, how i found this out. If you manually flip the register to 00, it stays there. Since EC memory persists through a warm reset, the BIOS thinks the lid is open and allows the POST.
To fix it:
Load ec_sys with write support:
sudo modprobe ec_sys write_support=1
Set the register to open:
printf '\x00' | sudo dd of=/sys/kernel/debug/ec/ec0/io bs=1 seek=$((0xB8)) count=1 conv=notrunc
I just have this run once on boot. As long as the lid stays shut, the value holds, and remote reboots work every time.