IBASE MRS-801-RE User Manual

Page 82

Advertising
background image

74

MRS-801-RE User Manual

type = i2c_get_funcs(i2cbus);

}

if ((count + 1) % BUNCH == 0) {

/* We need more space */

adapters = more_adapters(adapters, count + 1);

if (!adapters)

return NULL;

}

adapters[count].nr = i2cbus;

adapters[count].name = strdup(s);

if (adapters[count].name == NULL) {

free_adapters(adapters);

return NULL;

}

adapters[count].funcs = adap_types[type].funcs;

adapters[count].algo = adap_types[type].algo;

count++;

}

}

closedir(dir);

done:

return adapters;

}

static int lookup_i2c_bus_by_name(const char *bus_name)

{

struct i2c_adap *adapters;

int i, i2cbus = -1;

adapters = gather_i2c_busses();

if (adapters == NULL) {

fprintf(stderr, "Error: Out of memory!\n");

return -3;

}

Advertising