if (0 == battery_status) ac_line_status = 1; battery_status = 0xff; 
static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length){	/* Arguments, with symbols from linux/apm_bios.h.  Information is	   from the Get Power Status (0x0a) call unless otherwise noted.	   0) Linux driver version (this will change if format changes)	   1) APM BIOS Version.  Usually 1.0, 1.1 or 1.2.	   2) APM flags from APM Installation Check (0x00):	      bit 0: APM_16_BIT_SUPPORT	      bit 1: APM_32_BIT_SUPPORT	      bit 2: APM_IDLE_SLOWS_CLOCK	      bit 3: APM_BIOS_DISABLED	      bit 4: APM_BIOS_DISENGAGED	   3) AC line status	      0x00: Off-line	      0x01: On-line	      0x02: On backup power (BIOS >= 1.1 only)	      0xff: Unknown	   4) Battery status	      0x00: High	      0x01: Low	      0x02: Critical	      0x03: Charging	      0x04: Selected battery not present (BIOS >= 1.2 only)	      0xff: Unknown	   5) Battery flag	      bit 0: High	      bit 1: Low	      bit 2: Critical	      bit 3: Charging	      bit 7: No system battery	      0xff: Unknown	   6) Remaining battery life (percentage of charge):	      0-100: valid	      -1: Unknown	   7) Remaining battery life (time units):	      Number of remaining minutes or seconds	      -1: Unknown	   8) min = minutes; sec = seconds */	unsigned short  ac_line_status = 0xff;	unsigned short  battery_status = 0xff;	unsigned short  battery_flag   = 0xff;	int		percentage     = -1;	int             time_units     = -1;	int		real_count     = 0;	int		i;	char *		p = buf;	char		charging       = 0;	long		charge	       = -1;	long		amperage       = 0;	unsigned long	btype          = 0;	ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0);	for (i=0; i<pmu_battery_count; i++) {		if (pmu_batteries[i].flags & PMU_BATT_PRESENT) {			if (percentage < 0)				percentage = 0;			if (charge < 0)				charge = 0;			percentage += (pmu_batteries[i].charge * 100) /				pmu_batteries[i].max_charge;			charge += pmu_batteries[i].charge;			amperage += pmu_batteries[i].amperage;			if (btype == 0)				btype = (pmu_batteries[i].flags & PMU_BATT_TYPE_MASK);			real_count++;			if ((pmu_batteries[i].flags & PMU_BATT_CHARGING))				charging++;		}	}	if (real_count) {		if (amperage < 0) {			if (btype == PMU_BATT_TYPE_SMART)				time_units = (charge * 59) / (amperage * -1);			else				time_units = (charge * 16440) / (amperage * -60);		}		percentage /= real_count;		if (charging > 0) {			battery_status = 0x03;			battery_flag = 0x08;		} else if (percentage <= APM_CRITICAL) {			battery_status = 0x02;			battery_flag = 0x04;		} else if (percentage <= APM_LOW) {			battery_status = 0x01;			battery_flag = 0x02;		} else {			battery_status = 0x00;			battery_flag = 0x01;		}	}	p += sprintf(p, "%s %d.%d 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n",		     driver_version,		     (FAKE_APM_BIOS_VERSION >> 8) & 0xff,		     FAKE_APM_BIOS_VERSION & 0xff,		     0,		     ac_line_status,		     battery_status,		     battery_flag,		     percentage,		     time_units,		     "min");	return p - buf;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/08124f958997ac14bb2284af787752125a892e9f/apm_emu.c/buggy/drivers/macintosh/apm_emu.c