2011-11-7 21:36:42
移植busybox
校验启动了没?
打个日志看看
重启nfs
难道是没有找到配置文件
struct fb_fix_screeninfo finfo;
struct stat s;
int i;
char runme[PROPERTY_VALUE_MAX];
property_get("ro.calibration", runme, "");
if (runme[0] != '1')
{
log_write("zhw ro.calibration is O !!!!!!!!!!!!!!!!\n");
return 0;
}
/* open log */
log_fd = open(log, O_WRONLY | O_CREAT | O_TRUNC);
if (check_conf())
goto err_log;
log_write("zhw enter calibration !!!!!!!!!!!!!!!!\n");
/* read framebuffer for resolution */
fb_fd = open(fb_dev, O_RDWR);
if (fb_fd <= 0) {
log_write("Failed to open %s\n", fb_dev);
goto err_log;
}
if (-1 == ioctl(fb_fd, FBIOGET_VSCREENINFO, &info)) {
log_write("Failed to get screen info\n");
goto err_fb;
}
log_write("Screen resolution: %dx%d\n", info.xres, info.yres);
/* map buffer */
if (ioctl(fb_fd, FBIOGET_FSCREENINFO, &finfo) == -1) {
log_write("Failed to get screen info: %d\n", errno);
goto err_fb;
}
scrbuf = (__u16*) mmap(0, finfo.smem_len,
PROT_READ | PROT_WRITE,
MAP_SHARED,
fb_fd, 0);
if (scrbuf== MAP_FAILED) {
log_write("Failed to map screen\n");
goto err_fb;
}
memset(scrbuf, 0, finfo.smem_len);
/* print information on screen */
fb_fd = open("/dev/tty0", O_RDWR);
if (fb_fd >= 0) {
const char *msg = "\n"
"\n"
"\n" // console is 40 cols x 30 lines
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\t\tTouchscreen Calibration";
char esc = 27;
char clear[10];
sprintf(clear, "%c[2J", esc);
write(fb_fd, clear, strlen(clear));
sprintf(clear, "%c[1;1H", esc);
write(fb_fd, clear, strlen(clear));
write(fb_fd, msg, strlen(msg));
close(fb_fd);
}
for (i = 0; ; i++) {
/* open touchscreen input dev */
char ts_dev[256];
char name[256] = "Unknow";
sprintf(ts_dev, "%s%d", input_dev, i);
if (stat(ts_dev, &s) != 0) {
log_write("can not find ts device\n");
goto err_map;
}
ts_fd = open(ts_dev, O_RDWR);
if (ts_fd < 0) {
log_write("Failed to open %s\n", ts_dev);
continue;
}
ioctl(ts_fd, EVIOCGNAME(sizeof(name)), name);
log_write("%s: get name: %s\n", ts_dev, name);
if (strncmp(name, dev_name, strlen(dev_name)) == 0) {
break;
} else {
log_write("%s: not %s\n", ts_dev, dev_name);
close(ts_fd);
continue;
}
}
do_calibration();
log_write("Calibration done!!\n");
//test_calibration();
close(ts_fd);
err_map:
munmap(scrbuf, finfo.smem_len);
err_fb:
close(fb_fd);
err_log:
close(log_fd);
return 0;
static int check_conf(void)
{
int data[7];
char *buffer;
int ret;
struct stat s;
/* check conf file */
if (stat(cf_file, &s) == 0) {
/* conf file already existed */
cf_fd = open(cf_file, O_RDWR);
if (cf_fd >= 0) {
buffer = calloc(1, s.st_size + 1);
read(cf_fd, buffer, s.st_size);
ret = sscanf(buffer, "%d\n%d\n%d\n%d\n%d\n%d\n%d",
&data[0], &data[1], &data[2],
&data[3], &data[4], &data[5],
&data[6]);
if (ret == 7) {
free(buffer);
/* write to driver */
write_conf(data);
close(cf_fd);
return 1;
}
log_write("Failed to get datas from conf file: %d\n", ret);
free(buffer);
close(cf_fd);
}
}
return 0;
}
路径 是什么》
/sbin/ts_calibrator
chmod 777 /data/system/calibration
是配置文件把校验给关了
这是默认的
ro.secure=1
ro.allow.mock.location=0
ro.debuggable=0
persist.service.adb.enable=0
系统把校验给关掉了