X-Git-Url: http://pilppa.org/gitweb/?p=lib1wire.git;a=blobdiff_plain;f=src%2FFactory.cc;h=76f1a1381ec2e626e1b5a8b4081d3ac03dab2d17;hp=bcd43ec09478daf1c9408894d12b2e515b5574f1;hb=9e569babf7e271015fedac3b7153d9035ff17ee0;hpb=22f0b4dd0b81bce75ac7a842a72ca86eec02f7bc diff --git a/src/Factory.cc b/src/Factory.cc index bcd43ec..76f1a13 100644 --- a/src/Factory.cc +++ b/src/Factory.cc @@ -101,6 +101,7 @@ Device *Factory::create_device(int device_w1_family_code_param, dirent *direntry_param) { Device *ret_val; DeviceConfig *config; + bool succ; ret_val = NULL; if (device_type_param.empty() == false) { @@ -124,11 +125,11 @@ Device *Factory::create_device(int device_w1_family_code_param, config = DeviceConfig::get_device_config(device_id_param); if (config != NULL) { // if not, create default device config - device_type_param = config->get_config_value(DEVICE_CONFIG_VALUE_KEY__TYPE); - if (device_type_param.empty() == true) { + succ = config->get_config_value(DEVICE_CONFIG_VALUE_KEY__TYPE, device_type_param); + if (succ == false) { device_type_param = ret_val->get_type(); - config->set_config_value(DEVICE_CONFIG_VALUE_KEY__TYPE, device_type_param); - config->set_config_value(DEVICE_CONFIG_VALUE_KEY__ID, ret_val->get_id()); + config->set_config_value(DEVICE_CONFIG_VALUE_KEY__TYPE, device_type_param, false); + config->set_config_value(DEVICE_CONFIG_VALUE_KEY__ID, ret_val->get_id(), true); } delete(config); } @@ -246,8 +247,8 @@ list Factory::get_device_list() { } if (found == false) { // reader device is not in the list of active devices. create and add it to list as in-active one... - type = reader->get_device_type(); - if (type.empty() == false) { + found = reader->get_device_type(type); + if (found == true) { device = create_device(type, id1); if (device != NULL) { ret_val.push_back(device);