Osputil

From AwkwardTV

Jump to: navigation, search

What is osputil

osputil is a command-line program to control the LED. It is located at /usr/bin/osputil.

Usage

Usage: osputil:
               -v, --verbose
               -g, --getState=<m>
               -s, --setState=<m>:<n>
               -c, --clearState=<m>
               -l, --setLED=<l>:<b>
               -f, --setFan=<m>
               -z, --zapNVRAM

       m is one of:
               0: kOSPResetReason      state is an OSPResetReason determined by combining NVRAM, IR micro, and RTC state
               1: kOSPRemote   state is 0/1 indicating a remote-triggered reset
               2: kOSPBootCount        state is an integer [0-15] indicating the boot count value
               3: kOSPNVRAMMaxBootAttempts     state is an integer [0-15] indicating the maximum allowed number of boot attempts (stored in NVRAM in max-boot-attempts)
               4: kOSPNVRAMResetReason state is an OSPResetReason indicating the value stored in NVRAM in os-reset-reason

       n is one of the values indicated above; when n is an OSPResetReason, it is one of:
               1: kOSPUserReset        user-initiated reset (magic key pressed)
               2: kOSPFailedToBootReset        EFI-initiated reset (repeated panics or errors)
               3: kOSPUpdateReset      reset to update the OS
               4: kOSPFactoryRestoreReset      user requested a factory restore from the settings menu

       l is one of:
               3: kOSPLEDAmber
               4: kOSPLEDWhite
               5: kOSPLEDBrightness
               6: kOSPLEDError blink white and amber

       b is one of:
               0: kOSPOff
               1: kOSPOn
               2: kOSPBlink    not supported for kOSPBrightness or kOSPLEDError


Problems Caused By This

Booting to any other OS other then ATV will not reset the boot count back to 0. This is easy to fix if you are running OSXonATV. Copy /usr/bin/osputil to your OSX install then put in /etc/rc.local

osputil --clearState=2


We need someone to disassemble this application and determine how we can change these same values from Linux. Otherwise when the max boot count is reached the atv will always boot to recovery. The only workaround is to raise the max boot count to 15.

osputil --setState=3:15


If you are comfortable with not being able to boot into atvos/recovery then you can simply rename the mach_kernel.prelink file on these partitions so that it does not try to boot from here anymore.

Personal tools