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. r3327 - trunk/src/host/qemu-neo1973 ([EMAIL PROTECTED])
   2. r3328 - in
      trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb: .
      src ([EMAIL PROTECTED])
   3. r3329 - in
      trunk/src/target/OM-2007.2/applications/openmoko-appmanager2: .
      src ([EMAIL PROTECTED])
   4. r3330 - in
      trunk/src/target/OM-2007.2/applications/openmoko-appmanager2: .
      src ([EMAIL PROTECTED])
   5. r3331 - in
      trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb: .
      src ([EMAIL PROTECTED])
   6. r3332 - trunk/src/target/OM-2007.2/daemons/neod/src
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: andrew
Date: 2007-11-02 03:23:08 +0100 (Fri, 02 Nov 2007)
New Revision: 3327

Modified:
   trunk/src/host/qemu-neo1973/pty.c
Log:
Avoid spinning after the slave pty closes.


Modified: trunk/src/host/qemu-neo1973/pty.c
===================================================================
--- trunk/src/host/qemu-neo1973/pty.c   2007-11-01 18:35:44 UTC (rev 3326)
+++ trunk/src/host/qemu-neo1973/pty.c   2007-11-02 02:23:08 UTC (rev 3327)
@@ -22,6 +22,7 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netdb.h>
+#include <poll.h>
 
 #define CHECK(val, name)       \
        if (val == -1) {        \
@@ -32,7 +33,8 @@
 #define min(a, b)      ((a) < (b) ? (a) : (b))
 #define max(a, b)      ((a) > (b) ? (a) : (b))
 
-static int forward2(int in0, int out0, int in1, int out1) {
+static int forward2(int in0, int out0, int in1, int out1,
+               int (*closed)(int fd)) {
        int inpos = 0, inlen = 0, outpos = 0, outlen = 0, ret, n;
        fd_set rfds, wfds;
        char in[0x100], out[0x100];
@@ -66,6 +68,13 @@
                                        sizeof(out) - max(ret, outlen));
                        if (ret > 0)
                                outlen += ret;
+                       if (ret < 0 && errno == EIO && closed) {
+                               in1 = out0 = closed(in1);
+                               if (in1 < 0)
+                                       return in1;
+                               n = max(max(in0, in1), max(out0, out1)) + 1;
+                               continue;
+                       }
                }
                if (FD_ISSET(out0, &wfds)) {
                        ret = write(out0, in + inpos,
@@ -88,6 +97,19 @@
        return pause();
 }
 
+static int reopen(int fd) {
+       const char *name = ttyname(fd);
+
+       CHECK(close(fd), close(pty));
+       fd = open(name, O_RDWR | O_NOCTTY);
+       CHECK(fd, open);
+       CHECK(grantpt(fd), grantpt);
+       CHECK(unlockpt(fd), unlockpt);
+
+       fprintf(stderr, "%s\n", ptsname(fd));
+       return fd;
+}
+
 int main(int argc, char *argv[], char **envp) {
        int sock, fd;
        struct sockaddr_in sa;
@@ -108,7 +130,7 @@
        return pause();
 #endif
        if (argc != 3)
-               return forward2(0, fd, fd, 1);
+               return forward2(0, fd, fd, 1, reopen);
 
 #if 0
        /* Connect a sub-process with a pty */
@@ -121,7 +143,7 @@
        i = fileno(popen(param, O_RDWR));
        CHECK(i, popen);
        free(param);
-       return forward2(i, fd, fd, i);
+       return forward2(i, fd, fd, i, reopen);
 #endif
 
        /* Connect a TCP socket with a pty */
@@ -137,5 +159,5 @@
 
        CHECK(sock, socket);
        CHECK(connect(sock, (struct sockaddr *) &sa, sizeof(sa)), connect);
-       return forward2(sock, fd, fd, sock);
+       return forward2(sock, fd, fd, sock, reopen);
 }




--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-11-02 09:19:21 +0100 (Fri, 02 Nov 2007)
New Revision: 3328

Modified:
   trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac
   
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
Log:
openmoko-panel-usb: remove usb code, add dbus listener


Modified: 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac
===================================================================
--- trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac    
2007-11-02 02:23:08 UTC (rev 3327)
+++ trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac    
2007-11-02 08:19:21 UTC (rev 3328)
@@ -11,7 +11,7 @@
 AC_PROG_LIBTOOL
 
 # base deps
-PKG_CHECK_MODULES(OPENMOKO, libmokopanelui2 libusb)
+PKG_CHECK_MODULES(OPENMOKO, libmokopanelui2 dbus-glib-1)
 
 LIBS="$LIBS $OPENMOKO_LIBS"
 CFLAGS="$CFLAGS $OPENMOKO_CFLAGS"

Modified: 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
===================================================================
--- 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
        2007-11-02 02:23:08 UTC (rev 3327)
+++ 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
        2007-11-02 08:19:21 UTC (rev 3328)
@@ -15,10 +15,7 @@
  */
 #include <libmokopanelui2/moko-panel-applet.h>
 
-#include <sys/types.h>
-#include <linux/limits.h>
-#include <usb.h>
-
+#include <dbus/dbus-glib.h>
 #include <gtk/gtkimage.h>
 #include <time.h>
 
@@ -33,120 +30,39 @@
     g_slice_free (UsbApplet, applet);
 }
 
-void print_endpoint(struct usb_endpoint_descriptor *endpoint)
+static void usb_applet_dbus_signal( void* data )
 {
-    printf(" bEndpointAddress: %02xh\n", endpoint->bEndpointAddress);
-    printf(" bmAttributes: %02xh\n", endpoint->bmAttributes);
-    printf(" wMaxPacketSize: %d\n", endpoint->wMaxPacketSize);
-    printf(" bInterval: %d\n", endpoint->bInterval);
-    printf(" bRefresh: %d\n", endpoint->bRefresh);
-    printf(" bSynchAddress: %d\n", endpoint->bSynchAddress);
+    g_debug( "usb_applet_dbus_signal: received signal. data pointer = %p", 
data );
 }
 
-void print_altsetting(struct usb_interface_descriptor *interface)
-{
-    int i;
+#define USB_DBUS_SERVICE      "com.burtonini"
+#define USB_DBUS_PATH         "/com/burtonini"
+#define USB_DBUS_INTERFACE    "com.burtonini"
 
-    printf(" bInterfaceNumber: %d\n", interface->bInterfaceNumber);
-    printf(" bAlternateSetting: %d\n", interface->bAlternateSetting);
-    printf(" bNumEndpoints: %d\n", interface->bNumEndpoints);
-    printf(" bInterfaceClass: %d\n", interface->bInterfaceClass);
-    printf(" bInterfaceSubClass: %d\n", interface->bInterfaceSubClass);
-    printf(" bInterfaceProtocol: %d\n", interface->bInterfaceProtocol);
-    printf(" iInterface: %d\n", interface->iInterface);
-
-    for (i = 0; i < interface->bNumEndpoints; i++)
-        print_endpoint(&interface->endpoint[i]);
-}
-
-void print_interface(struct usb_interface *interface)
+static void usb_applet_init_dbus( UsbApplet* applet )
 {
-    int i;
+    GError* error = NULL;
+    DBusGConnection* bus = dbus_g_bus_get( DBUS_BUS_SESSION, &error );
 
-    for (i = 0; i < interface->num_altsetting; i++)
-        print_altsetting(&interface->altsetting[i]);
-}
+    if (error)
+    {
+        g_warning( "%s: Error acquiring session bus: %s", G_STRLOC, 
error->message );
+        return;
+    }
 
-void print_configuration(struct usb_config_descriptor *config)
-{
-    int i;
+    DBusGProxy* usb_control_interface = dbus_g_proxy_new_for_name( bus, 
USB_DBUS_SERVICE, USB_DBUS_PATH, USB_DBUS_INTERFACE );
+    if ( !usb_control_interface )
+    {
+        g_warning( "Could not connect to USB dbus service" );
+        return;
+    }
 
-    printf(" wTotalLength: %d\n", config->wTotalLength);
-    printf(" bNumInterfaces: %d\n", config->bNumInterfaces);
-    printf(" bConfigurationValue: %d\n", config->bConfigurationValue);
-    printf(" iConfiguration: %d\n", config->iConfiguration);
-    printf(" bmAttributes: %02xh\n", config->bmAttributes);
-    printf(" MaxPower: %d\n", config->MaxPower);
-
-    for (i = 0; i < config->bNumInterfaces; i++)
-        print_interface(&config->interface[i]);
+    dbus_g_proxy_add_signal( usb_control_interface, "SignalTest", 
G_TYPE_INVALID );
+    dbus_g_proxy_connect_signal( usb_control_interface, "SignalTest", 
G_CALLBACK(usb_applet_dbus_signal), NULL, NULL );
 }
 
-static void usb_applet_dump_usb_status()
+static void usb_applet_update_status( UsbApplet* applet )
 {
-    struct usb_bus *bus;
-    struct usb_device *dev;
-    printf("bus/device idVendor/idProduct\n");
-
-    for (bus = usb_busses; bus; bus = bus->next) {
-        for (dev = bus->devices; dev; dev = dev->next) {
-            int ret, i;
-            char string[256];
-            usb_dev_handle *udev;
-
-            printf("%s/%s %04X/%04X\n", bus->dirname, dev->filename,
-                dev->descriptor.idVendor, dev->descriptor.idProduct);
-
-            udev = usb_open(dev);
-            if (udev) {
-                if (dev->descriptor.iManufacturer) {
-                    ret = usb_get_string_simple(udev, 
dev->descriptor.iManufacturer, string, sizeof(string));
-                    if (ret > 0)
-                        printf("- Manufacturer : %s\n", string);
-                    else
-                        printf("- Unable to fetch manufacturer string\n");
-                }
-
-                if (dev->descriptor.iProduct) {
-                    ret = usb_get_string_simple(udev, 
dev->descriptor.iProduct, string, sizeof(string));
-                    if (ret > 0)
-                        printf("- Product : %s\n", string);
-                    else
-                        printf("- Unable to fetch product string\n");
-                }
-
-                if (dev->descriptor.iSerialNumber) {
-                    ret = usb_get_string_simple(udev, 
dev->descriptor.iSerialNumber, string, sizeof(string));
-                    if (ret > 0)
-                        printf("- Serial Number: %s\n", string);
-                    else
-                        printf("- Unable to fetch serial number string\n");
-                }
-
-                usb_close (udev);
-            }
-
-            if (!dev->config) {
-                printf(" Couldn't retrieve descriptors\n");
-                continue;
-            }
-
-            for (i = 0; i < dev->descriptor.bNumConfigurations; i++)
-                print_configuration(&dev->config[i]);
-        }
-    }
-}
-
-static void usb_applet_update_status( UsbApplet *applet )
-{
-    usb_init();
-    int new_busses = usb_find_busses();
-    g_debug( "usb_applet_update_status: %d new USBes found", new_busses );
-    int new_devices = usb_find_devices();
-    g_debug( "usb_applet_update_status: %d new USB devices found", new_devices 
);
-
-    usb_applet_dump_usb_status();
-
     moko_panel_applet_set_icon( applet->mpa, PKGDATADIR "/Usb.png" );
 
 }
@@ -163,6 +79,7 @@
     applet = g_slice_new( UsbApplet );
     applet->mpa = mokoapplet;
 
+    usb_applet_init_dbus( applet );
     usb_applet_update_status( applet );
 
     gtk_widget_show_all( GTK_WIDGET(mokoapplet) );




--- End Message ---
--- Begin Message ---
Author: thomas
Date: 2007-11-02 10:23:50 +0100 (Fri, 02 Nov 2007)
New Revision: 3329

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog
   
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/navigation-area.c
   trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/tool-box.c
Log:
* src/navigation-area.c: (navigation_area_new):
* src/tool-box.c: (tool_box_new):

Fix compiler warnings


Modified: trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog      
2007-11-02 08:19:21 UTC (rev 3328)
+++ trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog      
2007-11-02 09:23:50 UTC (rev 3329)
@@ -1,3 +1,10 @@
+2007-11-02  Thomas Wood  <[EMAIL PROTECTED]>
+
+       * src/navigation-area.c: (navigation_area_new):
+       * src/tool-box.c: (tool_box_new):
+
+       Fix compiler warnings
+
 2007-10-29     Michael Lauer <[EMAIL PROTECTED]>
 
        * data/openmoko-appmanager.desktop:

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/navigation-area.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/navigation-area.c
  2007-11-02 08:19:21 UTC (rev 3328)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/navigation-area.c
  2007-11-02 09:23:50 UTC (rev 3329)
@@ -153,7 +153,7 @@
 
   treeview = gtk_tree_view_new ();
   gtk_widget_show (treeview);
-  gtk_tree_view_set_headers_visible (treeview, FALSE);
+  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
   gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview), FALSE);
 
   /* Add the status as the first column. */

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/tool-box.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/tool-box.c 
2007-11-02 08:19:21 UTC (rev 3328)
+++ trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/tool-box.c 
2007-11-02 09:23:50 UTC (rev 3329)
@@ -181,7 +181,7 @@
                     G_CALLBACK (on_upgrade_clicked), 
                     appdata);
   gtk_toolbar_insert (GTK_TOOLBAR (toolbox), bupgrade, -1);
