首页 新闻 会员 周边

Android HAL property_get() 函数用法

0
悬赏园豆:50 [待解决问题]

函数原型 int property_get(const char *key, char *value, const char *default_value);

在Hal  用法代码片段:

 

static const char *variant_keys[] = {
"ro.hardware", /* This goes first so that it can pick up a different file on the emulator. */
"ro.product.board",
"ro.board.platform",
"ro.arch"
};

 

char prop[PATH_MAX];

 

/* Loop through the configuration variants looking for a module */
for (i=0 ; i<HAL_VARIANT_KEYS_COUNT; i++) {
   if (property_get(variant_keys[i], prop, NULL) == 0) {
    continue;
}
if (hw_module_exists(path, sizeof(path), name, prop) == 0) {
   goto found;
}
}

 

我由于没找到 property_get() 的实现源码,对Android property机制也不是很明白。

一直不清楚 property_get 它会把  variant_keys[] 里的值,拷贝到prop 数组吗?

 

谢谢!

鱼竿的传说的主页 鱼竿的传说 | 初学一级 | 园豆:115
提问于:2016-01-06 17:46
< >
分享
所有回答(1)
0

哈哈,我说怎么这么熟悉的代码,原来是hardware.c,是的呢

指尖律动~静 | 园豆:202 (菜鸟二级) | 2021-01-27 14:56
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册