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.
Post Reply
mikeb
Expert
Posts: 1036
Joined: Thu Sep 28, 2006 10:20 am
x 2

Tuner locking via hdhomerun_config

Post by mikeb »

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!

Post by Digital Corpus »

Thank you for supporting the efforts of the few!

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

Post by Mac The Knife »

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

Post by perlguy »

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]

sdust
Posts: 169
Joined: Sat Jun 05, 2021 3:39 am
x 1

Re: Tuner locking via hdhomerun_config

Post by sdust »

Anybody using this functionality or just pulling streams via http?

nickk
Silicondust
Posts: 20156
Joined: Tue Jan 13, 2004 9:39 am
x 374

Re: Tuner locking via hdhomerun_config

Post by nickk »

Pretty much everything is http these days... it handles everything automatically.

Nick

Post Reply