Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/vuhid/device.c

    r9a884ed re6503e9  
    3636#include "virthid.h"
    3737#include <errno.h>
     38#include <stdio.h>
    3839#include <str.h>
    3940#include <assert.h>
     
    9596    const char *id)
    9697{
    97         vuhid_interface_t *iface = ifaces[0];
    98         while (iface != NULL) {
    99                 if (str_cmp(iface->id, id) == 0) {
    100                         return iface;
     98        if ((ifaces == NULL) || (id == NULL)) {
     99                return NULL;
     100        }
     101        while (*ifaces != NULL) {
     102                if (str_cmp((*ifaces)->id, id) == 0) {
     103                        return *ifaces;
    101104                }
    102                 iface++;
    103         }
    104 
    105         return iface;
     105                ifaces++;
     106        }
     107
     108        return NULL;
    106109}
    107110
     
    118121        }
    119122
    120         // FIXME - we shall set vuhid_data to NULL in the main() rather
    121         // than to depend on individual interfaces
    122123        /* Already used interface. */
    123124        if (iface->vuhid_data != NULL) {
     
    165166         * Prepare new descriptors.
    166167         */
    167         printf("preparing descriptors...\n");
    168168        size_t descr_count = 0;
    169169        size_t total_descr_size = 0;
     
    272272        }
    273273
    274         printf("adding extra descriptors...\n");
    275274        /* Allocation is okay, we can (actually have to now) overwrite the
    276275         * original pointer.
Note: See TracChangeset for help on using the changeset viewer.