Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r4295 - in developers/zecke: . apm_bios_test
      ([EMAIL PROTECTED])
   2. r4296 - trunk/src/host/devirginator ([EMAIL PROTECTED])
--- Begin Message ---
Author: zecke
Date: 2008-04-01 22:47:14 +0200 (Tue, 01 Apr 2008)
New Revision: 4295

Added:
   developers/zecke/apm_bios_test/
   developers/zecke/apm_bios_test/apm_bios_test.c
Log:
Add my simple apm test to see if one can delay going to suspend. One can.


Added: developers/zecke/apm_bios_test/apm_bios_test.c
===================================================================
--- developers/zecke/apm_bios_test/apm_bios_test.c      2008-04-01 19:54:23 UTC 
(rev 4294)
+++ developers/zecke/apm_bios_test/apm_bios_test.c      2008-04-01 20:47:14 UTC 
(rev 4295)
@@ -0,0 +1,85 @@
+/*
+ * (C) Copyright 2008 Openmoko Inc.
+ *
+ * Simple utility to test the apm_bio acknowledge feature
+ *
+ * Trying to read just event will give mysterious failures. Other
+ * than that a pretty easy interface to use
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+
+#include <linux/apm_bios.h>
+
+static void user_suspend(int fd)
+{
+    sleep(3); 
+    printf("Ack'ing suspend now\n");
+    ioctl(fd, APM_IOC_SUSPEND, NULL);
+    printf("Resumed now\n");
+}
+
+
+int main(int argc, char** argv)
+{
+    int apm_bios_fd = open("/dev/apm_bios", O_RDWR);
+    if (apm_bios_fd < 0) {
+        perror("apm_bios");
+        return EXIT_FAILURE;
+    }
+
+    apm_event_t event[16];
+    while (1) {
+        fd_set rfds;
+        struct timeval tv;
+        int retval;
+        int i;
+
+        FD_ZERO(&rfds);
+        FD_SET(apm_bios_fd, &rfds);
+        retval = select(apm_bios_fd + 1, &rfds, NULL, NULL, NULL);
+        if (retval == -1)
+            perror("select()");
+        else if (retval) {
+            retval = read(apm_bios_fd, (void*)&event, sizeof(event));
+            if (retval < 0) {
+                perror("Failed to read");
+                continue;
+            }
+
+            for (i= 0; i < retval/sizeof(apm_event_t); ++i) {
+#define HANDLE(x) \
+    case x: printf("%s: %u\n", #x, event[i]); \
+    break;
+#define HANDLE_CALL(x, y) \
+    case x: printf("%s: %u\n", #x, event[i]); \
+    y \
+    break;
+                switch(event[i]) {
+                    HANDLE(APM_SYS_STANDBY)
+                    HANDLE(APM_SYS_SUSPEND)
+                    HANDLE(APM_NORMAL_RESUME)
+                    HANDLE(APM_CRITICAL_RESUME)
+                    HANDLE(APM_LOW_BATTERY)
+                    HANDLE(APM_POWER_STATUS_CHANGE)
+                    HANDLE(APM_UPDATE_TIME)
+                    HANDLE(APM_CRITICAL_SUSPEND)
+                    HANDLE(APM_USER_STANDBY)
+                    HANDLE_CALL(APM_USER_SUSPEND, user_suspend(apm_bios_fd);)
+                    HANDLE(APM_STANDBY_RESUME)
+                    HANDLE(APM_CAPABILITY_CHANGE)
+                };
+            }
+        }
+    }
+
+
+    perror("reading");
+    return EXIT_FAILURE;
+}


Property changes on: developers/zecke/apm_bios_test/apm_bios_test.c
___________________________________________________________________
Name: svn:eol-style
   + native




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-04-02 00:50:31 +0200 (Wed, 02 Apr 2008)
New Revision: 4296

Modified:
   trunk/src/host/devirginator/setup.sh
Log:
A few trivial cosmetic changes that have been long overdue.

- setup.sh: include configuration file name and build date in the "devirginate"
  script we generate
- setup.sh: in the instructions at the end, also mention to start openocd



Modified: trunk/src/host/devirginator/setup.sh
===================================================================
--- trunk/src/host/devirginator/setup.sh        2008-04-01 20:47:14 UTC (rev 
4295)
+++ trunk/src/host/devirginator/setup.sh        2008-04-01 22:50:31 UTC (rev 
4296)
@@ -351,6 +351,9 @@
 cat <<EOF >devirginate
 #!/bin/sh -e
 # MACHINE-GENERATED. DO NOT EDIT !
+#
+# From "`echo $config`", `date`
+#
 echo ===== STARTING ===========================================================
 
 stage0=false
@@ -443,6 +446,7 @@
 
 - connect it to power and JTAG
 - switch it on
+- start openocd from directory .
 - run ./devirginate
 - follow the progress, as described in README
 
@@ -458,6 +462,7 @@
 
 - connect it to power and JTAG
 - switch it on
+- start openocd from directory `pwd`
 - run ./devirginate
 - follow the process, as described in README
 




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to