Ticket #1184: 6200ch.diff
File 6200ch.diff, 1.5 KB (added by , 18 years ago) |
---|
-
.c
old new 55 55 AVC1394_6200_OPERAND_SET 56 56 57 57 #define STARTING_NODE 1 /* skip 1394 nodes to avoid error msgs */ 58 #define STARTING_PORT 0 58 59 59 60 void usage() 60 61 { 61 fprintf(stderr, "Usage: 6200ch [-v] [-n NODE] <channel_num>\n");62 fprintf(stderr, "Usage: 6200ch [-v] [-n NODE] [-p PORT] <channel_num>\n"); 62 63 fprintf(stderr, "-v Print additional verbose output\n"); 63 64 fprintf(stderr, "-n NODE node to start device scanning on\n"); 65 fprintf(stderr, "-p PORT port/adapter to use (default:0)\n"); 64 66 exit(1); 65 67 } 66 68 … … 76 78 77 79 /* some people experience crashes when starting on node 1 */ 78 80 int starting_node = STARTING_NODE; 81 int starting_port = STARTING_PORT; 79 82 int c; 80 83 int index; 81 84 … … 83 86 usage(); 84 87 85 88 opterr = 0; 86 while ((c = getopt(argc, argv, "vn: ")) != -1) {89 while ((c = getopt(argc, argv, "vn:p:")) != -1) { 87 90 switch (c) { 88 91 case 'v': 89 92 verbose = 1; … … 91 94 case 'n': 92 95 starting_node = atoi(optarg); 93 96 break; 97 case 'p': 98 starting_port = atoi(optarg); 99 break; 94 100 default: 95 101 fprintf(stderr, "incorrect command line arguments\n"); 96 102 usage(); … … 120 126 exit(1); 121 127 } 122 128 123 if (raw1394_set_port(handle, 0) < 0) {129 if (raw1394_set_port(handle, starting_port) < 0) { 124 130 perror("couldn't set port"); 125 131 raw1394_destroy_handle(handle); 126 132 exit(1);