add device rebooting, and improve file output