home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
DirectTV SHEF IP Control Plugin for TVServer
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="sjevtic" data-source="post: 947179" data-attributes="member: 118214"><p>I did a bit of investigating, and as it turns out, I was never able to reproduce the problem when manually sending HTTP requests to the STB in my web browser. Moreover, the results I got when doing so <em>exactly</em> matched those produced by TV Server and the DirecTV SHEF IP plugin--the only thing appreciably different was the timing. I was a bit surprised by the gratuitous power on request as well, but more on that in a bit. I was also surprised to see the order of SHEF-related events in my TV-Server log:</p><p>[code]</p><p>2012-12-22 10:04:00.261748 [(26)]: DirecTV_SHEF - DirecTV_SHEF_OnTvServerEvent(): Changing Channel - Card Id = 1, Channel = 11 (11 WTTWDT), Video Source: YRYBYInput1</p><p>2012-12-22 10:04:01.219803 [(26)]: DirecTV_SHEF - DirecTV_SHEF_OnTvServerEvent(): Power on receiver - Card Id = 1</p><p>[/code]</p><p> </p><p>Apparently, the TV-Server generated a channel change event prior to powering on the receiver. That seems counter-intuitive, but apparently that's just how things go. Also interesting is the author's comment in the channel change event handler:</p><p>[code]</p><p>// We must send a power on command since the TVE doesn't send a start timeshifting until after the channel is successfully tuned.</p><p>[/code]</p><p> </p><p>So, apparently the TV-Server doesn't send a power on event until after the channel change event, but yet requires that the signal be received before the channel change is considered complete. That seems to be a bit of a chicken and egg problem, so the author of the DirecTV SHEF IP plugin responded by sending a power-on request right before the channel change request. That explains the seemingly gratuitous power on request I saw in my WireShark logs.</p><p> </p><p>So, I set out to experiment, and this is what I came up with (right file is my patched version, left file is original DirecTV SHEF IP plugin v1.2):</p><p>[code]</p><p>Left file: M:\DirecTV_SHEF 1.2\src\DirecTV_SHEF.cs</p><p>Right file: M:\DirecTV_SHEF\src\DirecTV_SHEF.cs</p><p>46a47,48</p><p>> internal static bool[] DelayNeeded = new bool[4] { true, true, true, true };</p><p>> internal const int DelayTime = 1000;</p><p>156,157c158,159</p><p>< Log.Debug("DirecTV_SHEF - DirecTV_SHEF_OnTvServerEvent(): Power on receiver - Card Id = {0}",</p><p>< tvEvent.Card.Id);</p><p>---</p><p>> //Log.Debug("DirecTV_SHEF - DirecTV_SHEF_OnTvServerEvent(): Power on receiver - Card Id = {0}",</p><p>> // tvEvent.Card.Id);</p><p>159c161</p><p>< SendDTVCommand("remote/processKey?key=poweron", tvEvent.Card.Id);</p><p>---</p><p>> //SendDTVCommand("remote/processKey?key=poweron", tvEvent.Card.Id);</p><p>173a176,181</p><p>> if (DelayNeeded[tvEvent.Card.Id - 1])</p><p>> {</p><p>> Log.Debug("DirecTV_SHEF - Starting {0}ms receiver sanity delay because it was probably off", DelayTime);</p><p>> System.Threading.Thread.Sleep(DelayTime);</p><p>> DelayNeeded[tvEvent.Card.Id - 1] = false;</p><p>> } </p><p>184a193</p><p>> DelayNeeded[tvEvent.Card.Id - 1] = true;</p><p>[/code]</p><p> </p><p>Basically, what I did was add a one second delay between the power on request and the channel change when it appears that the receiver is starting from the off state. One second seems like a lot, but on my setup, 500ms sure didn't work. In addition, I got rid of the power on request associated with the similarly-named TV-Server event since it appeared unnecessary considering that a channel change request will always precede it, and by necessity, that will include a power on request for the STB as well.</p><p> </p><p>I thought about adding the delay flags as members of the DirecTV_Receiver objects. That would have been the truly OO-ish way to do this, but I gave up on that since the DirecTV_Receiver objects aren't all nicely stored in an array making them easy to access.</p><p> </p><p>As an additional optimization, I could have avoided performing the the power on request if the receiver is already on, but I don't have a good and easy way of truly <em>knowing</em> that, and making an incorrect assumption would cause an ugly mess when trying to start TV with the receiver off. I did, however, avoid needlessly performing the delay if I <em>believe</em> the receiver is already on. That prevents the average-case channel change from becoming slower, and even if I get it wrong (e.g., because the receiver's front panel switch was used), the worst consequence is an <em>occasional</em> slow channel change or coming up with the wrong channel.</p><p> </p><p>Is this approach reasonable? Is there a better way to make this work? Sadly, I don't have any logs or Wireshark traces from my old MP 1.2.3 setup. I'm kind of curious how this all managed to work before, but given that DirecTV is always messing around with their receiver firmware (and you don't get a choice regarding upgrades), it's anybody's guess as to what happened. I've attached my DirecTV_SHEF.cs in case anyone wants to take this for a spin--just drop it in over the original and rebuild. If the response is positive, I'd be happy to post a new "official" build of the plugin.</p><p> </p><p>In summary, I think there are two issues here that got us here:</p><ul> <li data-xf-list-type="ul">TV-Server sends a channel change event before sending a power on event. There may be architectural reasons for this that I don't understand.</li> <li data-xf-list-type="ul">The DirecTV STB cannot tolerate a power on request immediately followed by a channel change request, but <u>only when the STB is starting out in the off state</u>. This is almost certainly a bug in the DirecTV STB firmware.</li> </ul><p>Sasha</p></blockquote><p></p>
[QUOTE="sjevtic, post: 947179, member: 118214"] I did a bit of investigating, and as it turns out, I was never able to reproduce the problem when manually sending HTTP requests to the STB in my web browser. Moreover, the results I got when doing so [I]exactly[/I] matched those produced by TV Server and the DirecTV SHEF IP plugin--the only thing appreciably different was the timing. I was a bit surprised by the gratuitous power on request as well, but more on that in a bit. I was also surprised to see the order of SHEF-related events in my TV-Server log: [code] 2012-12-22 10:04:00.261748 [(26)]: DirecTV_SHEF - DirecTV_SHEF_OnTvServerEvent(): Changing Channel - Card Id = 1, Channel = 11 (11 WTTWDT), Video Source: YRYBYInput1 2012-12-22 10:04:01.219803 [(26)]: DirecTV_SHEF - DirecTV_SHEF_OnTvServerEvent(): Power on receiver - Card Id = 1 [/code] Apparently, the TV-Server generated a channel change event prior to powering on the receiver. That seems counter-intuitive, but apparently that's just how things go. Also interesting is the author's comment in the channel change event handler: [code] // We must send a power on command since the TVE doesn't send a start timeshifting until after the channel is successfully tuned. [/code] So, apparently the TV-Server doesn't send a power on event until after the channel change event, but yet requires that the signal be received before the channel change is considered complete. That seems to be a bit of a chicken and egg problem, so the author of the DirecTV SHEF IP plugin responded by sending a power-on request right before the channel change request. That explains the seemingly gratuitous power on request I saw in my WireShark logs. So, I set out to experiment, and this is what I came up with (right file is my patched version, left file is original DirecTV SHEF IP plugin v1.2): [code] Left file: M:\DirecTV_SHEF 1.2\src\DirecTV_SHEF.cs Right file: M:\DirecTV_SHEF\src\DirecTV_SHEF.cs 46a47,48 > internal static bool[] DelayNeeded = new bool[4] { true, true, true, true }; > internal const int DelayTime = 1000; 156,157c158,159 < Log.Debug("DirecTV_SHEF - DirecTV_SHEF_OnTvServerEvent(): Power on receiver - Card Id = {0}", < tvEvent.Card.Id); --- > //Log.Debug("DirecTV_SHEF - DirecTV_SHEF_OnTvServerEvent(): Power on receiver - Card Id = {0}", > // tvEvent.Card.Id); 159c161 < SendDTVCommand("remote/processKey?key=poweron", tvEvent.Card.Id); --- > //SendDTVCommand("remote/processKey?key=poweron", tvEvent.Card.Id); 173a176,181 > if (DelayNeeded[tvEvent.Card.Id - 1]) > { > Log.Debug("DirecTV_SHEF - Starting {0}ms receiver sanity delay because it was probably off", DelayTime); > System.Threading.Thread.Sleep(DelayTime); > DelayNeeded[tvEvent.Card.Id - 1] = false; > } 184a193 > DelayNeeded[tvEvent.Card.Id - 1] = true; [/code] Basically, what I did was add a one second delay between the power on request and the channel change when it appears that the receiver is starting from the off state. One second seems like a lot, but on my setup, 500ms sure didn't work. In addition, I got rid of the power on request associated with the similarly-named TV-Server event since it appeared unnecessary considering that a channel change request will always precede it, and by necessity, that will include a power on request for the STB as well. I thought about adding the delay flags as members of the DirecTV_Receiver objects. That would have been the truly OO-ish way to do this, but I gave up on that since the DirecTV_Receiver objects aren't all nicely stored in an array making them easy to access. As an additional optimization, I could have avoided performing the the power on request if the receiver is already on, but I don't have a good and easy way of truly [I]knowing[/I] that, and making an incorrect assumption would cause an ugly mess when trying to start TV with the receiver off. I did, however, avoid needlessly performing the delay if I [I]believe[/I] the receiver is already on. That prevents the average-case channel change from becoming slower, and even if I get it wrong (e.g., because the receiver's front panel switch was used), the worst consequence is an [I]occasional[/I] slow channel change or coming up with the wrong channel. Is this approach reasonable? Is there a better way to make this work? Sadly, I don't have any logs or Wireshark traces from my old MP 1.2.3 setup. I'm kind of curious how this all managed to work before, but given that DirecTV is always messing around with their receiver firmware (and you don't get a choice regarding upgrades), it's anybody's guess as to what happened. I've attached my DirecTV_SHEF.cs in case anyone wants to take this for a spin--just drop it in over the original and rebuild. If the response is positive, I'd be happy to post a new "official" build of the plugin. In summary, I think there are two issues here that got us here: [LIST] [*]TV-Server sends a channel change event before sending a power on event. There may be architectural reasons for this that I don't understand. [*]The DirecTV STB cannot tolerate a power on request immediately followed by a channel change request, but [U]only when the STB is starting out in the off state[/U]. This is almost certainly a bug in the DirecTV STB firmware. [/LIST] Sasha [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
DirectTV SHEF IP Control Plugin for TVServer
Contact us
RSS
Top
Bottom