Changeset 4c9b28a in mainline for uspace/app/devctl/devctl.c
- Timestamp:
- 2013-09-11T17:32:45Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5759975a
- Parents:
- 1db5669
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/devctl/devctl.c
r1db5669 r4c9b28a 35 35 #include <devman.h> 36 36 #include <errno.h> 37 #include <stdbool.h> 37 38 #include <stdio.h> 38 39 #include <stdlib.h> … … 44 45 #define MAX_NAME_LENGTH 1024 45 46 46 char name[MAX_NAME_LENGTH]; 47 char drv_name[MAX_NAME_LENGTH]; 47 static char name[MAX_NAME_LENGTH]; 48 static char drv_name[MAX_NAME_LENGTH]; 49 static bool verbose = false; 48 50 49 51 static const char *drv_state_str(driver_state_t state) … … 73 75 devman_handle_t *cfuns; 74 76 size_t count, i; 77 unsigned int score; 75 78 int rc; 76 79 int j; … … 94 97 else 95 98 printf("%s : %s\n", name, drv_name); 99 100 if (verbose) { 101 for (i = 0; true; i++) { 102 rc = devman_fun_get_match_id(funh, i, name, MAX_NAME_LENGTH, 103 &score); 104 if (rc != EOK) 105 break; 106 107 for (j = 0; j < lvl; j++) 108 printf(" "); 109 110 printf(" %u %s\n", score, name); 111 } 112 } 96 113 97 114 rc = devman_fun_get_child(funh, &devh); … … 226 243 driver_state_t state; 227 244 const char *sstate; 245 unsigned int score; 228 246 size_t ndevs; 229 247 size_t i; … … 252 270 printf("Driver: %s\n", drv_name); 253 271 printf("State: %s\n", sstate); 272 254 273 printf("Attached devices:\n"); 255 274 … … 263 282 goto error; 264 283 printf("\t%s\n", name); 284 } 285 286 printf("Match IDs:\n"); 287 288 for (i = 0; true; i++) { 289 rc = devman_driver_get_match_id(drvh, i, name, MAX_NAME_LENGTH, 290 &score); 291 if (rc != EOK) 292 break; 293 294 printf("\t%u %s\n", score, name); 265 295 } 266 296 … … 306 336 int rc; 307 337 308 if (argc == 1) { 338 if (argc == 1 || argv[1][0] == '-') { 339 if (argc > 1) { 340 if (str_cmp(argv[1], "-v") == 0) { 341 verbose = true; 342 } else { 343 printf(NAME ": Invalid argument '%s'\n", argv[1]); 344 print_syntax(); 345 return 1; 346 } 347 } 309 348 rc = fun_tree_print(); 310 349 if (rc != EOK)
Note:
See TracChangeset
for help on using the changeset viewer.