int i, ret;
driver = find_resource_driver(resource_type);
- if (!driver)
+ if (!driver) {
+ _E("failed to find resource driver, res:type(%d)\n",
+ resource_type);
return NULL;
+ }
resource = calloc(1, sizeof(*resource));
if (!resource)
if (driver->ops.init) {
ret = driver->ops.init(resource);
if (ret < 0) {
+ _E("failed to initialize resource driver, res:type(%s)id(%d)\n",
+ resource->name, resource->id);
do_delete_resource(resource);
return NULL;
}
int ctrl_index = RESOURCE_CTRL_INDEX(ctrl_id);
int ret;
- if (!resource)
+ if (!resource) {
+ _E("Invalid parameter\n");
return -EINVAL;
+ }
ctrl = &resource->ctrls[ctrl_index];
if (!ctrl->ops.set)
struct resource_attribute_value *attr_value = NULL;
int ret;
- if (!resource || attr_index < 0 || attr_index >= resource->num_attrs)
+ if (!resource || attr_index < 0 || attr_index >= resource->num_attrs) {
+ _E("Invalid parameter\n");
return -EINVAL;
+ }
attr = &resource->attrs[attr_index];
- if (!attr->ops.get)
+ if (!attr->ops.get) {
+ _E("don't support get ops of resource attribute value, res:type(%s)id(%d) | attr:name(%s)id(%"PRId64")\n",
+ resource->name, resource->id,
+ attr->name, attr_id);
return -EINVAL;
+ }
attr_value = &resource->attrs_value[attr_index];
ret = attr->ops.get(resource, attr, attr_value->data);
- if (ret < 0)
+ if (ret < 0) {
+ _E("failed to get resource attribute value, res:type(%s)id(%d) | attr:name(%s)id(%"PRId64")\n",
+ resource->name, resource->id,
+ attr->name, attr_id);
return ret;
+ }
return 0;
}
if (resource->driver && resource->driver->ops.prepare_update) {
ret = resource->driver->ops.prepare_update(resource);
- if (ret < 0)
+ if (ret < 0) {
+ _E("failed to prepare_update resource driver, res:type(%s)id(%d)\n",
+ resource->name, resource->id);
return ret;
+ }
}
for (i = 0; i < resource->num_attrs; i++) {
continue;
ret = update_resource_attr(resource, resource->attrs[i].id);
if (ret < 0) {
- _E("failed to update resource attr (%s)\n",
- resource->attrs[i].name);
+ _E("failed to update resource attribute, res:type(%s)id(%d) | attr:name(%s)id(%"PRId64")\n",
+ resource->name, resource->id,
+ resource->attrs[i].name, resource->attrs[i].id);
}
}
{
int attr_index = RESOURCE_ATTR_INDEX(attr_id);
- if (!resource || attr_index < 0 || attr_index >= resource->num_attrs)
+ if (!resource || attr_index < 0 || attr_index >= resource->num_attrs) {
+ _E("Invalid parameter\n");
return NULL;
+ }
return &resource->attrs[attr_index];
}
{
int attr_index = RESOURCE_ATTR_INDEX(attr_id);
- if (!resource || attr_index < 0 || attr_index >= resource->num_attrs)
+ if (!resource || attr_index < 0 || attr_index >= resource->num_attrs) {
+ _E("Invalid parameter\n");
return NULL;
+ }
return &resource->attrs_value[attr_index];
}
int ret;
bool is_supported = false;
- if (!resource || attr_index < 0 || attr_index >= resource->num_attrs)
+ if (!resource || attr_index < 0 || attr_index >= resource->num_attrs) {
+ _E("Invalid parameter\n");
return false;
+ }
attr = &resource->attrs[attr_index];
{
const struct resource_attribute *attr = get_resource_attr(resource, attr_id);
- if (!attr || attr->type != type)
+ if (!attr) {
+ _E("Invalid parameter\n");
+ return false;
+ }
+
+ if (attr->type != type) {
+ _E("Invalid data type(%d), res:type(%s)id(%d) | attr:name(%s)id(%"PRId64",%d)\n",
+ type,
+ resource->name, resource->id,
+ attr->name, attr->id, attr->type);
return false;
+ }
- if (!(attr->id & resource->attr_interest))
+ if (!(attr->id & resource->attr_interest)) {
+ _E("Invalid interest state, res:type(%s)id(%d) | attr:name(%s)id(%"PRId64")type(%d)\n",
+ resource->name, resource->id,
+ attr->name, attr->id, attr->type);
return false;
+ }
return true;
}
{
struct resource_attribute_value *attr_value = NULL;
- if (!check_attr_validate(resource, attr_id, DATA_TYPE_STRING))
+ if (!check_attr_validate(resource, attr_id, DATA_TYPE_STRING)) {
+ _E("Invalid parameter\n");
return -EINVAL;
+ }
attr_value = get_resource_attr_value(resource, attr_id);
- if (!attr_value)
+ if (!attr_value) {
+ _E("failed to get attribute value\n");
return -EINVAL;
+ }
strncpy(data, (char *)attr_value->data, BUFF_MAX);
attr_value = get_resource_attr_value(resource, resource->attrs[i].id);
if (!attr_value) {
- _E("failed to get attribute value: resource: %s, attribute: %s",
+ _E("failed to get attribute value, res:type(%s) | attr:name(%s)",
resource->name, resource->attrs[i].name);
ret = -EINVAL;
goto err;
attr_value->data = calloc(1, sizeof(struct array_value));
break;
default:
- _E("Not supported data type: %d", attr_value->type);
+ _E("Not supported data type(%d)", attr_value->type);
ret = -EINVAL;
goto err;
}
if (!attr_value->data) {
- _E("failed to allocate attr_value memory: resource: %s, attribute: %s",
+ _E("failed to allocate attr_value memory, res:type(%s) | attr:name(%s)",
resource->name, resource->attrs[i].name);
ret = -ENOMEM;
goto err;
attr_value = get_resource_attr_value(resource, resource->attrs[i].id);
if (!attr_value) {
- _E("failed to get attribute value: resource: %s, attribute: %s",
+ _E("failed to get attribute value, res:type(%s) | attr:name(%s)",
resource->name, resource->attrs[i].name);
return -EINVAL;
}
attr_value->data = NULL;
break;
default:
- _E("Not supported data type: %d", attr_value->type);
+ _E("Not supported data type(%d)", attr_value->type);
return -EINVAL;
}
}