summaryrefslogtreecommitdiff
path: root/battstat/apmlib
diff options
context:
space:
mode:
Diffstat (limited to 'battstat/apmlib')
-rw-r--r--battstat/apmlib/apm.h8
-rw-r--r--battstat/apmlib/apmlib.c6
2 files changed, 7 insertions, 7 deletions
diff --git a/battstat/apmlib/apm.h b/battstat/apmlib/apm.h
index fd1f6eb6..5b44ab71 100644
--- a/battstat/apmlib/apm.h
+++ b/battstat/apmlib/apm.h
@@ -41,10 +41,10 @@ typedef struct apm_info
const char driver_version[10];
int apm_version_major;
int apm_version_minor;
- int apm_flags;
- int ac_line_status;
- int battery_status;
- int battery_flags;
+ unsigned short apm_flags;
+ unsigned short ac_line_status;
+ unsigned short battery_status;
+ unsigned short battery_flags;
int battery_percentage;
int battery_time;
int using_minutes;
diff --git a/battstat/apmlib/apmlib.c b/battstat/apmlib/apmlib.c
index 0e9946cd..e15bb541 100644
--- a/battstat/apmlib/apmlib.c
+++ b/battstat/apmlib/apmlib.c
@@ -68,7 +68,7 @@ int apm_read(apm_info * i)
/* Should check for other driver versions; driver 1.9 (and some
* others) uses this format, which doesn't expose # batteries.
*/
- sscanf(buffer, "%s %d.%d %x %x %x %x %d%% %d %s\n",
+ sscanf(buffer, "%s %d.%d %hx %hx %hx %hx %d%% %d %s\n",
(char *) i->driver_version,
&i->apm_version_major,
&i->apm_version_minor,
@@ -102,7 +102,7 @@ int apm_read(apm_info * i)
if (fgets(buffer, sizeof(buffer) - 1, str) == NULL)
printf("fgets error\n");
- sscanf(buffer, "Flags: 0x%02x", &i->apm_flags);
+ sscanf(buffer, "Flags: 0x%02hx", &i->apm_flags);
if (i->apm_flags & APM_32_BIT_SUPPORT)
{
if (fgets(buffer, sizeof(buffer) - 1, str) == NULL)
@@ -142,7 +142,7 @@ int apm_read(apm_info * i)
if (fgets(buffer, sizeof(buffer) - 1, str) == NULL)
printf("fgets error\n");
- sscanf(buffer, "Battery flag: 0x%02x", &i->battery_flags);
+ sscanf(buffer, "Battery flag: 0x%02hx", &i->battery_flags);
if (fgets(buffer, sizeof(buffer) - 1, str) == NULL)
printf("fgets error\n");