-  gtk_container_child_set (GTK_CONTAINER (toolbox), bupgrade, "expand", TRUE, 
NULL);
+  gtk_container_child_set (GTK_CONTAINER (toolbox), GTK_WIDGET (bupgrade), 
"expand", TRUE, NULL);
 
   anImage = gtk_image_new_from_file (PKGDATADIR "/Apply.png");
   bapply = gtk_tool_button_new (anImage, "Apply");
@@ -189,7 +189,7 @@
                     G_CALLBACK (on_apply_clicked), 
                     appdata);
   gtk_toolbar_insert (GTK_TOOLBAR (toolbox), bapply, -1);
-  gtk_container_child_set (GTK_CONTAINER (toolbox), bapply, "expand", TRUE, 
NULL);
+  gtk_container_child_set (GTK_CONTAINER (toolbox), GTK_WIDGET (bapply), 
"expand", TRUE, NULL);
 #if 0
   searchentry = moko_tool_box_get_entry (toolbox);
   application_manager_data_set_search_entry (appdata, GTK_ENTRY (searchentry));




--- End Message ---
--- Begin Message ---
Author: thomas
Date: 2007-11-02 10:53:28 +0100 (Fri, 02 Nov 2007)
New Revision: 3330

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog
   
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/detail-area.c
   
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/navigation-area.c
Log:
* src/detail-area.c: (detail_area_new):
* src/navigation-area.c: (navigation_area_new):

