From: kibak.yoon Date: Mon, 15 Feb 2016 09:25:23 +0000 (+0900) Subject: sensord: fix the bug that uses wrong type if sensor is UNKNOWN_SENSOR X-Git-Tag: accepted/tizen/mobile/20160216.102843~1^2~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F99%2F59399%2F1;p=platform%2Fcore%2Fsystem%2Fsensord.git sensord: fix the bug that uses wrong type if sensor is UNKNOWN_SENSOR Change-Id: I598273ed1aa34c8c6417b2bc3469d175f1d62722 Signed-off-by: kibak.yoon --- diff --git a/src/server/sensor_loader.cpp b/src/server/sensor_loader.cpp index a2bee31..4117970 100644 --- a/src/server/sensor_loader.cpp +++ b/src/server/sensor_loader.cpp @@ -163,14 +163,15 @@ void sensor_loader::create_physical_sensors(sensor_type_t type) return; } - index = (int32_t) (m_sensors.count(type)); + sensor_type_t _type = (sensor_type_t)handle->type; + index = (int32_t)m_sensors.count(_type); - sensor->set_id(((int64_t)handle->type << SENSOR_TYPE_SHIFT) | index); + sensor->set_id(((int64_t)_type << SENSOR_TYPE_SHIFT) | index); sensor->set_sensor_handle(handle); sensor->set_sensor_device(device); std::shared_ptr sensor_ptr(sensor); - m_sensors.insert(std::make_pair(type, sensor_ptr)); + m_sensors.insert(std::make_pair(_type, sensor_ptr)); _I("created [%s] sensor", sensor->get_name()); @@ -264,6 +265,10 @@ bool sensor_loader::get_paths_from_dir(const string &dir_path, vector &p while ((dir_entry = readdir(dir))) { name = string(dir_entry->d_name); + + if (name == "." || name == "..") + continue; + plugin_paths.push_back(dir_path + "/" + name); }