Changeset 0cc32f2 in mainline for uspace/app


Ignore:
Timestamp:
2011-08-18T18:47:54Z (14 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1f44b056, d7427a7e
Parents:
1d2a1a9 (diff), f55b12b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge libposix changes.

Location:
uspace/app
Files:
4 deleted
4 edited

Legend:

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

    r1d2a1a9 r0cc32f2  
    5050
    5151#define MAX_USB_ADDRESS USB11_ADDRESS_MAX
    52 #define MAX_FAILED_ATTEMPTS 10
    5352#define MAX_PATH_LENGTH 1024
    5453
    55 static void print_found_hc(size_t class_index, const char *path)
     54static void print_found_hc(service_id_t sid, const char *path)
    5655{
    57         // printf(NAME ": host controller %zu is `%s'.\n", class_index, path);
    58         printf("Bus %02zu: %s\n", class_index, path);
     56        printf("Bus %" PRIun ": %s\n", sid, path);
    5957}
    6058static void print_found_dev(usb_address_t addr, const char *path)
    6159{
    62         // printf(NAME ":     device with address %d is `%s'.\n", addr, path);
    6360        printf("  Device %02d: %s\n", addr, path);
    6461}
     
    9592int main(int argc, char *argv[])
    9693{
    97         size_t class_index = 0;
    98         size_t failed_attempts = 0;
     94        category_id_t usbhc_cat;
     95        service_id_t *svcs;
     96        size_t count;
     97        size_t i;
     98        int rc;
    9999
    100         while (failed_attempts < MAX_FAILED_ATTEMPTS) {
    101                 class_index++;
     100        rc = loc_category_get_id(USB_HC_CATEGORY, &usbhc_cat, 0);
     101        if (rc != EOK) {
     102                printf(NAME ": Error resolving category '%s'",
     103                    USB_HC_CATEGORY);
     104                return 1;
     105        }
     106
     107        rc = loc_category_get_svcs(usbhc_cat, &svcs, &count);
     108        if (rc != EOK) {
     109                printf(NAME ": Error getting list of host controllers.\n");
     110                return 1;
     111        }
     112
     113        for (i = 0; i < count; i++) {
    102114                devman_handle_t hc_handle = 0;
    103                 int rc = usb_ddf_get_hc_handle_by_class(class_index, &hc_handle);
     115                int rc = usb_ddf_get_hc_handle_by_sid(svcs[i], &hc_handle);
    104116                if (rc != EOK) {
    105                         failed_attempts++;
     117                        printf(NAME ": Error resolving handle of HC with SID %"
     118                            PRIun ", skipping.\n", svcs[i]);
    106119                        continue;
    107120                }
     
    109122                rc = devman_get_device_path(hc_handle, path, MAX_PATH_LENGTH);
    110123                if (rc != EOK) {
     124                        printf(NAME ": Error resolving path of HC with SID %"
     125                            PRIun ", skipping.\n", svcs[i]);
    111126                        continue;
    112127                }
    113                 print_found_hc(class_index, path);
     128                print_found_hc(svcs[i], path);
    114129                print_hc_devices(hc_handle);
    115130        }
     131
     132        free(svcs);
    116133
    117134        return 0;
  • uspace/app/tester/Makefile

    r1d2a1a9 r0cc32f2  
    5656        mm/malloc3.c \
    5757        mm/mapping1.c \
    58         devs/devman1.c \
    59         devs/devman2.c \
    6058        hw/misc/virtchar1.c \
    6159        hw/serial/serial1.c \
  • uspace/app/tester/hw/misc/virtchar1.c

    r1d2a1a9 r0cc32f2  
    4949
    5050#define DEVICE_PATH_NORMAL "/loc/devices/\\virt\\null\\a"
    51 #define DEVICE_PATH_CLASSES "/loc/class/virt-null\\1"
    5251#define BUFFER_SIZE 64
    5352
     
    105104        }
    106105
    107         res = test_virtchar1_internal(DEVICE_PATH_CLASSES);
    108         if (res != NULL) {
    109                 return res;
    110         }
    111 
    112106        return NULL;
    113107}
  • uspace/app/tester/tester.c

    r1d2a1a9 r0cc32f2  
    6868#include "hw/misc/virtchar1.def"
    6969#include "libext2/libext2_1.def"
    70 #include "devs/devman1.def"
    71 #include "devs/devman2.def"
    7270        {NULL, NULL, NULL, false}
    7371};
Note: See TracChangeset for help on using the changeset viewer.