Use MokoFingerScroll instead of GtkScrolledWindow. Fixes bug 960


Modified: trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog      
2007-11-02 09:23:50 UTC (rev 3329)
+++ trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ChangeLog      
2007-11-02 09:53:28 UTC (rev 3330)
@@ -1,6 +1,13 @@
 2007-11-02  Thomas Wood  <[EMAIL PROTECTED]>
 
+       * src/detail-area.c: (detail_area_new):
        * src/navigation-area.c: (navigation_area_new):
+
+       Use MokoFingerScroll instead of GtkScrolledWindow. Fixes bug 960
+
+2007-11-02  Thomas Wood  <[EMAIL PROTECTED]>
+
+       * src/navigation-area.c: (navigation_area_new):
        * src/tool-box.c: (tool_box_new):
 
        Fix compiler warnings

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/detail-area.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/detail-area.c  
    2007-11-02 09:23:50 UTC (rev 3329)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/detail-area.c  
    2007-11-02 09:53:28 UTC (rev 3330)
@@ -19,6 +19,8 @@
  */
 #include <string.h>
 
+#include <moko-finger-scroll.h>
+
 #include "detail-area.h"
 #include "navigation-area.h"
 #include "package-list.h"
@@ -34,11 +36,13 @@
   GtkWidget    *text;
   GtkWidget    *detail;
 
