Changes in uspace/app/lsusb/main.c [5dfee52:69ac0fd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/lsusb/main.c
r5dfee52 r69ac0fd 44 44 #include <devman.h> 45 45 #include <devmap.h> 46 #include <usb/hub.h>47 46 #include <usb/host.h> 48 47 49 48 #define NAME "lsusb" 50 49 51 #define MAX_FAILED_ATTEMPTS 1050 #define MAX_FAILED_ATTEMPTS 4 52 51 #define MAX_PATH_LENGTH 1024 53 54 static void print_found_hc(size_t class_index, const char *path)55 {56 // printf(NAME ": host controller %zu is `%s'.\n", class_index, path);57 printf("Bus %02zu: %s\n", class_index, path);58 }59 static void print_found_dev(usb_address_t addr, const char *path)60 {61 // printf(NAME ": device with address %d is `%s'.\n", addr, path);62 printf(" Device %02d: %s\n", addr, path);63 }64 65 static void print_hc_devices(devman_handle_t hc_handle)66 {67 int rc;68 usb_hc_connection_t conn;69 70 usb_hc_connection_initialize(&conn, hc_handle);71 rc = usb_hc_connection_open(&conn);72 if (rc != EOK) {73 printf(NAME ": failed to connect to HC: %s.\n",74 str_error(rc));75 return;76 }77 usb_address_t addr;78 for (addr = 1; addr < 5; addr++) {79 devman_handle_t dev_handle;80 rc = usb_hc_get_handle_by_address(&conn, addr, &dev_handle);81 if (rc != EOK) {82 continue;83 }84 char path[MAX_PATH_LENGTH];85 rc = devman_get_device_path(dev_handle, path, MAX_PATH_LENGTH);86 if (rc != EOK) {87 continue;88 }89 print_found_dev(addr, path);90 }91 usb_hc_connection_close(&conn);92 }93 52 94 53 int main(int argc, char *argv[]) … … 110 69 continue; 111 70 } 112 print _found_hc(class_index, path);113 print_hc_devices(hc_handle);71 printf(NAME ": host controller %zu is `%s'.\n", 72 class_index, path); 114 73 } 115 74
Note:
See TracChangeset
for help on using the changeset viewer.