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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Jan 27 13:27:35 EET 2009
Author: kihamala
Date: 2009-01-27 13:27:26 +0200 (Tue, 27 Jan 2009)
New Revision: 17288

Modified:
   projects/haf/trunk/ke-recv/debian/changelog
   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/ke-recv.h
   projects/haf/trunk/ke-recv/src/osso-prepare-partition.sh
Log:
make kernel re-read partition table after repartitioning


Modified: projects/haf/trunk/ke-recv/debian/changelog
===================================================================
--- projects/haf/trunk/ke-recv/debian/changelog	2009-01-27 08:11:13 UTC (rev 17287)
+++ projects/haf/trunk/ke-recv/debian/changelog	2009-01-27 11:27:26 UTC (rev 17288)
@@ -1,3 +1,15 @@
+ke-recv (3.7-1~unreleased) unstable; urgency=low
+
+  * Fall back to partition 1 when removing USB-sharing. Fixes: NB#98340
+  * Mount internal FAT partition under /home/user/MyDocs instead of
+    /media/mmc2.
+  * Go to USB waiting mode on startup instead of ignoring the USB mass
+    storage. Related to NB#89646
+  * Make the kernel to re-read partition table after repartitioning.
+    Fixes: NB#90175
+
+ -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Tue, 27 Jan 2009 13:26:35 +0200
+
 ke-recv (3.6-1) unstable; urgency=low
 
   * Do not give up if obexd is not running.

Modified: projects/haf/trunk/ke-recv/debian/init.d
===================================================================
--- projects/haf/trunk/ke-recv/debian/init.d	2009-01-27 08:11:13 UTC (rev 17287)
+++ projects/haf/trunk/ke-recv/debian/init.d	2009-01-27 11:27:26 UTC (rev 17288)
@@ -2,7 +2,7 @@
 # 
 # ke-recv	HAL-based automatic mounting etc.
 #
-# Copyright (C) 2004-2008 Nokia Corporation. All rights reserved.
+# Copyright (C) 2004-2009 Nokia Corporation. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License 
@@ -44,7 +44,7 @@
 
 # FIXME: these should come from startup scripts
 export MMC_MOUNTPOINT='/media/mmc1'
-export INTERNAL_MMC_MOUNTPOINT='/media/mmc2'
+export INTERNAL_MMC_MOUNTPOINT='/home/user/MyDocs'
 
 /sbin/lsmod | grep "\(g_ether\)" > /dev/null
 if [ $? = 0 ]; then

Modified: projects/haf/trunk/ke-recv/src/events.c
===================================================================
--- projects/haf/trunk/ke-recv/src/events.c	2009-01-27 08:11:13 UTC (rev 17287)
+++ projects/haf/trunk/ke-recv/src/events.c	2009-01-27 11:27:26 UTC (rev 17288)
@@ -540,9 +540,14 @@
 
                 vol = get_nth_volume(mmc, mmc->preferred_volume);
                 if (vol == NULL) {
-                        ULOG_ERR_F("volume %d not found from %s",
-                                   mmc->preferred_volume, mmc->name);
-                        return;
+                        if (mmc->preferred_volume != 1) {
+                                /* workaround for not yet partitioned systems */
+                                ULOG_DEBUG_F("falling back to partition 1!");
+                                vol = get_nth_volume(mmc, 1);
+                                if (vol == NULL || vol->dev_name == NULL)
+                                        return;
+                        } else
+                                return;
                 }
                 dev = vol->dev_name;
         } else
@@ -1213,7 +1218,7 @@
                                 if (!ignore_cable && in_mass_storage_mode()
                                     && !device_locked) {
                                         usb_share_card(mmc, FALSE);
-                                } else {
+                                } else if (!in_peripheral_wait_mode()) {
                                         update_mmc_label(mmc);
                                         mount_volumes(mmc);
                                 }