-  detail = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (detail),
-     GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+  detail = moko_finger_scroll_new_full (MOKO_FINGER_SCROLL_MODE_PUSH,
+      TRUE, 0, 0, 0, 15);
 
   text = gtk_text_view_new ();
+
+  g_object_set (G_OBJECT (text), "editable", FALSE, "cursor-visible", FALSE, 
NULL);
+
   gtk_widget_show (text);
   gtk_text_view_set_editable (GTK_TEXT_VIEW (text), FALSE);
   gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (text), FALSE);

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/navigation-area.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/navigation-area.c
  2007-11-02 09:23:50 UTC (rev 3329)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/src/navigation-area.c
  2007-11-02 09:53:28 UTC (rev 3330)
@@ -13,11 +13,12 @@
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU Public License for more details.
  *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- *
- *  @author Chaowei Song ([EMAIL PROTECTED])
+ *  Authors:
+ *    Chaowei Song <[EMAIL PROTECTED]>
+ *    OpenedHand Ltd. <[EMAIL PROTECTED]>
  */
 #include <string.h>
+#include <moko-finger-scroll.h>
 
 #include "appmanager-window.h"
 #include "navigation-area.h"
@@ -202,9 +203,7 @@
   gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW 
(treeview)),
                                GTK_SELECTION_SINGLE);
 
