[Nook Color Android Development] lekofraggle:
Now that I am beginning to understand some things, I began to take a look at some of the things which are broken for me.

The biggest issue is my Nook is not recognizing the ac charger as an ac charger. Are other people having this issue? It only charges as usb.

I am fine on other roms, and my charger is working.

So, I started poking around in the build files, but I do not want to damage my hardware, I poked around the internets and saw this in googles 2.6.29 kernel.

/frameworks/base/services/jni/com_android_server_BatteryService.cpp

static void setIntField(JNIEnv* env, jobject obj, const char* path, jfieldID fieldID)
{
const int SIZE = 128;
char buf[SIZE];

jint value = 0;
if (readFromFile(path, buf, SIZE) > 0) {
value = atoi(buf);
}
env->SetIntField(obj, fieldID, value);
}
static void android_server_BatteryService_update(JNIEnv* env, jobject obj)
{
#if 0
setBooleanField(env, obj, AC_ONLINE_PATH, gFieldIds.mAcOnline);
setBooleanField(env, obj, USB_ONLINE_PATH, gFieldIds.mUsbOnline);
setBooleanField(env, obj, BATTERY_PRESENT_PATH, gFieldIds.mBatteryPresent);

setIntField(env, obj, BATTERY_CAPACITY_PATH, gFieldIds.mBatteryLevel);
setIntField(env, obj, BATTERY_VOLTAGE_PATH, gFieldIds.mBatteryVoltage);
setIntField(env, obj, BATTERY_TEMPERATURE_PATH, gFieldIds.mBatteryTemperature);

const int SIZE = 128;
char buf[SIZE];

if (readFromFile(BATTERY_STATUS_PATH, buf, SIZE) > 0)
env->SetIntField(obj, gFieldIds.mBatteryStatus, getBatteryStatus(buf));

if (readFromFile(BATTERY_HEALTH_PATH, buf, SIZE) > 0)
env->SetIntField(obj, gFieldIds.mBatteryHealth, getBatteryHealth(buf));

if (readFromFile(BATTERY_TECHNOLOGY_PATH, buf, SIZE) > 0)
env->SetObjectField(obj, gFieldIds.mBatteryTechnology, env->NewStringUTF(buf));
#else
env->SetBooleanField(obj, gFieldIds.mAcOnline, true);
env->SetBooleanField(obj, gFieldIds.mUsbOnline, false);
env->SetBooleanField(obj, gFieldIds.mBatteryPresent, false);

env->SetIntField(obj, gFieldIds.mBatteryLevel, 100);
env->SetIntField(obj, gFieldIds.mBatteryVoltage, 15);
env->SetIntField(obj, gFieldIds.mBatteryTemperature, 20);

const int SIZE = 128;
char buf[SIZE];

env->SetIntField(obj, gFieldIds.mBatteryStatus, getBatteryStatus("F"));

env->SetIntField(obj, gFieldIds.mBatteryHealth, getBatteryHealth("G"));

env->SetObjectField(obj, gFieldIds.mBatteryTechnology, env->NewStringUTF("Nemus"));
#endif
static JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"native_update", "()V", (void*)android_server_BatteryService_update},
};

}

But, in mine, it looks like this...

static void setVoltageField(JNIEnv* env, jobject obj, const char* path, jfieldID fieldID)
{
const int SIZE = 128;
char buf[SIZE];

jint value = 0;
if (readFromFile(path, buf, SIZE) > 0) {
value = atoi(buf);
value /= gVoltageDivisor;
}
env->SetIntField(obj, fieldID, value);
}

static void android_server_BatteryService_update(JNIEnv* env, jobject obj)
{
setBooleanField(env, obj, gPaths.acOnlinePath, gFieldIds.mAcOnline);
setBooleanField(env, obj, gPaths.usbOnlinePath, gFieldIds.mUsbOnline);
setBooleanField(env, obj, gPaths.batteryPresentPath, gFieldIds.mBatteryPresent);

setIntField(env, obj, gPaths.batteryCapacityPath, gFieldIds.mBatteryLevel);
setVoltageField(env, obj, gPaths.batteryVoltagePath, gFieldIds.mBatteryVoltage);
setIntField(env, obj, gPaths.batteryTemperaturePath, gFieldIds.mBatteryTemperature);

const int SIZE = 128;
char buf[SIZE];

if (readFromFile(gPaths.batteryStatusPath, buf, SIZE) > 0)
env->SetIntField(obj, gFieldIds.mBatteryStatus, getBatteryStatus(buf));
else
env->SetIntField(obj, gFieldIds.mBatteryStatus,
gConstants.statusUnknown);

if (readFromFile(gPaths.batteryHealthPath, buf, SIZE) > 0)
env->SetIntField(obj, gFieldIds.mBatteryHealth, getBatteryHealth(buf));

if (readFromFile(gPaths.batteryTechnologyPath, buf, SIZE) > 0)
env->SetObjectField(obj, gFieldIds.mBatteryTechnology, env->NewStringUTF(buf));
}

static JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"native_update", "()V", (void*)android_server_BatteryService_update},
};

If, this is an issue other people have too, could it be due to gFieldIds?

.

Any thoughts?

I am using the newest version of our 3.3 kernel. On an emmc install.

~Leko