Interesting. Thanks for the links. I'm surprised that a transaction with 3 separate calls was deemed to be more stable, but I'm sure there was a valid reason. However, I do notice one thing on the original 1-shot way of doing things, which is that a different call is used than what's now in the code and what I used (avc1394_send_command_block vs. avc1394_transaction_block for everywhere else). Maybe that's the difference.
<br><br>The three things that still have me thinking that my current solution is right is 1) the Scientific Atlanta boxes do 72-bit transactions and from what I heard are quite stable 2) the MacOS web page does it that way (FWIW) and 3) it on the whole makes more sense to send one 3-digit channel number instead of 3 individual digits essentially emulating key presses. I've definitely been wrong in the past, so please chime in if you know any more or have any success/failure with my version of the script!
<br><br>Thanks,<br><br>Tim<br><br><br><div><span class="gmail_quote">On 2/1/06, <b class="gmail_sendername">Jim Westfall</b> <<a href="mailto:jwestfall@surrealistic.net">jwestfall@surrealistic.net</a>> wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">thats actually how it used to be.<br><br><a href="http://www.gossamer-threads.com/lists/mythtv/dev/79627?#79627">
http://www.gossamer-threads.com/lists/mythtv/dev/79627?#79627</a><br><a href="http://www.gossamer-threads.com/lists/mythtv/dev/106352?#106352">http://www.gossamer-threads.com/lists/mythtv/dev/106352?#106352</a><br><br>jim
<br><br>Tim Trampedach <<a href="mailto:tim.trampedach@gmail.com">tim.trampedach@gmail.com</a>> wrote [02.01.06]:<br>> I found out a few interesting things on this and came up with a revamped<br>> version of the 6200ch utility. Take a look at this web page:
<br>> <a href="http://mac_hdtv_timer.home.comcast.net/channel.html">http://mac_hdtv_timer.home.comcast.net/channel.html</a>. It uses a 72-bit string<br>> to send the command to the device in a single shot. MythTV and the utility
<br>> currently use three separate transactions with 32-bit commands to send<br>> digits one at a time. After some digging in the code I noticed that the<br>> Scientific Atlanta box also uses 72-bit string, except it needs it twice (a
<br>> "change" and then a "commit" if you will). So I revamped the 6200ch utility<br>> to use the string format from that web page and it works flawlessly for me<br>> now. No waiting with sleep, no missed channel changes and it's much quicker
<br>> than one digit at a time.<br>><br>> It really works well, but your mileage may vary. Therefore, if you have a<br>> 6200-series box, please compile code below and let me know how it goes. One<br>> or two minor items of cleanup could happen in there, but I'm on my way to
<br>> sleep. Tomorrow! :-)<br>><br>> The actual change is quite simple as it actually makes the code less<br>> complicated. I need some feedback on this before I'll open a ticket and<br>> submit the patch.<br>
><br>> Thanks,<br>><br>> Tim<br>><br>><br>> /*<br>> * 6200ch - an external channel changer for Motorola DCT-6200 Tuner<br>> *<br>> * Copyright 2004,2005 by Stacey D. Son <<a href="mailto:mythdev@son.org">
mythdev@son.org</a>><br>> *<br>> * This program is free software; you can redistribute it and/or modify<br>> * it under the terms of the GNU General Public License as published by<br>> * the Free Software Foundation; either version 2 of the License, or
<br>> * (at your option) any later version.<br>> *<br>> * This program is distributed in the hope that it will be useful,<br>> * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
<br>> * GNU General Public License for more details.<br>> *<br>> * You should have received a copy of the GNU General Public License<br>> * along with this program; if not, write to the Free Software Foundation,
<br>> * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.<br>> */<br>><br>> #include <libavc1394/rom1394.h><br>> #include <libavc1394/avc1394.h><br>> #include <libraw1394/raw1394.h>
<br>> #include <sys/types.h><br>> #include <stdio.h><br>> #include <errno.h><br>> #include <stdlib.h><br>> #include <unistd.h> // for usleep<br>><br>> // Motorola DCT-6200 IDs
<br>> // Note: there are at least three different vendor IDs for the 6200<br>> #define DCT6200_VENDOR_ID1 0x00000ce5<br>> #define DCT6200_VENDOR_ID2 0x00000e5c<br>> #define DCT6200_VENDOR_ID3 0x00001225<br>> #define DCT6200_VENDOR_ID4 0x00000f9f
<br>> #define DCT6200_VENDOR_ID5 0x00001180<br>> #define DCT6200_VENDOR_ID6 0x000012c9<br>> #define DCT6200_VENDOR_ID7 0x000011ae<br>> #define DCT6200_VENDOR_ID8 0x0000152f<br>> #define DCT6200_VENDOR_ID9 0x000014e8
<br>> #define DCT6200_SPEC_ID 0x00005068<br>> #define DCT6200_SW_VERSION 0x00010101<br>> #define DCT6200_MODEL_ID1 0x0000620a<br>> #define DCT6200_MODEL_ID2 0x00006200<br>> #define DCT6412_VENDOR_ID1 0x00000f9f
<br>> #define DCT6412_MODEL_ID1 0x000064ca<br>><br>> #define AVC1394_SUBUNIT_TYPE_6200 (9 << 19) /* uses a reserved subunit type<br>> */<br>><br>> #define AVC1394_6200_COMMAND_CHANNEL 0x000007C00 /* 6200 subunit command
<br>> */<br>> #define AVC1394_6200_OPERAND_SET 0x20 /* 6200 subunit command operand<br>> */<br>><br>> #define CTL_CMD0 AVC1394_CTYPE_CONTROL | AVC1394_SUBUNIT_TYPE_6200 | \<br>> AVC1394_SUBUNIT_ID_0 | AVC1394_6200_COMMAND_CHANNEL | \
<br>> AVC1394_6200_OPERAND_SET<br>><br>> #define STARTING_NODE 1 /* skip 1394 nodes to avoid error msgs */<br>><br>> void usage()<br>> {<br>> fprintf(stderr, "Usage: 6200ch [-v] [-n NODE] <channel_num>\n");
<br>> fprintf(stderr, "-v Print additional verbose output\n");<br>> fprintf(stderr, "-n NODE node to start device scanning on\n");<br>> exit(1);<br>> }<br>><br>> int main (int argc, char *argv[])
<br>> {<br>> rom1394_directory dir;<br>> int device = -1;<br>> int i;<br>> int verbose = 0;<br>> quadlet_t cmd[3];<br>> int dig[3];<br>> int chn = 550;<br>><br>> /* some people experience crashes when starting on node 1 */
<br>> int starting_node = STARTING_NODE;<br>> int c;<br>> int index;<br>><br>> if (argc < 2)<br>> usage();<br>><br>> opterr = 0;<br>> while ((c = getopt(argc, argv, "vn:")) != -1) {
<br>> switch (c) {<br>> case 'v':<br>> verbose = 1;<br>> break;<br>> case 'n':<br>> starting_node = atoi(optarg);<br>> break;<br>> default:
<br>> fprintf(stderr, "incorrect command line arguments\n");<br>> usage();<br>> }<br>> }<br>><br>> /* print out usage message if not enough arguments */<br>> if (optind != argc-1) {
<br>> usage();<br>> }<br>> /* the last argument is the channel number */<br>> chn = atoi(argv[optind]);<br>><br>> #ifdef RAW1394_V_0_8<br>> raw1394handle_t handle = raw1394_get_handle();
<br>> #else<br>> raw1394handle_t handle = raw1394_new_handle();<br>> #endif<br>><br>> if (!handle) {<br>> if (!errno) {<br>> fprintf(stderr, "Not Compatable!\n");<br>> } else {
<br>> perror("Couldn't get 1394 handle");<br>> fprintf(stderr, "Is ieee1394, driver, and raw1394 loaded?\n");<br>> }<br>> exit(1);<br>> }<br>><br>> if (raw1394_set_port(handle, 0) < 0) {
<br>> perror("couldn't set port");<br>> raw1394_destroy_handle(handle);<br>> exit(1);<br>> }<br>><br>> if (verbose)<br>> printf("starting with node: %d\n", starting_node);
<br>><br>> int nc = raw1394_get_nodecount(handle);<br>> for (i=starting_node; i < nc; ++i) {<br>> if (rom1394_get_directory(handle, i, &dir) < 0) {<br>> fprintf(stderr,"error reading config rom directory for node %d\n",
<br>> i);<br>> raw1394_destroy_handle(handle);<br>> exit(1);<br>> }<br>><br>> if (verbose)<br>> printf("node %d: vendor_id = 0x%08x model_id = 0x%08x\n",
<br>> i, dir.vendor_id, dir.model_id);<br>><br>> if ( ((dir.vendor_id == DCT6200_VENDOR_ID1) ||<br>> (dir.vendor_id == DCT6200_VENDOR_ID2) ||<br>> (dir.vendor_id
== DCT6200_VENDOR_ID3) ||<br>> (dir.vendor_id == DCT6200_VENDOR_ID4) ||<br>> (dir.vendor_id == DCT6200_VENDOR_ID5) ||<br>> (dir.vendor_id == DCT6200_VENDOR_ID6) ||<br>> (
dir.vendor_id == DCT6200_VENDOR_ID7) ||<br>> (dir.vendor_id == DCT6200_VENDOR_ID8) ||<br>> (dir.vendor_id == DCT6200_VENDOR_ID9) ||<br>> (dir.vendor_id == DCT6412_VENDOR_ID1)) &&
<br>> ((dir.model_id == DCT6200_MODEL_ID1) ||<br>> (dir.model_id == DCT6200_MODEL_ID2) ||<br>> (dir.model_id == DCT6412_MODEL_ID1)) ) {<br>> if (dir.unit_spec_id != DCT6200_SPEC_ID)
<br>> fprintf(stderr, "Warning: Unit Spec ID different.\n");<br>> if (dir.unit_sw_version != DCT6200_SW_VERSION)<br>> fprintf(stderr, "Warning: Unit Software Version
<br>> different.\n");<br>> device = i;<br>> break;<br>> }<br>> }<br>><br>> if (device == -1) {<br>> fprintf(stderr, "Could not find Motorola DCT-6200 on the 1394
<br>> bus.\n");<br>> raw1394_destroy_handle(handle);<br>> exit(1);<br>> }<br>><br>> cmd[0] = CTL_CMD0 | 0x67;<br>> cmd[1] = (0x04 << 24) | (chn << 8) | 0x000000FF;
<br>> cmd[2] = 0xFF << 24;<br>><br>> if (verbose)<br>> printf("AV/C command for channel %d = 0x%08X %08X %08X\n",<br>> chn, cmd[0], cmd[1], cmd[2]);<br>><br>> avc1394_transaction_block(handle, device, cmd, 3, 1);
<br>><br>> raw1394_destroy_handle(handle);<br>> exit(0);<br>> }<br>><br>><br>> On 1/31/06, Steven Adeff <<a href="mailto:adeffs.mythtv@gmail.com">adeffs.mythtv@gmail.com</a>> wrote:<br>> >
<br>> > I talked to a fellow that wrote windows software for interacting with the<br>> > Motorola DCT via firewire. I asked him what his method is for changing<br>> > channels to see if its any different than what
6200ch.c and mythtv are<br>> > doing, here's his response:<br>> ><br>> > "Sorry for the delay replying, I haven't done much with firewire are a<br>> > couple of months due to being busy at work. I did see similar issues, what
<br>> > seemed to fix the problem was this<br>> > 1. I use a delay of 50ms between sending digits<br>> > 2. When I do the 50ms delay, I time the actual delay (using<br>> > QueryPerformanceCounter). If the actual delay taken is > 500ms, then I
<br>> > resend all whole channel again.<br>> > 3. I also send each digit twice, once with the down button command and<br>> > once with the up button command. Each command has a 50ms delay delay<br>> > 4. I also send the enter button after sending the channel digits and dont
<br>> > send leading zeros e.g. channel 10 would be 0x21, 0xa1, 0x20, 0xa0, 0x0d,<br>> > 0x8d as the values in the command"<br>> ><br>> > I'm going to see if I can modify 6200ch.c myself, but don't know how far
<br>> > I'll make it. If any programmers here can help in anyway please chime in.<br>> ><br>> > thanks!<br>> ><br>> > --<br>> > Steve<br>> > _______________________________________________
<br>> > mythtv-dev mailing list<br>> > <a href="mailto:mythtv-dev@mythtv.org">mythtv-dev@mythtv.org</a><br>> > <a href="http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev">http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
</a><br>> ><br>> ><br>> ><br><br>> _______________________________________________<br>> mythtv-dev mailing list<br>> <a href="mailto:mythtv-dev@mythtv.org">mythtv-dev@mythtv.org</a><br>> <a href="http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev">
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev</a><br><br>_______________________________________________<br>mythtv-dev mailing list<br><a href="mailto:mythtv-dev@mythtv.org">mythtv-dev@mythtv.org</a><br><a href="http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev">
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev</a><br></blockquote></div><br>