Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#7671 closed enhancement (invalid)

sa_control for Scientific Atlanta boxes, works for the 4250HDC too

Reported by: mpurschke@… Owned by: sphery
Priority: minor Milestone: unknown
Component: Contributed Scripts & Apps Version: 0.22-fixes
Severity: medium Keywords: Scientific Atlanta, channel changer
Cc: Ticket locked: no

Description

The Scientific Atlanta 4250HDC cable box is reported as being unsupported by the sa3250ch app in contributions. It also produces a warning with mythbackend's internal channel changer. The internal changer succeeds in changing the channel after all.

I took the skeleton of sa3250ch.c and the innards of firewiredevice.h/cpp and linuxavcinfo.h/cpp, and made this utility. It allows to change the channel, query the power status, and turn the unit on or off. I need it mainly because I switched to the Hauppauge HD-PVR.

From the help:

Usage: sa_control [-v] [-q] [ channel | on | off ]

-h : this help -v : verbose, multiple -v for more verbosity -q : query power status, also sets exit status

<channel> : set channel, implies power on on : switch on off : switch off

Examples: sa_control -q sa_control 702 sa_control off

Since the code comes from the internal changer, which does not take special action based on the SA model number (as far as I can tell), this should work for other models as well. I can test only my box, obviously.

Along the same lines, the "SA4250HDC" warning in firewiredevice.cpp around line 184 can be removed, as the commands succeed. I think this is too minor for a patch.

Attachments (4)

sa_control.cc (16.1 KB) - added by anonymous 10 years ago.
sa_control.2.cc (16.7 KB) - added by mpurschke@… 10 years ago.
new source file, replaces the old one.
sa_control.3.cc (16.9 KB) - added by mpurschke@… 10 years ago.
new version with the type fix, md5sum c6bf80d64b126d3cc717f11ebf4c5727
sa_control.4.cc (17.1 KB) - added by mpurschke@… 10 years ago.
new version with more fixes - md5sum b4e8a6eb45fd3a15d89eace2d182a930

Download all attachments as: .zip

Change History (17)

Changed 10 years ago by anonymous

Attachment: sa_control.cc added

Changed 10 years ago by mpurschke@…

Attachment: sa_control.2.cc added

new source file, replaces the old one.

comment:1 Changed 10 years ago by mpurschke@…

I added a new feature for a partial solution for cable boxes which take a long time to tune. There is a new -w <ms> switch that adds an artificial delay after the channel switch. This allows to adjust the channel change command to wait with the onset of the recording until the change has taken effect. One can cut out the usual first few seconds of the previous program in the recording.

sa_control -w 5000 702

will switch to channel 702 and theen wait another 5 seconds before exiting. The help file says now