-  scrollwindow = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwindow),
-     GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+  scrollwindow = moko_finger_scroll_new ();
   gtk_container_add (GTK_CONTAINER (scrollwindow), treeview);
   application_manager_data_set_tvpkglist (appdata, treeview);
 




--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-11-02 11:40:48 +0100 (Fri, 02 Nov 2007)
New Revision: 3331

Modified:
   trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac
   
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
Log:
openmoko-panel-usb: listen to charger connection/disconnection events via dbus


Modified: 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac
===================================================================
--- trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac    
2007-11-02 09:53:28 UTC (rev 3330)
+++ trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/configure.ac    
2007-11-02 10:40:48 UTC (rev 3331)
@@ -11,7 +11,7 @@
 AC_PROG_LIBTOOL
 
 # base deps
-PKG_CHECK_MODULES(OPENMOKO, libmokopanelui2 dbus-glib-1)
+PKG_CHECK_MODULES(OPENMOKO, libmokopanelui2 dbus-1 dbus-glib-1)
 
 LIBS="$LIBS $OPENMOKO_LIBS"
 CFLAGS="$CFLAGS $OPENMOKO_CFLAGS"

Modified: 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
===================================================================
--- 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
        2007-11-02 09:53:28 UTC (rev 3330)
+++ 
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/src/openmoko-panel-usb.c
        2007-11-02 10:40:48 UTC (rev 3331)
@@ -15,6 +15,7 @@
  */
 #include <libmokopanelui2/moko-panel-applet.h>
 
+#include <dbus/dbus.h>
 #include <dbus/dbus-glib.h>
 #include <gtk/gtkimage.h>
 #include <time.h>
@@ -35,30 +36,50 @@
     g_debug( "usb_applet_dbus_signal: received signal. data pointer = %p", 
data );
 }
 
-#define USB_DBUS_SERVICE      "com.burtonini"
-#define USB_DBUS_PATH         "/com/burtonini"
-#define USB_DBUS_INTERFACE    "com.burtonini"
+#define USB_DBUS_SERVICE      "org.freedesktop.PowerManagement"
+#define USB_DBUS_PATH         "/org/freedesktop/PowerManagement"
+#define USB_DBUS_INTERFACE    "org.freesmartphone.powermanagement"
 
