Changeset 64d138b in mainline for uspace/app/tmon/main.c
- Timestamp:
- 2017-12-15T17:21:49Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 73b0773
- Parents:
- a8723748
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tmon/main.c
ra8723748 r64d138b 36 36 37 37 #include <stdio.h> 38 #include <loc.h> 38 39 #include <usb/diag/diag.h> 40 #include <usb/diag/iface.h> 41 #include <devman.h> 42 #include <errno.h> 39 43 40 44 #define NAME "tmon" … … 43 47 { 44 48 printf(NAME ": hello USB transfers!\n\n"); 49 } 50 51 static void print_list_item(service_id_t svc) 52 { 53 int rc; 54 devman_handle_t diag_handle = 0; 55 56 if ((rc = devman_fun_sid_to_handle(svc, &diag_handle))) { 57 printf(NAME ": Error resolving handle of device with SID %ld, skipping.\n", svc); 58 return; 59 } 60 } 61 62 static int print_list() 63 { 64 category_id_t diag_cat; 65 service_id_t *svcs; 66 size_t count; 67 int rc; 68 69 if ((rc = loc_category_get_id(USB_DIAG_CATEGORY, &diag_cat, 0))) { 70 printf(NAME ": Error resolving category '%s'", USB_DIAG_CATEGORY); 71 return 1; 72 } 73 74 if ((rc = loc_category_get_svcs(diag_cat, &svcs, &count))) { 75 printf(NAME ": Error getting list of host controllers.\n"); 76 return 1; 77 } 78 79 for (unsigned i = 0; i < count; ++i) { 80 print_list_item(svcs[i]); 81 } 82 83 free(svcs); 84 return 0; 45 85 } 46 86 … … 52 92 } 53 93 54 int out; 55 const int rc = usb_diag_test(0, &out); 56 if (rc) { 57 printf("Error: %d\n", rc); 58 } else { 59 printf("The number is %d.\n", out); 60 } 61 62 return 0; 94 return print_list(); 63 95 } 64 96
Note:
See TracChangeset
for help on using the changeset viewer.