# sa_control -h
Usage: sa_control [-v] [-q] [-w <ms> [ <channel> | on | off ]
       -h         : this help
       -v         : verbose, multiple -v for more verbosity
       -q         : query power status, also sets exit status
        <channel> : set channel, implies power on
       -w <ms>    : after a channel change, wait so many
                    more milliseconds to allow the box time to tune
        on        : switch on
        off       : switch off
Examples:
 sa_control -q
 sa_control 702
 sa_control -w 6000 702
 sa_control off

I have also cleaned up some of the comments in the code. I attach the whole new source file instead of a patch.

comment:2 Changed 10 years ago by skd5aner <skd5aner@…>

Thanks for your contribution/work. I'd like to test this out with my sa3250hd to see if it works. Powerstate alone would be worth it, but I also need to utilize a delay because my box takes a few seconds to tune.

However - I am unable to compile the latest patch - here's the output: http://mythtv.pastebin.ca/1714388

If you can update to help solve the compilation issue, then I'll re-test to see if this works.

comment:3 Changed 10 years ago by mpurschke@…

Tiny change (thanks for the feedback, skd5aner). I had used the uint8_t data type which works fine on my systems but is not portable. The new version uses the uint8_t type as it should be. The md5sum of the new file is c6bf80d64b126d3cc717f11ebf4c5727.

Changed 10 years ago by mpurschke@…

Attachment: sa_control.3.cc added

new version with the type fix, md5sum c6bf80d64b126d3cc717f11ebf4c5727

comment:4 in reply to:  3 Changed 10 years ago by anonymous

ok, so much for my ability to use wiki formatting... lets try that again:

The new version uses the __uint8_t type as it should be. The md5sum of the new file is c6bf80d64b126d3cc717f11ebf4c5727.

comment:5 in reply to:  3 Changed 10 years ago by skd5aner <skd5aner@…>

Replying to mpurschke@…:

Tiny change (thanks for the feedback, skd5aner). I had used the uint8_t data type which works fine on my systems but is not portable. The new version uses the uint8_t type as it should be. The md5sum of the new file is c6bf80d64b126d3cc717f11ebf4c5727.

Thanks for working on this, just had some time to test again - and still seeing errors when compiling. If it helps, I'm using Ubuntu 9.10 and g++ (Ubuntu 4.4.1-4ubuntu8) 4.4.1:

g++ -o sa_control sa_control.cc  -lrom1394 -lavc1394 -lraw1394
sa_control.cc: In function âint SendAVCCommand(const std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<unsigned char, std::allocator<unsigned char> >&, int, raw1394_handle*&)â:
sa_control.cc:318: error: âuint32_tâ was not declared in this scope
sa_control.cc:318: error: expected â;â before âcmdbufâ
sa_control.cc:329: error: âcmdbufâ was not declared in this scope
sa_control.cc:334: error: âretâ was not declared in this scope
sa_control.cc:334: error: âcmdbufâ was not declared in this scope
sa_control.cc: In function âint main(int, char**)â:
sa_control.cc:464: error: âEOFâ was not declared in this scope
sa_control.cc:474: error: âsscanfâ was not declared in this scope
sa_control.cc:502: error: âsscanfâ was not declared in this scope
sa_control.cc:513: error: âstderrâ was not declared in this scope
sa_control.cc:513: error: âfprintfâ was not declared in this scope
sa_control.cc:517: error: âperrorâ was not declared in this scope
sa_control.cc:518: error: âstderrâ was not declared in this scope
sa_control.cc:518: error: âfprintfâ was not declared in this scope
sa_control.cc:526: error: âperrorâ was not declared in this scope
sa_control.cc:536: error: âstderrâ was not declared in this scope
sa_control.cc:536: error: âfprintfâ was not declared in this scope

Again - happy to give this a test run if you can get it to a compilable state. :) Unfortunately, I am not a dev.

Changed 10 years ago by mpurschke@…

Attachment: sa_control.4.cc added

new version with more fixes - md5sum b4e8a6eb45fd3a15d89eace2d182a930

comment:6 Changed 10 years ago by anonymous

I got myself now an actual bona fide Ubuntu 9.10 installation to test it. The latest version compiles on that system. Thanks for sticking with this, skd5aner. Please let me know if this works for you.

comment:7 Changed 10 years ago by skd5aner <skd5aner@…>

Thanks - it compiles with no issues now. However,it isn't operating my SA3250HD.

Here's the output from the sa3250ch.c program which is included with myth. It works as expected, and changes the channel. I do have to use the -s switch to send the channel as single digits, otherwise it doesn't work correct.

sa3250ch -v -s 220
node 0: vendor_id = 0x00001947 model_id = 0x00000be0
Using single number channel change command method
AV/C Command: cmd0=0x00487ce7 cmd1=0x0400dc00 cmd2=0x00000000

And here's the output from your sa_control program with various switches. I can not query power state, change channels, or power on/off.

