看板 DFBSD_kernel 關於我們 聯絡資訊
Hey guys, Before I start, I am no APM expert =) If I am correct, this applies to both DragonFly BSD and FreeBSD. The problem is that most applications which call upon APM for battery information such as time remaining assume it to always be in seconds. However, in i386/apm/apm.c we see: /* get power status per battery */ static int apm_get_pwstatus(apm_pwstatus_t app) { struct apm_softc *sc = &apm_softc; if (app->ap_device != PMDV_ALLDEV && (app->ap_device < PMDV_BATT0 || app->ap_device > PMDV_BATT_ALL)) return 1; sc->bios.r.eax = (APM_BIOS << 8) | APM_GETPWSTATUS; sc->bios.r.ebx = app->ap_device; sc->bios.r.ecx = 0; sc->bios.r.edx = 0xffff; /* default to unknown battery time */ if (apm_bioscall()) return 1; app->ap_acline = (sc->bios.r.ebx >> 8) & 0xff; app->ap_batt_stat = sc->bios.r.ebx & 0xff; app->ap_batt_flag = (sc->bios.r.ecx >> 8) & 0xff; app->ap_batt_life = sc->bios.r.ecx & 0xff; sc->bios.r.edx &= 0xffff; if (sc->bios.r.edx == 0xffff) /* Time is unknown */ app->ap_batt_time = -1; <-LOOK HERE-> else if (sc->bios.r.edx & 0x8000) /* Time is in minutes */ app->ap_batt_time = (sc->bios.r.edx & 0x7fff) * 60; <-LOOK HERE-> else /* Time is in seconds */ app->ap_batt_time = sc->bios.r.edx; return 0; }