[maemo-commits] [maemo-commits] r17613 - in projects/haf/trunk/ke-recv: debian src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Mar 9 18:41:03 EET 2009
- Previous message: [maemo-commits] r17612 - in projects/haf/trunk/clutter: clutter/cogl/common clutter/eglx debian
- Next message: [maemo-commits] r17614 - projects/haf/tags/ke-recv
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: kihamala Date: 2009-03-09 18:40:22 +0200 (Mon, 09 Mar 2009) New Revision: 17613 Modified: projects/haf/trunk/ke-recv/debian/changelog projects/haf/trunk/ke-recv/src/events.c projects/haf/trunk/ke-recv/src/events.h projects/haf/trunk/ke-recv/src/ke-recv-test.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-mmc-mount.sh Log: releasing Modified: projects/haf/trunk/ke-recv/debian/changelog =================================================================== --- projects/haf/trunk/ke-recv/debian/changelog 2009-03-09 12:01:37 UTC (rev 17612) +++ projects/haf/trunk/ke-recv/debian/changelog 2009-03-09 16:40:22 UTC (rev 17613) @@ -1,3 +1,20 @@ +ke-recv (3.10-1) unstable; urgency=low + + * Added dialog about read-only mounting. + * Fixes: NB#103964 - Back with 3 partitions... + * Don't quit mounting if there is old corruption flag for the partition. + * Fix a bug in formatting the external card: a freed string was used as + parameter for mmc-format. + * Added S_CHARGING and E_ENTER_CHARGING_MODE and D-Bus interface for + USB plugin for moving to S_CHARGING. + * Fixes: NB#104646 - create .camera instead of .maps to internal card. + * Fixes: NB#100731 - fix string when both cards are USB-shared. + * Fixes: NB#102391 - do not use old error strings + * Fixes: NB#101379 - fix old string + * Fixes: NB#98461 - fix in use banner + + -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> Mon, 09 Mar 2009 18:35:46 +0200 + ke-recv (3.9-1) unstable; urgency=low * Fixed some minor Coverity-found issues. Modified: projects/haf/trunk/ke-recv/src/events.c =================================================================== --- projects/haf/trunk/ke-recv/src/events.c 2009-03-09 12:01:37 UTC (rev 17612) +++ projects/haf/trunk/ke-recv/src/events.c 2009-03-09 16:40:22 UTC (rev 17613) @@ -4,7 +4,7 @@ This file is part of ke-recv. - Copyright (C) 2004-2008 Nokia Corporation. All rights reserved. + Copyright (C) 2004-2009 Nokia Corporation. All rights reserved. Author: Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> @@ -42,7 +42,7 @@ GConfClient* gconfclient; static void usb_share_card(mmc_info_t *mmc, gboolean show); -static int mount_volumes(mmc_info_t *mmc); +static int mount_volumes(mmc_info_t *mmc, gboolean show_errors); static int do_unmount(const char *mountpoint); static void open_dialog_helper(mmc_info_t *mmc); static volume_list_t *get_nth_volume(mmc_info_t *mmc, int n); @@ -665,23 +665,19 @@ ULOG_ERR_F("mlabel failed: exec_prog returned %d", ret); if (mmc->internal_card) - display_dialog( - MSG_MEMORY_CARD_IS_CORRUPTED_INT); + open_closeable_dialog(OSSO_GN_NOTICE, + MSG_MEMORY_CARD_IS_CORRUPTED_INT, "OMG!"); else - display_dialog(MSG_MEMORY_CARD_IS_CORRUPTED); + open_closeable_dialog(OSSO_GN_NOTICE, + MSG_MEMORY_CARD_IS_CORRUPTED, "OMG!"); /* even if renaming failed it makes sense to * try mounting the card */ } update_mmc_label(mmc); ULOG_DEBUG_F("successful renaming"); - if (!mount_volumes(mmc)) { + if (!mount_volumes(mmc, TRUE)) { ULOG_ERR_F("could not mount it"); - if (mmc->internal_card) - display_dialog( - MSG_MEMORY_CARD_IS_CORRUPTED_INT); - else - display_dialog(MSG_MEMORY_CARD_IS_CORRUPTED); } } else { ULOG_DEBUG_F("umount failed"); @@ -744,13 +740,12 @@ if (vol == NULL || vol->dev_name == NULL) { snprintf(buf, 100, "%sp%d", mmc->whole_device, mmc->preferred_volume); - args[2] = buf; } else - args[2] = vol->dev_name; - ULOG_DEBUG_F("using device file %s", args[2]); + snprintf(buf, 100, "%s", vol->dev_name); + args[2] = buf; args[3] = mmc->desired_label; - ret = unmount_volumes(&mmc->volumes); + ret = unmount_volumes(mmc); } if (!ret) { ULOG_INFO_F("memory card %s is in use", mmc->name); @@ -758,7 +753,7 @@ "sfil_ni_mmc_format_mmc_in_use")); if (mmc->control_partitions) /* we could have unmounted some other volumes */ - mount_volumes(mmc); + mount_volumes(mmc, TRUE); return; } @@ -766,7 +761,9 @@ /* partition table will be cleared, clear volume info */ clear_volume_list(&mmc->volumes); - ret = exec_prog(MMC_FORMAT_PROG, args); + ULOG_DEBUG_F("execing: %s %s %s %s", args[0], args[1], args[2], + args[3]); + ret = exec_prog(args[0], args); if (ret != 0) { ULOG_INFO_F("format of %s failed, rc=%d", mmc->name, ret); } else { @@ -774,7 +771,7 @@ * the device; otherwise it is mounted later when the new * partition table is discovered */ if (!mmc->control_partitions) { - mount_volumes(mmc); + mount_volumes(mmc, TRUE); } else { mmc->skip_banner = TRUE; } @@ -831,7 +828,7 @@ set_mmc_corrupted_flag(FALSE, mmc); init_mmc_volumes(mmc); /* re-init volumes */ - if (mount_volumes(mmc)) { + if (mount_volumes(mmc, FALSE)) { display_system_note(_("card_memory_card_repaired")); } else { display_system_note(MSG_UNABLE_TO_REPAIR); @@ -894,7 +891,7 @@ #endif } -static int mount_volumes(mmc_info_t *mmc) +static int mount_volumes(mmc_info_t *mmc, gboolean show_errors) { const char *mount_args[] = {MMC_MOUNT_COMMAND, NULL, NULL, NULL}; volume_list_t *l; @@ -902,11 +899,13 @@ int ret, count = 0; l = get_nth_volume(mmc, mmc->preferred_volume); + /* if (l && l->corrupt) { ULOG_DEBUG_F("partition %d is corrupt", mmc->preferred_volume); return 0; } + */ if (l == NULL || l->udi == NULL) { ULOG_DEBUG_F("partition %d not found", mmc->preferred_volume); @@ -934,18 +933,31 @@ ret = exec_prog(MMC_MOUNT_COMMAND, mount_args); if (ret == 0) { l->mountpoint = strdup(mmc->mount_point); + l->corrupt = 0; possibly_turn_swap_on(mmc); set_mmc_corrupted_flag(FALSE, mmc); count = 1; + } else if (ret == 2) { + ULOG_DEBUG_F("exec_prog returned %d", ret); + l->corrupt = 1; /* 10s check failed */ + inform_mmc_swapping(FALSE, mmc); + set_mmc_corrupted_flag(TRUE, mmc); + if (show_errors) + open_closeable_dialog(OSSO_GN_NOTICE, + _("card_ia_corrupted"), "OMG!"); } else { ULOG_DEBUG_F("exec_prog returned %d", ret); l->corrupt = 1; inform_mmc_swapping(FALSE, mmc); set_mmc_corrupted_flag(TRUE, mmc); - if (mmc->internal_card) - display_dialog(MSG_MEMORY_CARD_IS_CORRUPTED_INT); - else - display_dialog(MSG_MEMORY_CARD_IS_CORRUPTED); + if (show_errors) { + if (mmc->internal_card) + display_dialog( + _("card_ib_unknown_format_device")); + else + display_dialog( + _("card_ib_unknown_format_card")); + } } inform_mmc_used_over_usb(FALSE, mmc); return count; @@ -994,11 +1006,13 @@ } /* try to unmount all volumes on the list */ -int unmount_volumes(volume_list_t *l) +int unmount_volumes(mmc_info_t *mmc) { int all_unmounted = 1; - for (; l != NULL; l = l->next) { + if (mmc->control_partitions) { + volume_list_t *l; + for (l = &mmc->volumes; l != NULL; l = l->next) { if (l->udi != NULL) { int prop; /* TODO: cache is_mounted info for speed */ @@ -1027,6 +1041,23 @@ all_unmounted = 0; } } + } + } else { + /* we only control single FAT volume */ + volume_list_t *vol; + vol = get_nth_volume(mmc, mmc->preferred_volume); + if (vol == NULL) { + ULOG_ERR_F("could not find partition number %d", + mmc->preferred_volume); + all_unmounted = 0; + } else { + if (vol->mountpoint && do_unmount(vol->mountpoint)) { + ULOG_DEBUG_F("unmounted %s", vol->udi); + } else { + ULOG_INFO_F("couldn't unmount %s", vol->udi); + all_unmounted = 0; + } + } } return all_unmounted; } @@ -1046,7 +1077,7 @@ } else { init_mmc_volumes(mmc); update_mmc_label(mmc); - if (mount_volumes(mmc)) { + if (mount_volumes(mmc, TRUE)) { /* display_dialog( MSG_MEMORY_CARD_AVAILABLE); @@ -1164,16 +1195,19 @@ if (in && ex) { snprintf(buf, MAX_MSG_LEN, - _(MSG_USB_MEMORY_CARDS_IN_USE), - in->display_name, ex->display_name); + MSG_USB_MEMORY_CARDS_IN_USE, + ex->display_name); } else { - mmc_info_t *mmc = in; if (ex) { + /* + mmc_info_t *mmc = in; mmc = ex; - } - snprintf(buf, MAX_MSG_LEN, - _(MSG_USB_MEMORY_CARD_IN_USE), - mmc->display_name); + */ + /* error string missing for this case */ + return; + } else + snprintf(buf, MAX_MSG_LEN, + MSG_USB_MEMORY_CARD_IN_USE); } display_system_note(buf); } @@ -1204,7 +1238,7 @@ break; } possibly_turn_swap_off(NORMAL_DIALOG, mmc); - if (!unmount_volumes(&mmc->volumes)) { + if (!unmount_volumes(mmc)) { open_dialog_helper(mmc); setup_s_unmount_pending(mmc); mmc->state = S_UNMOUNT_PENDING; @@ -1216,7 +1250,7 @@ if (!ignore_cable && in_mass_storage_mode() && !device_locked) { possibly_turn_swap_off(NO_DIALOG, mmc); - if (!unmount_volumes(&mmc->volumes)) { + if (!unmount_volumes(mmc)) { ret = 0; } else { usb_share_card(mmc, TRUE); @@ -1228,7 +1262,7 @@ unshare_usb_shared_card(mmc); init_mmc_volumes(mmc); update_mmc_label(mmc); - mount_volumes(mmc); + mount_volumes(mmc, TRUE); } break; case E_RENAME: @@ -1247,7 +1281,7 @@ ULOG_DEBUG_F("E_VOLUME_ADDED for %s", mmc->name); if (ignore_cable || !in_mass_storage_mode()) { update_mmc_label(mmc); - if (mount_volumes(mmc)) { + if (mount_volumes(mmc, TRUE)) { /* if (!mmc->skip_banner) { display_dialog( @@ -1281,7 +1315,7 @@ if (!ignore_cable && in_mass_storage_mode()) { unshare_usb_shared_card(mmc); } else { - unmount_volumes(&mmc->volumes); + unmount_volumes(mmc); } break; case E_ENABLE_SWAP: @@ -1303,9 +1337,11 @@ usb_share_card(mmc, FALSE); } else if (!in_peripheral_wait_mode()) { update_mmc_label(mmc); - mount_volumes(mmc); + mount_volumes(mmc, TRUE); } - } + } else + ULOG_DEBUG_F("%s whole_device missing", + mmc->name); break; default: ULOG_ERR_F("unsupported event %d for %s", @@ -1330,7 +1366,7 @@ usb_share_card(mmc, TRUE); } else { init_mmc_volumes(mmc); /* re-read volumes */ - mount_volumes(mmc); + mount_volumes(mmc, TRUE); } mmc->state = S_COVER_CLOSED; break; @@ -1347,7 +1383,7 @@ case E_UNMOUNT_TIMEOUT: ULOG_DEBUG_F("E_UNMOUNT_TIMEOUT for %s", mmc->name); mmc->unmount_pending_timer_id = 0; - if (!unmount_volumes(&mmc->volumes)) { + if (!unmount_volumes(mmc)) { open_dialog_helper(mmc); setup_s_unmount_pending(mmc); } else { @@ -1359,7 +1395,7 @@ case E_VOLUME_REMOVED: ULOG_DEBUG_F("E_VOLUME_REMOVED for %s", mmc->name); discard_volume(mmc, arg); - if (unmount_volumes(&mmc->volumes)) { + if (unmount_volumes(mmc)) { dismantle_s_unmount_pending(mmc); CLOSE_DIALOG CLOSE_SWAP_DIALOG Modified: projects/haf/trunk/ke-recv/src/events.h =================================================================== --- projects/haf/trunk/ke-recv/src/events.h 2009-03-09 12:01:37 UTC (rev 17612) +++ projects/haf/trunk/ke-recv/src/events.h 2009-03-09 16:40:22 UTC (rev 17613) @@ -121,8 +121,8 @@ #define MSG_USB_DISCONNECTED _("card_ib_usb_disconnected") #define MSG_NO_MEMORY_CARD_INSERTED _("card_ni_usb_no_memory_card_inserted") #define MSG_MEMORY_CARD_AVAILABLE _("card_ib_memory_card_available") -#define MSG_MEMORY_CARD_IS_CORRUPTED_INT _("card_ib_unknown_format_device") -#define MSG_MEMORY_CARD_IS_CORRUPTED _("card_ia_corrupted") +#define MSG_MEMORY_CARD_IS_CORRUPTED_INT _("card_ti_corrupted_device") +#define MSG_MEMORY_CARD_IS_CORRUPTED _("card_ti_corrupted_card") #define MSG_FORMATTING_COMPLETE _("card_ib_formatting_complete") #define MSG_USB_MEMORY_CARD_IN_USE _("card_ni_usb_failed_card_in_use") #define MSG_USB_MEMORY_CARDS_IN_USE _("card_ni_usb_failed_cards_in_use") @@ -140,7 +140,7 @@ int handle_event(mmc_event_t e, mmc_info_t *mmc, const char *arg); void do_global_init(void); -int unmount_volumes(volume_list_t *v); +int unmount_volumes(mmc_info_t *mmc); void inform_camera_out(gboolean value); void inform_camera_turned_out(gboolean value); void inform_slide_keyboard(gboolean value); Modified: projects/haf/trunk/ke-recv/src/ke-recv-test.c =================================================================== --- projects/haf/trunk/ke-recv/src/ke-recv-test.c 2009-03-09 12:01:37 UTC (rev 17612) +++ projects/haf/trunk/ke-recv/src/ke-recv-test.c 2009-03-09 16:40:22 UTC (rev 17613) @@ -185,6 +185,26 @@ ULOG_DEBUG_F("leaving"); } +static void send_enable_charging() +{ + DBusMessage* m = NULL, *reply = NULL; + DBusError err; + ULOG_DEBUG_F("entering"); + assert(sys_conn != NULL); + dbus_error_init(&err); + m = dbus_message_new_method_call("com.nokia.ke_recv", + "/com/nokia/ke_recv/enable_charging", + "com.nokia.ke_recv", + "dummy"); + reply = dbus_connection_send_with_reply_and_block(sys_conn, m, + 20000, &err); + if (reply == NULL) { + ULOG_CRIT_F("dbus_connection_send failed: %s", err.message); + exit(1); + } + ULOG_DEBUG_F("leaving"); +} + static void send_enable_mass_storage() { DBusMessage* m = NULL, *reply = NULL; @@ -371,6 +391,7 @@ "ej - eject USB\n" "ec - cancel eject USB\n" "p - enable PC Suite\n" + "c - enable charging mode\n" "m - enable USB mass storage\n"); exit(1); } @@ -380,7 +401,8 @@ case 'c': if (argv[1][1] == 'b') { close_bat_cover(); - } + } else if (argv[1][1] == '\0') + send_enable_charging(); break; case 'o': if (argv[1][1] == 'b') { Modified: projects/haf/trunk/ke-recv/src/ke-recv.c =================================================================== --- projects/haf/trunk/ke-recv/src/ke-recv.c 2009-03-09 12:01:37 UTC (rev 17612) +++ projects/haf/trunk/ke-recv/src/ke-recv.c 2009-03-09 16:40:22 UTC (rev 17613) @@ -621,6 +621,21 @@ return DBUS_HANDLER_RESULT_HANDLED; } +static DBusHandlerResult enable_charging_handler(DBusConnection *c, + DBusMessage *m, + void *data) +{ + ULOG_DEBUG_F("entered"); + the_connection = c; + the_message = m; + handle_usb_event(E_ENTER_CHARGING_MODE); + send_reply(); + /* invalidate */ + the_connection = NULL; + the_message = NULL; + return DBUS_HANDLER_RESULT_HANDLED; +} + static DBusHandlerResult enable_mass_storage_handler(DBusConnection *c, DBusMessage *m, void *data) @@ -1558,7 +1573,7 @@ mmc->swap_off_op = INTERNAL_MMC_SWAP_OFF_OP; #ifdef FREMANTLE_MODE - mmc->preferred_volume = 4; + mmc->preferred_volume = 3; mmc->control_partitions = 0; #else mmc->preferred_volume = 1; @@ -1600,9 +1615,11 @@ int state; state = get_prop_bool(mmc->cover_udi, "button.state.value"); - if (state) { - /* this case also if get_prop_bool() failed */ + if (state == -1) { + /* failed -- property missing? */ mmc->state = S_COVER_CLOSED; + } else if (state) { + mmc->state = S_COVER_CLOSED; } else { mmc->state = S_COVER_OPEN; } @@ -1783,7 +1800,9 @@ static gboolean init_usb_cable_status(gpointer data) { static int retry_times = 100; + /* gboolean do_e_plugged = (gboolean)data; + */ if (usb_state != S_INVALID_USB_STATE) { ULOG_DEBUG_F("usb_state is already valid"); @@ -1822,10 +1841,15 @@ usb_state = S_MASS_STORAGE; /* should reset gconf keys here */ } else { + ULOG_DEBUG_F("peripheral but cards not " + "USB-shared, assuming charging mode"); + usb_state = S_CHARGING; + /* if (do_e_plugged) { handle_usb_event( E_ENTER_PERIPHERAL_WAIT_MODE); } + */ } set_usb_mode_key("peripheral"); } else { @@ -2152,6 +2176,7 @@ static int unmount_usb_volumes(void) { int all_unmounted = 1; +#ifndef FREMANTLE_MODE storage_info_t *si; si = storage_list; @@ -2165,6 +2190,7 @@ } si = si->next; } +#endif return all_unmounted; } @@ -2802,7 +2828,7 @@ show_usb_sharing_failed_dialog(&int_mmc, NULL); } else if (ext_mmc.whole_device && int_mmc.whole_device) { /* both succeeded */ - display_dialog(MSG_DEVICE_CONNECTED_VIA_USB); + display_dialog(_("cards_connected_via_usb")); } } @@ -2838,6 +2864,9 @@ } else if (usb_state == S_PERIPHERAL_WAIT) { ULOG_INFO_F("E_CABLE_DETACHED in " "S_PERIPHERAL_WAIT"); + } else if (usb_state == S_CHARGING) { + ULOG_INFO_F("E_CABLE_DETACHED in " + "S_CHARGING"); } else if (usb_state == S_PCSUITE) { ULOG_INFO_F("E_CABLE_DETACHED in S_PCSUITE"); if (!disable_pcsuite()) { @@ -2924,7 +2953,8 @@ } break; case E_ENTER_MASS_STORAGE_MODE: - if (usb_state == S_PERIPHERAL_WAIT) { + if (usb_state == S_PERIPHERAL_WAIT || + usb_state == S_CHARGING) { usb_state = S_MASS_STORAGE; e_plugged_helper(); } else { @@ -2933,7 +2963,8 @@ } break; case E_ENTER_PCSUITE_MODE: - if (usb_state == S_PERIPHERAL_WAIT) { + if (usb_state == S_PERIPHERAL_WAIT || + usb_state == S_CHARGING) { usb_state = S_PCSUITE; if (!enable_pcsuite()) { ULOG_ERR_F("Couldn't enable PC Suite"); @@ -2943,6 +2974,14 @@ usb_state); } break; + case E_ENTER_CHARGING_MODE: + if (usb_state == S_PERIPHERAL_WAIT) { + usb_state = S_CHARGING; + } else { + ULOG_WARN_F("E_ENTER_CHARGING_MODE in %d!", + usb_state); + } + break; default: ULOG_ERR_F("unknown event %d", e); } @@ -3158,6 +3197,10 @@ vtable.message_function = enable_mass_storage_handler; register_op(sys_conn, &vtable, ENABLE_MASS_STORAGE_OP, NULL); + /* D-Bus interface for charging mode selection */ + vtable.message_function = enable_charging_handler; + register_op(sys_conn, &vtable, ENABLE_CHARGING_OP, NULL); + add_prop_watch(ext_mmc.cover_udi); add_prop_watch(int_mmc.cover_udi); /* @@ -3187,8 +3230,10 @@ strdup(dgettext(USB_DOMAIN, "stab_me_usb_device_name")); } +#ifndef FREMANTLE_MODE init_usb_storages(); init_usb_volumes(); +#endif #if 0 /* check if hildon-desktop is running */ @@ -3206,7 +3251,7 @@ * (needs rechecking and possibly fixing hildon-desktop) */ desktop_started = TRUE; - if (usb_state != S_INVALID_USB_STATE) { + if (usb_state != S_INVALID_USB_STATE && !mmc_initialised) { /* 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-03-09 12:01:37 UTC (rev 17612) +++ projects/haf/trunk/ke-recv/src/ke-recv.h 2009-03-09 16:40:22 UTC (rev 17613) @@ -3,7 +3,7 @@ This file is part of ke-recv. - Copyright (C) 2004-2008 Nokia Corporation. All rights reserved. + Copyright (C) 2004-2009 Nokia Corporation. All rights reserved. Author: Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> @@ -147,9 +147,10 @@ #define AK_BROADCAST_OP "/com/nokia/osso_app_killer" #define AK_BROADCAST_EXIT "exit" -/* PC suite & mass storage */ +/* PC suite, mass storage, charging request */ #define ENABLE_PCSUITE_OP "/com/nokia/ke_recv/enable_pcsuite" #define ENABLE_MASS_STORAGE_OP "/com/nokia/ke_recv/enable_mass_storage" +#define ENABLE_CHARGING_OP "/com/nokia/ke_recv/enable_charging" #define INVALID_DIALOG_RESPONSE -666 @@ -161,6 +162,7 @@ S_EJECTING, S_EJECTED, S_MASS_STORAGE, + S_CHARGING, S_PCSUITE } usb_state_t; @@ -170,7 +172,9 @@ E_EJECT_CANCELLED, E_ENTER_HOST_MODE, E_ENTER_PERIPHERAL_WAIT_MODE, + /* the three next ones are for USB plugin's requests */ E_ENTER_MASS_STORAGE_MODE, + E_ENTER_CHARGING_MODE, E_ENTER_PCSUITE_MODE } usb_event_t; Modified: projects/haf/trunk/ke-recv/src/osso-mmc-mount.sh =================================================================== --- projects/haf/trunk/ke-recv/src/osso-mmc-mount.sh 2009-03-09 12:01:37 UTC (rev 17612) +++ projects/haf/trunk/ke-recv/src/osso-mmc-mount.sh 2009-03-09 16:40:22 UTC (rev 17613) @@ -19,6 +19,11 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA +# Return codes: +# 0 - mounted read-write +# 1 - could not mount +# 2 - mounted read-only + PDEV=$1 ;# preferred device (partition) MP=$2 ;# mount point @@ -37,7 +42,7 @@ grep "$PDEV " /proc/mounts > /dev/null if [ $? = 0 ]; then - echo "$0: $PDEV is already mounted" + logger "$0: $PDEV is already mounted" exit 0 fi @@ -49,28 +54,29 @@ /sbin/dosfsck -T 10 $PDEV if [ $? != 0 ]; then - echo "$0: $PDEV is corrupt, trying to mount it read-only" + logger "$0: $PDEV is corrupt, trying to mount it read-only" mount -t vfat -o ro,noauto,nodev,noexec,nosuid,noatime,nodiratime,utf8,uid=29999,shortname=mixed,dmask=000,fmask=0133 $PDEV $MP > /dev/null if [ $? = 0 ]; then - echo "$0: $PDEV mounted read-only" - exit 0 + logger "$0: $PDEV mounted read-only" + exit 2 else - echo "$0: Couldn't mount $PDEV read-only" + logger "$0: Couldn't mount $PDEV read-only" exit 1 fi fi mmc-mount $PDEV $MP RC=$? +logger "$0: mounting $PDEV read-write to $MP, rc: $RC" if [ $RC = 0 ]; then # create some special directories for user's partition if [ "x$MP" = "x/home/user/MyDocs" -a -w $MP ]; then - for d in .sounds .videos .documents .images .maps; do + for d in .sounds .videos .documents .images .camera; do mkdir -p $MP/$d done else - echo "$0: '$MP' is not writable" + logger "$0: '$MP' is not writable" fi fi @@ -99,4 +105,4 @@ chown user:users $MP fi fi -exit $RC +exit $(($RC != 0))
- Previous message: [maemo-commits] r17612 - in projects/haf/trunk/clutter: clutter/cogl/common clutter/eglx debian
- Next message: [maemo-commits] r17614 - projects/haf/tags/ke-recv
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]