[maemo-commits] [maemo-commits] r15806 - in projects/haf/trunk/ke-recv: debian src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Jul 22 15:19:46 EEST 2008
Author: kihamala
Date: 2008-07-22 15:19:38 +0300 (Tue, 22 Jul 2008)
New Revision: 15806

Modified:
   projects/haf/trunk/ke-recv/debian/changelog
   projects/haf/trunk/ke-recv/debian/control
   projects/haf/trunk/ke-recv/debian/init.d
   projects/haf/trunk/ke-recv/src/events.c
   projects/haf/trunk/ke-recv/src/ke-recv.c
   projects/haf/trunk/ke-recv/src/osso-usb-mass-storage-enable.sh
Log:
initial fremantle version


Modified: projects/haf/trunk/ke-recv/debian/changelog
===================================================================
--- projects/haf/trunk/ke-recv/debian/changelog	2008-07-22 11:02:28 UTC (rev 15805)
+++ projects/haf/trunk/ke-recv/debian/changelog	2008-07-22 12:19:38 UTC (rev 15806)
@@ -1,8 +1,10 @@
-ke-recv (2.27-2~unreleased) unstable; urgency=low
+ke-recv (3.0-1~unreleased) unstable; urgency=low
 
+  * Initial Fremantle version. This is very much broken, basically only
+    automatic mounting works. Has some workarounds for HAL bugs.
   * Tuned source headers a bit before open-sourcing (wohoo!).
 
- -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Fri, 16 May 2008 16:18:27 +0300
+ -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Tue, 22 Jul 2008 15:11:43 +0300
 
 ke-recv (2.27-1) unstable; urgency=low
 

Modified: projects/haf/trunk/ke-recv/debian/control
===================================================================
--- projects/haf/trunk/ke-recv/debian/control	2008-07-22 11:02:28 UTC (rev 15805)
+++ projects/haf/trunk/ke-recv/debian/control	2008-07-22 12:19:38 UTC (rev 15806)
@@ -7,7 +7,7 @@
 
 Package: ke-recv
 Architecture: any
-Depends: ${shlibs:Depends}, ke-recv-l10n-mr | ke-recv-l10n-mr0, dosfstools (>= 2.11-0osso9), gconf2, osso-af-startup (>= 1.22), mtools, hal, hildon-status-bar-usb-l10n-mr0 | hildon-status-bar-usb-l10n-mr, osso-filemanager-l10n-mr0 | osso-filemanager-l10n-mr
+Depends: ${shlibs:Depends}, ke-recv-l10n-mr | ke-recv-l10n-mr0, gconf2, osso-af-startup (>= 1.22), hal
 Description: Program for automatical mounting and unmounting of memory cards.
  Program for receiving HW events from the HAL, managing mounting, renaming,
  formatting, and partitioning of memory cards, etc.

Modified: projects/haf/trunk/ke-recv/debian/init.d
===================================================================
--- projects/haf/trunk/ke-recv/debian/init.d	2008-07-22 11:02:28 UTC (rev 15805)
+++ projects/haf/trunk/ke-recv/debian/init.d	2008-07-22 12:19:38 UTC (rev 15806)
@@ -42,6 +42,10 @@
 
 source /etc/osso-af-init/af-defines.sh
 
+# FIXME: these should come from startup scripts
+export MMC_MOUNTPOINT='/media/mmc1'
+export INTERNAL_MMC_MOUNTPOINT='/media/mmc2'
+
 /sbin/lsmod | grep g_ether > /dev/null
 if [ $? = 0 ]; then
   echo "$DESC: g_ether loaded, ignoring USB cable"