-static void usb_applet_init_dbus( UsbApplet* applet )
+DBusHandlerResult signal_filter (DBusConnection *bus, DBusMessage *msg, void 
*user_data)
 {
-    GError* error = NULL;
-    DBusGConnection* bus = dbus_g_bus_get( DBUS_BUS_SESSION, &error );
-
-    if (error)
+    g_debug( "signal_filter" );
+    if ( dbus_message_is_signal( msg, USB_DBUS_INTERFACE, "ChargerConnected" ) 
)
     {
-        g_warning( "%s: Error acquiring session bus: %s", G_STRLOC, 
error->message );
-        return;
+        g_debug( "connected" );
+        return DBUS_HANDLER_RESULT_HANDLED;
     }
+    else if ( dbus_message_is_signal( msg, USB_DBUS_INTERFACE, 
"ChargerDisconnected" ) )
+    {
+        g_debug( "disconnected" );
+        return DBUS_HANDLER_RESULT_HANDLED;
+    }
 
-    DBusGProxy* usb_control_interface = dbus_g_proxy_new_for_name( bus, 
USB_DBUS_SERVICE, USB_DBUS_PATH, USB_DBUS_INTERFACE );
-    if ( !usb_control_interface )
+    g_debug( "(unknown dbus message, ignoring" );
+    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static void usb_applet_init_dbus( UsbApplet* applet )
+{
+    DBusError error;
+    dbus_error_init (&error);
+
+    /* Get a connection to the session bus */
+    DBusConnection* bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
+    if (!bus)
     {
-        g_warning( "Could not connect to USB dbus service" );
-        return;
+        gchar buffer[100];
+        sprintf (buffer, "Failed to connect to the D-BUS daemon: %s", 
error.message);
+        g_critical (buffer);
+        dbus_error_free (&error);
+        return ;
     }
+    g_debug("Connection to bus successfully made");
 
-    dbus_g_proxy_add_signal( usb_control_interface, "SignalTest", 
G_TYPE_INVALID );
-    dbus_g_proxy_connect_signal( usb_control_interface, "SignalTest", 
G_CALLBACK(usb_applet_dbus_signal), NULL, NULL );
+    dbus_connection_setup_with_g_main (bus, NULL);
+
+    dbus_bus_add_match (bus, "type='signal'", &error);
+    dbus_connection_add_filter (bus, signal_filter, NULL, NULL);
+
 }
 
 static void usb_applet_update_status( UsbApplet* applet )




--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-11-02 11:44:59 +0100 (Fri, 02 Nov 2007)
New Revision: 3332

Modified:
   trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c
Log:
neod: call dbus-send on charger insertion/removal


Modified: trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c
===================================================================
--- trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c 2007-11-02 
10:40:48 UTC (rev 3331)
+++ trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c 2007-11-02 
10:44:59 UTC (rev 3332)
@@ -61,6 +61,7 @@
 #endif
 
 #define HEADPHONE_INSERTION_SWITCHCODE 0x02
+#define CHARGER_INSERTION_BUTTON 0xa4
 
 GPollFD input_fd[10];
 int max_input_fd = 0;
@@ -316,6 +317,27 @@
                 }
             }
             else
+            if ( event.type == 1 && event.code == CHARGER_INSERTION_BUTTON )
+            {
+                if ( event.value == 1 ) /* pressed */
+                {
+                    g_debug( "charger IN" );
+                    neod_buttonactions_sound_play( "touchscreen" );
+                    g_spawn_command_line_async( "dbus-send 
/org/freedesktop/PowerManagement 
org.freesmartphone.powermanagement.ChargerConnected", NULL );
+                }
+                else if ( event.value == 0 ) /* released */
+                {
+                    g_debug( "charger OUT" );
+                    g_spawn_command_line_async( "dbus-send 
/org/freedesktop/PowerManagement 
org.freesmartphone.powermanagement.ChargerDisconnected", NULL );
+                }
+                neod_buttonactions_powersave_reset();
+                if ( power_state != NORMAL )
+                {
+                    neod_buttonactions_set_display( 100 );
+                    power_state = NORMAL;
+                }
+            }
+            else
             if ( event.type == 5 && event.code == 
HEADPHONE_INSERTION_SWITCHCODE )
             {
                 if ( event.value == 0 ) /* inserted */
@@ -555,6 +577,7 @@
         gtk_menu_shell_append( GTK_MENU_SHELL(aux_menu), fullscreen );
 
         GtkWidget* orientation = gtk_menu_item_new_with_label( "Swap 
Orientation" );
+        gtk_widget_set_size_request( orientation, 600, 600 );
         g_signal_connect( G_OBJECT(orientation), "activate", 
G_CALLBACK(neod_buttonactions_popup_selected_orientation), NULL );
         gtk_menu_shell_append( GTK_MENU_SHELL(aux_menu), orientation );
 




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

Reply via email to