2
* Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
23
static char *find_key(const char *key)
25
FILE *f = fopen("/system/build.prop", "r");
32
while (fgets(buf, 1024, f) != NULL) {
33
if (strchr(buf, '\r'))
34
*(strchr(buf, '\r')) = '\0';
35
if (strchr(buf, '\n'))
36
*(strchr(buf, '\n')) = '\0';
38
mkey = strtok(buf, "=");
43
value = strtok(NULL, "=");
47
if (strcmp(key, mkey) == 0) {
57
int property_get(const char *key, char *value, const char *default_value)
61
//printf("property_get: %s\n", key);
67
if (strcmp(key, "ro.kernel.qemu") == 0)
71
else if (strcmp(key, "ro.hardware") == 0)
75
else if (strcmp(key, "ro.product.board") == 0)
79
else if (strcmp(key, "ro.board.platform") == 0)
83
else if (strcmp(key, "ro.arch") == 0)
87
else if (strcmp(key, "debug.composition.type") == 0)
91
else if (strcmp(key, "debug.sf.hw") == 0)
95
else if (strcmp(key, "debug.gr.numframebuffers") == 0)
101
printf("found %s for %s\n", key, ret);
104
if (default_value != NULL) {
105
strcpy(value, default_value);
106
return strlen(value);
115
return strlen(value);
122
int property_set(const char *key, const char *value)
124
printf("property_set: %s %s\n", key, value);
127
// vim:ts=4:sw=4:noexpandtab