工模距离感应器校准失败

Vendor/longcheer/proprietary/packages/Midtest/jni/sensor/psensor/com_longcheertel_midtest_LightAProximity.cpp
// This function get  real-time display the PS. 这个函数不断的有信息输出
static jint getPsensorData(JNIEnv *env, jclass clazz) {
	XLOGD("Enter getPsensorData()\n");
	int ret = get_psensor_data(); //这个函数没有找到在哪里有定义, 在vendor/lcsh/libs/libhwm/arm64/libhwm.so matches
	XLOGD("getPsensorData() returned %d\n", ret);

	return ret;
}

//  This function get power-off value    这个函数没有打印信息
static jint getPsensorthresholdvalue(JNIEnv *env, jclass clazz) {
	int ret = get_psensor_threshold_value(); //这个函数在jni/sensor/psensor/sensor.c中有定义
	if(ret == -1 )	
		return -1;
	return ret;
}
Vendor/longcheer/proprietary/packages/Midtest/jni/sensor/psensor/sensor.c

#include "sensor.h"
int get_psensor_threshold_value()
{
	int iFd,iRs;
	int val,enable=1,disable=0;
#if 1   //当初这里被注释掉,所以导致校准失败
	iFd = open("dev/als_ps",O_RDONLY);
	if(iFd <0)
	{
		printf("can't open\n");   
		return -1;
	}
	iRs = ioctl(iFd,ALSPS_GET_PS_RAW_DATA,&val);
	if(iRs == -1)
	{
		printf("can't ioctl\n");   
		close(iFd);
		return -1;
	}
	close(iFd);
	printf("lijun OK");
#endif
	return val;
} 
Vendor/longcheer/proprietary/packages/Midtest/src/com/loncheertel/midtest/codeshare/sensor/LightAProximity.java //*#88# 工模用

Vendor/longcheer/proprietary/packages/Midtest/src/com/loncheertel/midtest/codeshare/sensor/LightAProximityCab.java //*#87# 工模用
private void calibration(int what){ // 这个函数会被不断调用
public void onSensorChanged(SensorEvent event){
          if(event.values[] == 10){//屏幕变颜色

 

转载于:https://my.oschina.net/u/592470/blog/1140887

你可能感兴趣的:(工模距离感应器校准失败)