./sa_control -v -v -v 220
Vendor id = 0x1947  Model id = 0xbe0
Setting channel to 220
avc command   0  0x1
avc command   1  0xff
avc command   2  0xb2
avc command   3  0x7f
avc command   0  0x0
avc command   1  0x48
avc command   2  0x7c
avc command   3  0x67
avc command   4  0x4
avc command   5  0x0
avc command   6  0xdc
avc command   7  0x0
avc command   8  0x0
avc command   9  0x0
avc command  10  0x0
avc command  11  0x0
Channel change command failed (no response)



./sa_control -v -v -v -q
Vendor id = 0x1947  Model id = 0xbe0
avc command   0  0x1
avc command   1  0xff
avc command   2  0xb2
avc command   3  0x7f
Error executing query

Let me know if there's any details I can provide to help.

comment:8 Changed 10 years ago by george_jungle2@…

Thanks for your contribution. I tested on my SA4250HD (mine is not the HDC model) and it works perfectly! My HD-PVR setup was having trouble when switching from a SD to a HD channel as the recording would start before the cable box had changed channels. I am hoping that this will also help that issue.

comment:9 Changed 10 years ago by sphery

Status: newinfoneeded_new

I have no way of testing this program, so perhaps another dev who uses Scientific Atlanta cable boxes can take the ticket.

That said, I'd rather see this code integrated with the existing channel changer app for Scientific Atlanta boxes or the existing channel changer app's functionality fully handled by this application before it's considered for inclusion. We don't need yet-another channel-changer app in contrib, so if we add one, it would be nice to delete one or just modify the existing one. I can't tell at this point whether you're saying that it does have all the functionality and should support all the boxes that sa3250ch supports. Thanks.

comment:10 in reply to:  9 Changed 10 years ago by skd5aner <skd5aner@…>

Replying to mdean:

I have no way of testing this program, so perhaps another dev who uses Scientific Atlanta cable boxes can take the ticket.

That said, I'd rather see this code integrated with the existing channel changer app for Scientific Atlanta boxes or the existing channel changer app's functionality fully handled by this application before it's considered for inclusion. We don't need yet-another channel-changer app in contrib, so if we add one, it would be nice to delete one or just modify the existing one. I can't tell at this point whether you're saying that it does have all the functionality and should support all the boxes that sa3250ch supports. Thanks.

mdean - this doesn't work as-is with my sa3250hd and I haven't heard from the author after I was finally able to compile and test and report back my findings. As much as I'd like some of the features promised by this (power query, wait time), it would not be able to replace the existing sa3250 script unless the problems were resolved for the 3250. Currently, the existing script works great.

comment:11 Changed 10 years ago by robertm

Resolution: invalid
Status: infoneeded_newclosed

No response from submitter.

comment:12 Changed 10 years ago by robertm

Ref #2059, #7671, #5215. We have a plethora of SA firewire control tickets, with as many different approaches. After some discussion, the preference is that the changes be made to the existing changer rather than add one for each model of firewire box under the sun. So, throwing down the guantlet, let's get everyone working on one ticket with the following criterion:

1) Updates need to modify the existing SA3250 channel changer. 2) All existing boxes must continue to be supported. 3) Would prefer to have the changer tested with all common variants of the box (SA3250, SA4200, SA4250, etc) 4) Enhanced functionality is fine, but not at the expense of existing functionality.

If you feel you can meet these criterion, please reopen your ticket with an attached patch. If it occurs early enough in the development cycle, we can get it out there and work out the kinks.

comment:13 Changed 10 years ago by sphery

Script moved to http://www.mythtv.org/wiki/sa_control.cc . Martin, please feel free to edit the page--it basically contains your description from above and the comment about the new feature, so it could use some cleanup. Furthermore, since it now lives in a wiki, you can be much more descriptive about how the script is used (even showing examples, describing how to configure it in mythtv-setup) and how users should compile the script, etc. Thanks.

Note, also, that my placing the script in the wiki does not mean it's accepted or supported by MythTV project. Any script in the wiki could be deleted at any time if the page falls into disrepair or the code bitrots or ...

Note: See TracTickets for help on using tickets.