--- contrib/channel_changers/6200ch.c.orig 2009-09-05 01:45:56.622146614 +0000 +++ contrib/channel_changers/6200ch.c 2009-09-05 01:52:14.441276345 +0000 @@ -76,6 +76,9 @@ #define DCT6416_VENDOR_ID2 0x00001a66 #define DCT6416_MODEL_ID1 0x0000646b +#define QIP6200_VENDOR_ID1 0x0000211e +#define QIP6200_MODEL_ID1 0x00007100 + #define PACE_VENDOR_ID1 0x00005094 /* 550 & 779 */ #define PACE550_MODEL_ID1 0x00010551 #define PACE779_MODEL_ID1 0x00010755 @@ -92,19 +95,21 @@ #define RETRY_COUNT_FAST 0 void set_chan_slow(raw1394handle_t handle, int device, int verbose, int chn); +void set_chan_slow_four_digit(raw1394handle_t handle, int device, int verbose, int chn); void set_chan_fast(raw1394handle_t handle, int device, int verbose, int chn); void usage() { fprintf(stderr, "Usage: 6200ch [-v] [-s] [-n NODE] [-g GUID] [-p PORT] " - "\n"); + "[-4] \n"); fprintf(stderr, "-v print additional verbose output\n"); - fprintf(stderr, "-s use single packet method\n"); + fprintf(stderr, "-s use single packet method. Cannot be used with -4.\n"); fprintf(stderr, "-n NODE node to start device scanning on (default:%i)\n", STARTING_NODE); fprintf(stderr, "-p PORT port/adapter to use (default:%i)\n", STARTING_PORT); fprintf(stderr, "-g GUID GUID to use, -n switch, if present, will be ignored.\n"); + fprintf(stderr, "-4 Support for 4 digit channel numbers. Cannot be used with -s.\n"); exit(1); } @@ -119,7 +124,8 @@ octlet_t cli_GUID=0LL; octlet_t node_GUID=0LL; quadlet_t cmd[2]; - int chn = 550; + int chn = 0; + int use_four_digit = 0; /* some people experience crashes when starting on node 1 */ int starting_node = STARTING_NODE; @@ -131,7 +137,7 @@ usage(); opterr = 0; - while ((c = getopt(argc, argv, "vsg:n:p:")) != -1) + while ((c = getopt(argc, argv, "vsg:n:p:4")) != -1) { switch (c) { case 'v': @@ -151,12 +157,18 @@ case 'p': starting_port = atoi(optarg); break; + case '4': + use_four_digit = 1; + break; default: fprintf(stderr, "incorrect command line arguments\n"); usage(); } } - + /* We cannot use single channel with 4 digits */ + if (single_packet && use_four_digit) { + usage(); + } /* print out usage message if not enough arguments */ if (optind != argc-1) { usage(); @@ -242,6 +254,7 @@ (dir.vendor_id == DCT6412_VENDOR_ID2) || (dir.vendor_id == DCT6416_VENDOR_ID1) || (dir.vendor_id == DCT6416_VENDOR_ID2) || + (dir.vendor_id == QIP6200_VENDOR_ID1) || (dir.vendor_id == PACE_VENDOR_ID1)) && ((dir.model_id == DCH3200_MODEL_ID1) || (dir.model_id == DCT3412_MODEL_ID1) || @@ -253,6 +266,7 @@ (dir.model_id == DCT6412_MODEL_ID1) || (dir.model_id == DCT6412_MODEL_ID2) || (dir.model_id == DCT6416_MODEL_ID1) || + (dir.model_id == QIP6200_MODEL_ID1) || (dir.model_id == PACE550_MODEL_ID1) || (dir.model_id == PACE779_MODEL_ID1)) ) { @@ -274,6 +288,9 @@ if (single_packet) set_chan_fast(handle, device, verbose, chn); else + if (use_four_digit) + set_chan_slow_four_digit(handle, device, verbose, chn); + else set_chan_slow(handle, device, verbose, chn); raw1394_destroy_handle(handle); @@ -304,6 +321,37 @@ } } +// Same as set_chan_slow(), but sends 4 digits instead of 3 (for quicker channel changes on QIP6200-2 / QIP7100-1) +void set_chan_slow_four_digit(raw1394handle_t handle, int device, int verbose, int chn) +{ + int i; + int dig[4]; + quadlet_t cmd[2]; + + if (verbose) + printf("chn: %d\n", chn); + + dig[3] = (chn % 10); + dig[2] = (chn % 100) / 10; + dig[1] = (chn % 1000) / 100; + dig[0] = (chn % 10000) / 1000; + + if (verbose) + printf("AV/C Command: %d%d%d%d = Op1=0x%08X Op2=0x%08X Op3=0x%08X Op4=0x%08X\n", + dig[0], dig[1], dig[2], dig[3], + CTL_CMD0 | dig[0], CTL_CMD0 | dig[1], CTL_CMD0 | dig[2], CTL_CMD0 | dig[3]); + + for (i=0; i<4; i++) { + if (verbose) + printf("Sending digit %d\n", dig[i]); + cmd[0] = CTL_CMD0 | dig[i]; + cmd[1] = 0x0; + + avc1394_transaction_block(handle, device, cmd, 2, RETRY_COUNT_SLOW); + usleep(500000); // small delay for button to register + } +} + void set_chan_fast(raw1394handle_t handle, int device, int verbose, int chn) { quadlet_t cmd[3];