Changeset 81ca204 in mainline
- Timestamp:
- 2011-03-16T10:27:58Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e160da4d
- Parents:
- 3100ebe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/main.c
r3100ebe r81ca204 130 130 } 131 131 132 static struct option long_options[] = { 133 {"help", no_argument, NULL, 'h'}, 134 {"identification", no_argument, NULL, 'i'}, 135 {"match-ids", no_argument, NULL, 'm'}, 136 {0, 0, NULL, 0} 137 }; 138 static const char *short_options = "him"; 139 132 140 int main(int argc, char *argv[]) 133 141 { … … 137 145 } 138 146 147 bool action_print_short_identification = false; 148 bool action_print_match_ids = false; 149 139 150 /* 140 151 * Process command-line options. They determine what shall be 141 152 * done with the device. 142 153 */ 143 144 /* TODO */ 154 int opt; 155 do { 156 opt = getopt_long(argc, argv, 157 short_options, long_options, NULL); 158 switch (opt) { 159 case -1: 160 break; 161 case '?': 162 print_usage(argv[0]); 163 return 1; 164 case 'h': 165 print_usage(argv[0]); 166 return 0; 167 case 'i': 168 action_print_short_identification = true; 169 break; 170 case 'm': 171 action_print_match_ids = true; 172 break; 173 default: 174 break; 175 } 176 } while (opt > 0); 177 178 /* Set the default action. */ 179 if (!action_print_match_ids && !action_print_short_identification) { 180 action_print_short_identification = true; 181 } 145 182 146 183 /* … … 149 186 */ 150 187 int i; 151 for (i = 1; i < argc; i++) {188 for (i = optind; i < argc; i++) { 152 189 char *devpath = argv[i]; 153 190 … … 170 207 171 208 /* Run actions the user specified. */ 172 /* TODO */173 174 175 209 printf("%s\n", devpath); 176 dump_short_device_identification(dev); 177 dump_device_match_ids(dev); 210 211 if (action_print_short_identification) { 212 dump_short_device_identification(dev); 213 } 214 if (action_print_match_ids) { 215 dump_device_match_ids(dev); 216 } 178 217 179 218 /* Destroy the control pipe (close the session etc.). */
Note:
See TracChangeset
for help on using the changeset viewer.