--- my_firewire_tester.c	2008-10-27 09:25:41.000000000 -0700
+++ firewire_tester.c	2007-12-08 19:49:13.000000000 -0700
@@ -3,7 +3,7 @@
  *  Copyright (c) 2006 by Jim Westfall
  *  Distributed as part of MythTV under GPL v2 and later.
  *
- *  $ gcc -Wall -o my_firewire_tester my_firewire_tester.c -liec61883 -lraw1394
+ *  $ gcc -Wall -o firewire_tester firewire_tester.c -liec61883 -lraw1394
  */
 
 #include <unistd.h>
@@ -19,7 +19,6 @@
 #define ACTION_TEST_P2P     1
 #define ACTION_FIX_BCAST    2
 #define ACTION_RESET_BUS    3
-#define ACTION_OUTPUT_P2P   4
 
 #define SYNC_BYTE           0x47
 #define MIN_PACKETS         25
@@ -30,7 +29,6 @@
 int verbose = 0;
 int sync_failed = 0;
 int nodata = 0;
-int run = 0;
 
 static int read_packet (unsigned char *tspacket, int len, 
                         unsigned int dropped, void *callback_data)
@@ -53,29 +51,6 @@
     return 1;
 }
 
-static int fwrite_packet (unsigned char *tspacket, int len, 
-                        unsigned int dropped, void *callback_data)
-{
-    int n;
-    FILE *fp = (FILE *) callback_data;
-
-    if (dropped)
-    {
-        fprintf(stderr, "Dropped %d packet(s).\n", dropped);
-        return 0;
-    }
-
-    if (tspacket[0] != SYNC_BYTE)
-    {
-        sync_failed = 1;
-        return 0;
-    }
-    nodata = 0;
-    n = fwrite(tspacket, sizeof(char), 188, fp);
-    //fprintf(stderr, "fwrite_packets: wrote %d of %d\n", n, len);
-    return(n == len ? 0 : 1);
-}
-
 int test_connection(raw1394handle_t handle, int channel)
 {
     int count = 0;
@@ -235,65 +210,6 @@
     return 0;
 }
 
-// create and test a p2p connection, copy packets to stdout
-// returns 1 on success, 0 on failure
-int output_p2p(raw1394handle_t handle, nodeid_t node) {
-    int channel, count, success = 0;
-    int retry = 0;
-    FILE *fp = stdout;
-    iec61883_mpeg2_t mpeg;
-    struct timeval tv;
-    fd_set rfds;
-    channel = node;
-    int fd = raw1394_get_fd(handle);
-
-    sync_failed = 0;
-
-    VERBOSE("P2P: Creating, node %d, channel %d\n", node, channel);
-    fflush(stdout);
- 
-    // make connection
-    if (iec61883_cmp_create_p2p_output(handle, node | 0xffc0, 0, channel,
-                                       1 /* fix me, speed */ ) != 0)
-    {
-        fprintf(stderr, "iec61883_cmp_create_p2p_output failed\n");
-        return 0;
-    }
-    mpeg = iec61883_mpeg2_recv_init(handle, fwrite_packet, (void*) fp);
-    run = 1;
-    iec61883_mpeg2_recv_start(mpeg, channel);
-    while(run && retry < 2 && !sync_failed && nodata < MAX_NODATA)
-    {
-        FD_ZERO(&rfds);
-        FD_SET(fd, &rfds);
-        tv.tv_sec = 1;
-        tv.tv_usec = 0;
-
-        if (select(fd + 1, &rfds, NULL, NULL, &tv) > 0)
-        {
-             nodata++;
-             raw1394_loop_iterate(handle);
-        }
-        else
-        {
-            retry++;
-        }
-    }
-    iec61883_mpeg2_recv_stop(mpeg);
-    iec61883_mpeg2_close(mpeg);
-
-    if (sync_failed)
-        return 0;
-
-    return count;
-
-    VERBOSE("P2P: Disconnecting.\n");
-    iec61883_cmp_disconnect(handle, node | 0xffc0, 0,
-                            raw1394_get_local_id (handle),
-                            -1, channel, 0);
-    return success;
-}
-
 void usage(void) {
     printf("firewire_tester <action> -n <node> [-P <port>] [-r <n>] [-v]\n");
     printf(" Actions: (one is required)\n");
@@ -303,7 +219,6 @@
     printf("    -R          - reset the firewire bus\n");
     printf(" Options\n");
     printf("    -n <node>   - firewire node, required\n");
-    printf("    -o          - write packets to stdout using p2p connection\n");
     printf("    -P <port>   - firewire port, default 0\n");
     printf("    -r <n>      - run action <n> times, default 1\n");
     printf("    -v          - verbose\n");
@@ -319,7 +234,7 @@
     int action = ACTION_NONE;
 
     opterr = 0;
-    while ((c = getopt(argc, argv, "Bbn:opP:r:Rv")) != -1)
+    while ((c = getopt(argc, argv, "Bbn:pP:r:Rv")) != -1)
     {
         switch (c) 
         {
@@ -354,16 +269,6 @@
                 }
                 break;
 
-            // output packets using p2p connection
-            case 'o':
-                if (action != ACTION_NONE)
-                {
-                    printf("Invalid command line\n");
-                    usage();
-                }
-                action = ACTION_OUTPUT_P2P;
-                break;
-
             // set the port, optional
             case 'P':
                 port = atoi(optarg);
@@ -463,13 +368,6 @@
                 printf("Bus reset failed: %d\n", errno);
             }
             break;
-        case ACTION_OUTPUT_P2P:
-            runs = 1;
-            fprintf(stderr,
-                    "Action: Output P2P packets using node %d, channel %d\n",
-                    node, node);
-            success = output_p2p(handle, node);
-            break;
     }
 
     VERBOSE("raw1394: Releasing handle.\n");
