Tuner locking via hdhomerun_config

Want to write your own code to work with a HDHomeRun or work with the HDHomeRun DVR? We are happy to help with concepts, APIs, best practices.
mikeb
Silicondust
Posts: 940
Joined: Thu Sep 28, 2006 10:20 am

Tuner locking via hdhomerun_config

Postby mikeb » Thu Mar 26, 2009 8:09 am

The latest beta adds support for using tuner locking via hdhomerun_config.

Each tuner can be locked individually; tuner0's lock is controlled through /tuner0/lockkey.

Code: Select all

KEY=$RANDOM
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"

Digital Corpus
Posts: 18
Joined: Mon Mar 10, 2008 3:11 am

w00t!

Postby Digital Corpus » Thu Mar 26, 2009 11:55 am

Thank you for supporting the efforts of the few!

Mac The Knife
Posts: 64
Joined: Mon Mar 02, 2009 12:15 pm

Postby Mac The Knife » Thu Mar 26, 2009 1:16 pm

Oh. that's pretty cool.

But everything is working so well for me that right now, that I'm afraid to flash new firmware (I hate mucking with anything that's working perfectly). I'll have to gather up some courage before I try it.

perlguy
Posts: 1
Joined: Thu Jul 12, 2012 5:27 pm

Re: Tuner locking via hdhomerun_config

Postby perlguy » Thu Jul 12, 2012 5:49 pm

mbm wrote:...

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"


I finally got my Perl routine working that uses the lockkey similarly to the above. However instead of using "random", I use a concatenation of: [1][last IP octet][PID]


Return to “Development Support”

Who is online

Users browsing this forum: No registered users and 0 guests