Modified: projects/haf/trunk/ke-recv/src/events.c
===================================================================
--- projects/haf/trunk/ke-recv/src/events.c	2008-07-22 11:02:28 UTC (rev 15805)
+++ projects/haf/trunk/ke-recv/src/events.c	2008-07-22 12:19:38 UTC (rev 15806)
@@ -1174,6 +1174,10 @@
 int handle_event(mmc_event_t e, mmc_info_t *mmc, const char *arg)
 {
         int ret = 1;
+        if (mmc->whole_device == NULL) {
+                ULOG_DEBUG_F("whole_device unknown for %s", mmc->name);
+                return ret;
+        }
         switch (mmc->state) {
                 case S_COVER_OPEN:
                         ret = event_in_cover_open(e, mmc, arg);

Modified: projects/haf/trunk/ke-recv/src/ke-recv.c
===================================================================
--- projects/haf/trunk/ke-recv/src/ke-recv.c	2008-07-22 11:02:28 UTC (rev 15805)
+++ projects/haf/trunk/ke-recv/src/ke-recv.c	2008-07-22 12:19:38 UTC (rev 15806)
@@ -1423,35 +1423,37 @@
         mmc_keys_set = TRUE;
 }
 
-static void init_card(const char *udi)
+static int init_card(const char *udi, int internal)
 {
-        int internal;
         mmc_info_t *mmc;
+#if 0  /* slot_name is not provided yet */
         char *slot;
 
         slot = get_prop_string(udi, "mmc_host.slot_name");
-        if (slot == NULL) {
-                ULOG_ERR_F("couldn't get mmc_host.slot_name for %s", udi);
-                return;
-        }
 
-        if (strcmp(slot, "external") == 0) {
+        if (slot == NULL || strcmp(slot, "slot:external") == 0) {
                 mmc = &ext_mmc;
                 internal = 0;
-        } else if (strcmp(slot, "internal") == 0) {
+        } else if (strcmp(slot, "slot:internal") == 0) {
                 mmc = &int_mmc;
                 internal = 1;
         } else {
                 ULOG_ERR_F("%s has unknown mmc_host.slot_name value: %s",
                            udi, slot);
                 libhal_free_string(slot);
-                return;
+                return 0;
         }
         libhal_free_string(slot);
+#endif
 
         /* NOTE: keep these in the same order as in the mmc_info_t
          * struct, so that nothing is missed */
 
+        if (internal)
+                mmc = &int_mmc;
+        else
+                mmc = &ext_mmc;
+
         mmc->internal_card = internal;
         if (internal) {
                 strcpy(mmc->name, "int-MMC");
@@ -1477,7 +1479,7 @@
         mmc->udi = strdup(udi);
         if (mmc->udi == NULL) {
                 ULOG_ERR_F("out of memory");
-                return;
+                return 0;
         }
 
         if (internal) {
@@ -1512,7 +1514,8 @@
                 mmc->whole_device = NULL;
         }
 
-        if (!mmc_keys_set) {
+        if (!mmc_keys_set && int_mmc.udi && ext_mmc.udi) {
+                /* assumes two memory card slots... */
                 set_device_name_and_mount_point_key();
         }
 
@@ -1520,6 +1523,8 @@
         ULOG_DEBUG_F("%s cover_udi == %s", mmc->name, mmc->cover_udi);
 
         if (mmc->cover_udi != NULL) {
+                /* FIXME: this property is missing from HAL */
+#if 0
                 int state;
                 state = get_prop_bool(mmc->cover_udi,
                                       "button.state.value");
@@ -1528,12 +1533,16 @@
                 } else {
                         mmc->state = S_COVER_OPEN;
                 }
+#endif
+                mmc->state = S_COVER_CLOSED;
         }
 
         mmc->unmount_pending_timer_id = 0;
         mmc->swap_off_with_close_apps = FALSE;
         mmc->dialog_id = -1;
         mmc->swap_dialog_id = -1;
+
+        return 1;
 }
 
 usb_state_t get_usb_state(void)
@@ -1584,7 +1593,26 @@
         ULOG_DEBUG_F("number of mmc_hosts: %d", num_hosts);
 
         for (i = 0; i < num_hosts; ++i) {
-                init_card(list[i]);
+                /* FIXME workaround HAL bug for detecting int/ext MMC */
+                char **clist;
+                int internal, nchildren;
+                internal = nchildren = 0;
+                clist = libhal_manager_find_device_string_match(hal_ctx,
+                         "info.parent", list[i], &nchildren, NULL);
+                if (clist != NULL && nchildren == 1) {
+                        char *s;
+                        s = get_prop_string(clist[0], "info.product");
+                        if (s && strcmp(s, "MMC16G") == 0) {
+                                ULOG_DEBUG_F("%s is the internal", list[i]);
+                                internal = 1;
+                        }
+                        libhal_free_string(s);
+                } else {
+                        ULOG_ERR_F("%p, %d children", clist, nchildren);
+                } 
+                libhal_free_string_array(clist);
+
+                init_card(list[i], internal);
         }
 
         if (int_mmc.udi != NULL) {
@@ -1758,7 +1786,8 @@
                     && strcmp(slide_keyboard_udi, udi) == 0) {
                         ULOG_DEBUG_F("SLIDE_KEYBOARD %d", val);
                         inform_slide_keyboard(val);
-                } else if (strcmp(ext_mmc.cover_udi, udi) == 0) {
+                } else if (ext_mmc.cover_udi &&
+                           strcmp(ext_mmc.cover_udi, udi) == 0) {
                         if (val) {
                                 handle_event(E_CLOSED, &ext_mmc, NULL);
                         } else {
@@ -2910,14 +2939,18 @@
 
         /* register D-BUS interface for enabling swapping on MMC */
         vtable.message_function = enable_mmc_swap_handler;
+        /* FIXME
         register_op(sys_conn, &vtable, ext_mmc.swap_on_op, &ext_mmc);
+        */
         if (int_mmc_enabled) {
                 register_op(sys_conn, &vtable, int_mmc.swap_on_op, &int_mmc);
         }
 
         /* register D-BUS interface for disabling swapping on MMC */
         vtable.message_function = disable_mmc_swap_handler;
+        /* FIXME
         register_op(sys_conn, &vtable, ext_mmc.swap_off_op, &ext_mmc);
+        */
         if (int_mmc_enabled) {
                 register_op(sys_conn, &vtable, int_mmc.swap_off_op, &int_mmc);
         }

Modified: projects/haf/trunk/ke-recv/src/osso-usb-mass-storage-enable.sh
===================================================================
--- projects/haf/trunk/ke-recv/src/osso-usb-mass-storage-enable.sh	2008-07-22 11:02:28 UTC (rev 15805)
+++ projects/haf/trunk/ke-recv/src/osso-usb-mass-storage-enable.sh	2008-07-22 12:19:38 UTC (rev 15806)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # This file is part of ke-recv
 #
-# Copyright (C) 2004-2007 Nokia Corporation. All rights reserved.
+# Copyright (C) 2004-2008 Nokia Corporation. All rights reserved.
 #
 # Contact: Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>
 #
@@ -23,11 +23,8 @@
 
 /sbin/lsmod | grep g_file_storage > /dev/null
 if [ $? != 0 ]; then
-    DIR=/mnt/initfs/lib/modules/`uname -r`
-    if [ -f $DIR/g_file_storage.ko ]; then
-        /sbin/insmod $DIR/g_file_storage.ko stall=0 luns=2 removable
-        RC=$?
-    fi
+    /sbin/modprobe g_file_storage stall=0 luns=2 removable
+    RC=$?
 fi
 
 if [ $RC != 0 ]; then


More information about the maemo-commits mailing list