[WiP] TV Server hardware-specific code refactoring (2 Viewers)

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Okay, understood. Why not resend the DiSEqC command after waiting 1-2 seconds for lock?

    The new algorithm could be:

    1. Try send DiSEqC command normally (before graph is running).
    2. Run graph.
    3. Before checking for lock, resend the DiSEqC command if the first command failed.
    4. If lock is not aquired after x seconds in LockedInOnSignal() then resend the DiSEqC command again.

    Thoughts?

    [Edit: By the way, the reason I asked about the motor is because of this issue...]
     

    gibman

    Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Aarhus
    Home Country
    Denmark Denmark
    hi!

    1,2, and 3 seems ok.
    but waiting too long in i step 4 (LockedInOnSignal) and it could cause an unnecessary delay - so resending the command ASAP would be good.

    I guess this can all defined in the diseqc provider class or similar that u have for each card ?

    I have no motor setup. not sure anyone in the team has btw.

    /gibman
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    hi!
    ...but waiting too long in i step 4 (LockedInOnSignal) and it could cause an unnecessary delay - so resending the command ASAP would be good...
    I fully agree. The problem is how to detect as early as possible that the DiSEqC command needs to be resent. In your specific case (Hauppauge), at each step in the proposed algorithm:

    1. Send DiSEqC command: the provider returns success.
    2. Run graph: still okay.
    3. Resend: assumed not required because the provider returned success.

    It is impossible to detect that the command failed to be sent or the switch didn't change until you find that you can't lock. Perhaps we need to be more proactive? A better algorithm (???):

    1. Try send DiSEqC command normally (before graph is running).
    2. Run graph.
    3. Before checking for lock, resend the DiSEqC command if the provider (for example, Hauppauge) often fails to send the command properly. This can be customised to each provider.
    4. Resend the DiSEqC command every 2 seconds during LockedInOnSignal().

    The only concern I would have about this 2nd algorithm is that some hardware/drivers might not handle this. I don't know of any cards like that but there are bound to be some out there.

    Also, resending a DiSEqC command can take quite a lot of time. According to the standard you have to wait 100ms after sending each command. That is on top of the time it takes for the driver to send the command. It adds up pretty quickly. Also, what happens when someone (probably me ;) ) comes along and extends DiSEqC support to cascaded switches/motors?

    I guess this can all defined in the diseqc provider class or similar that u have for each card ?

    The providers each have an OnRunGraph() callback so it is easy to resend the DiSEqC command after the graph has started. Anything that needs to be done while checking for lock (LockedInOnSignal()) would have to be done for all providers in TvCardDvbBase/TvCardDVBS.

    It should definitely be possible to add an optional interface to hardware providers that allows them to specify their lock detection behaviour (perhaps as an extension to the custom tuning interface?). For example, for some cards, signal quality > 0 might indicate that the card is locked. If you add such an interface then it would be possible to define custom DiSEqC behaviour for the LockedInOnSignal() function. I'd much rather leave that until after the main refactoring is complete and confirmed as stable. There is already quite a high risk involved in this patch...

    I have no motor setup. not sure anyone in the team has btw.

    Okay - thanks for mentioning that.
     

    MaxT

    MP Donator
  • Premium Supporter
  • December 9, 2009
    112
    13
    Home Country
    Russian Federation Russian Federation
    Hi mm1352000!

    I reply here to your post in MP1 https://forum.team-mediaportal.com/television-mytv-frontend-tv-server-90/there-option-retune-tuned-channel-errors-76465/index6.html#post684710. I tried the patch with my MP 1.2a setup, but unfortunately it pops an error for TV Library and TV Library Interfaces :( (for sure before trying it, I restored from backup files overwritten by your V6 from that thread). I tried TvLibrary[v5][SVN_HEAD_26867].zip

    Are there any chanced to have MP 1.2a version of this patch? or should I better try with older MP version?

    Regards,

    MaxT
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Are there any chanced to have MP 1.2a version of this patch? or should I better try with older MP version?

    Absolutely - you can have a version for 1.2.0a :)
    You can find the DLLs and patch in the first post as usual.
     

    MaxT

    MP Donator
  • Premium Supporter
  • December 9, 2009
    112
    13
    Home Country
    Russian Federation Russian Federation
    Hi mm1352000!

    In fact, if you have some time it would be really awesome if you could test the patch too... just to check that the Twinhan support still works.

    Tested on MP 1.2a and Twinhan support does work! However, as expected can't tune to another sat from a first tune attempt.

    Please let me know if you need more testing from my side.

    BR

    MaxT
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Great, and thank you so much for testing! :)
    Only one other thing - do you mind posting your tv.log so I can double check that everything looks correct.

    Thank you *very* much once again for your time :D
     

    MaxT

    MP Donator
  • Premium Supporter
  • December 9, 2009
    112
    13
    Home Country
    Russian Federation Russian Federation
    Hi again mm1352000!

    Here are the logs. FTAs works fine, but not scrambled ones while using MD*** :( Then I just restored from the backup and MD*** is working. May be there are some settings there which I do not know and could try out?

    Regards,

    MaxT
     

    ColinT

    Portal Pro
    January 21, 2007
    72
    1
    Home Country
    United Kingdom United Kingdom
    As 1.1.2 is now out, is the 1.1.2a patch usable on this latest release? If not can you do a new one.
    I am working well on 1.1.0 with the patch (no more card problems, but some of the 1.1.2 fixes are worth having

    BTW I see the thread is WIP now. Do you think you can get it absorbed as full WP? I would think it would be useful for many, but I was worried the the extent of the change were such that they wouldnt risk it.

    Keep up the good work and :D for this lifesave forme.

    ColinT
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hi ColinT

    No, definitely *don't* use the 1.2.0a patch with 1.1.2. It won't work. I can do a patch for 1.1.2 - will post it tonight after I get home from work (in 8 hours or so). It will of course include all the new refactoring I have done as well as the BGT3595 DiSEqC support. It would be difficult to separate that out now. Please report any errors you encounter...

    In response to your other comments: what does "WP" stand for? I can tell you that this patch won't be in 1.2.0. It just isn't ready. 1.3.0 is an outside chance (??? - not sure about the general feeling of the rest of the team), but I think the changes are so radical that they may realistically only be accepted for MP 2. Don't worry too much about that. I'll be providing support for you whether this patch makes it into SVN in a few months or a few years (let's hope it doesn't take that long!!!). Remember that my cards require this patch to work too :D.
     

    Users who are viewing this thread

    Top Bottom