Changeset e5165a3 in mainline


Ignore:
Timestamp:
2011-05-07T11:10:50Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
69ac0fd
Parents:
431d6d6
Message:

lsusb prints path to host controller

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/lsusb/main.c

    r431d6d6 re5165a3  
    4848
    4949#define MAX_FAILED_ATTEMPTS 4
     50#define MAX_PATH_LENGTH 1024
    5051
    5152static int get_hc_handle(size_t class_index, devman_handle_t *hc_handle)
     
    7576int main(int argc, char *argv[])
    7677{
    77         size_t class_index = 1;
     78        size_t class_index = 0;
    7879        size_t failed_attempts = 0;
    7980
    8081        while (failed_attempts < MAX_FAILED_ATTEMPTS) {
     82                class_index++;
    8183                devman_handle_t hc_handle = 0;
    8284                int rc = get_hc_handle(class_index, &hc_handle);
    83                 class_index++;
    8485                if (rc != EOK) {
    8586                        failed_attempts++;
    8687                        continue;
    8788                }
    88 
    89                 printf(NAME ": HC %zu has handle %" PRIun ".\n",
    90                     class_index, hc_handle);
     89                char path[MAX_PATH_LENGTH];
     90                rc = devman_get_device_path(hc_handle, path, MAX_PATH_LENGTH);
     91                if (rc != EOK) {
     92                        continue;
     93                }
     94                printf(NAME ": host controller %zu is `%s'.\n",
     95                    class_index, path);
    9196        }
    9297
Note: See TracChangeset for help on using the changeset viewer.