Each tuner can be locked individually; tuner0's lock is controlled through /tuner0/lockkey.
Code: Select all
hdhomerun_config FFFFFFFF set /tuner0/lockkey $KEY
hdhomerun_config FFFFFFFF key $KEY set /tuner0/channel 128
hdhomerun_config FFFFFFFF key $KEY set /tuner0/program 3
hdhomerun_config FFFFFFFF key $KEY save /tuner0 capture.ts
hdhomerun_config FFFFFFFF key $KEY set /tuner0/lockkey none
Once the lockkey has been set, any "set" command that isn't signed with the key will return a "resource locked" error, preventing other applications from changing the tuner status; "get" commands are still allowed and do not need to be signed.
The lockkey will expire automatically if the tuner is left idle (no recent commands, not streaming video). The lockkey can be cleared without the key by using a set command to set the lockkey to "force". The force command should not be used without prompting the user for confirmation.
Tuner locking can be used to implement dynamic tuner allocation:
- generate a random key
- attempt to set lockkey to random key
- if lockkey returned an error, proceed to the next tuner
- set channel/target, signing the set commands with the key
- when finished with the tuner, lockkey is set to "none"