Modified: projects/haf/trunk/ke-recv/src/ke-recv.c
===================================================================
--- projects/haf/trunk/ke-recv/src/ke-recv.c	2009-01-27 08:11:13 UTC (rev 17287)
+++ projects/haf/trunk/ke-recv/src/ke-recv.c	2009-01-27 11:27:26 UTC (rev 17288)
@@ -1677,7 +1677,7 @@
         libhal_free_string_array(list);
 
         if (usb_cable_udi != NULL) {
-                init_usb_cable_status(NULL);
+                init_usb_cable_status((void*)1);
         } else {
                 usb_state = S_CABLE_DETACHED;
                 inform_usb_cable_attached(FALSE);
@@ -1734,6 +1734,7 @@
         gboolean do_e_plugged = (gboolean)data;
 
         ULOG_DEBUG_F("entered");
+
         if (usb_state != S_INVALID_USB_STATE) {
                 ULOG_DEBUG_F("usb_state is already valid"); 
                 return FALSE;
@@ -1754,13 +1755,30 @@
                         mount_usb_volumes();
                         set_usb_mode_key("host");
                 } else if (usb_state == S_PERIPHERAL_WAIT) {
-                        if (do_e_plugged) {
-                                handle_usb_event(E_ENTER_PERIPHERAL_WAIT_MODE);
+                        if (usb_driver_is_used()) {
+                                ULOG_DEBUG_F("cards are already USB-shared");
+                                usb_state = S_MASS_STORAGE;
+                                /* should reset gconf keys here */
+                        } else {
+                                if (do_e_plugged) {
+                                        handle_usb_event(
+                                                E_ENTER_PERIPHERAL_WAIT_MODE);
+                                }
                         }
                         set_usb_mode_key("peripheral");
                 } else {
                         set_usb_mode_key("idle");
                 }
+
+                if (!mmc_initialised) {
+                        /* initialise GConf keys and possibly mount or
+                         * USB-share */
+                        if (int_mmc_enabled) {
+                                handle_event(E_INIT_CARD, &int_mmc, NULL);
+                        }
+                        handle_event(E_INIT_CARD, &ext_mmc, NULL);
+                        mmc_initialised = TRUE;
+                }
                 return FALSE;
         }
 }
@@ -2884,6 +2902,11 @@
         return usb_state == S_MASS_STORAGE;
 }
 
+int in_peripheral_wait_mode(void)
+{
+        return usb_state == S_PERIPHERAL_WAIT;
+}
+
 static void sigterm(int signo)
 {
         ULOG_INFO_L("got SIGTERM");
@@ -3106,7 +3129,8 @@
          * (needs rechecking and possibly fixing hildon-desktop) */
         desktop_started = TRUE;
 
-        if (desktop_started || first_boot) {
+        if (usb_state != S_INVALID_USB_STATE  /* valid USB state is required */
+            && (desktop_started || first_boot)) {
                 /* initialise GConf keys and possibly mount or USB-share */
                 if (int_mmc_enabled) {
                         handle_event(E_INIT_CARD, &int_mmc, NULL);

Modified: projects/haf/trunk/ke-recv/src/ke-recv.h
===================================================================
--- projects/haf/trunk/ke-recv/src/ke-recv.h	2009-01-27 08:11:13 UTC (rev 17287)
+++ projects/haf/trunk/ke-recv/src/ke-recv.h	2009-01-27 11:27:26 UTC (rev 17288)
@@ -300,6 +300,7 @@
 int init_mmc_volumes(mmc_info_t *mmc);
 void clear_volume_list(volume_list_t *l);
 int in_mass_storage_mode(void);
+int in_peripheral_wait_mode(void);
 usb_state_t get_usb_state(void);
 int check_install_file(const mmc_info_t *mmc);
 

Modified: projects/haf/trunk/ke-recv/src/osso-prepare-partition.sh
===================================================================
--- projects/haf/trunk/ke-recv/src/osso-prepare-partition.sh	2009-01-27 08:11:13 UTC (rev 17287)
+++ projects/haf/trunk/ke-recv/src/osso-prepare-partition.sh	2009-01-27 11:27:26 UTC (rev 17288)
@@ -1,9 +1,9 @@
 #!/bin/sh
 # This file is part of ke-recv
 #
-# Copyright (C) 2006-2007 Nokia Corporation. All rights reserved.
+# Copyright (C) 2006-2009 Nokia Corporation. All rights reserved.
 #
-# Contact: Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>
+# Author: Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License 
@@ -32,5 +32,10 @@
   exit 1
 else
   echo "$0: successfully created the partition"
+  # make the kernel to detect the new partition table
+  sfdisk -R $DEV
+  # magic sleep to give time to udev (would be better to wait
+  # for the partition file in a loop)
+  sleep 1
   exit 0
 fi


More information about the maemo-commits mailing list