Ticket #1184: 6200ch.diff

File 6200ch.diff, 1.5 KB (added by adeffs.mythtv@…, 18 years ago)

patch that will add ability to specify port for 6200ch.c

  • .c

    old new  
    5555        AVC1394_6200_OPERAND_SET
    5656
    5757#define STARTING_NODE 1  /* skip 1394 nodes to avoid error msgs */
     58#define STARTING_PORT 0
    5859
    5960void usage()
    6061{
    61    fprintf(stderr, "Usage: 6200ch [-v] [-n NODE] <channel_num>\n");
     62   fprintf(stderr, "Usage: 6200ch [-v] [-n NODE] [-p PORT] <channel_num>\n");
    6263   fprintf(stderr, "-v        Print additional verbose output\n");
    6364   fprintf(stderr, "-n NODE   node to start device scanning on\n");
     65   fprintf(stderr, "-p PORT   port/adapter to use (default:0)\n");
    6466   exit(1);
    6567}
    6668
     
    7678
    7779   /* some people experience crashes when starting on node 1 */
    7880   int starting_node = STARTING_NODE;
     81   int starting_port = STARTING_PORT;
    7982   int c;
    8083   int index;
    8184
     
    8386      usage();
    8487
    8588   opterr = 0;
    86    while ((c = getopt(argc, argv, "vn:")) != -1) {
     89   while ((c = getopt(argc, argv, "vn:p:")) != -1) {
    8790       switch (c) {
    8891       case 'v':
    8992           verbose = 1;
     
    9194       case 'n':
    9295           starting_node = atoi(optarg);
    9396           break;
     97       case 'p':
     98           starting_port = atoi(optarg);
     99           break;
    94100       default:
    95101           fprintf(stderr, "incorrect command line arguments\n");
    96102           usage();
     
    120126      exit(1);
    121127   }
    122128
    123    if (raw1394_set_port(handle, 0) < 0) {
     129   if (raw1394_set_port(handle, starting_port) < 0) {
    124130      perror("couldn't set port");
    125131      raw1394_destroy_handle(handle);
    126132      exit(1);