[maemo-commits] [maemo-commits] r16823 - projects/haf/tags/ke-recv/3.3-1/src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Dec 1 12:25:24 EET 2008
- Previous message: [maemo-commits] r16822 - projects/haf/trunk/ke-recv/src
- Next message: [maemo-commits] r16824 - projects/haf/trunk/hildon-thumbnail/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: kihamala Date: 2008-12-01 12:25:22 +0200 (Mon, 01 Dec 2008) New Revision: 16823 Modified: projects/haf/tags/ke-recv/3.3-1/src/events.c projects/haf/tags/ke-recv/3.3-1/src/ke-recv.c Log: update tag Modified: projects/haf/tags/ke-recv/3.3-1/src/events.c =================================================================== --- projects/haf/tags/ke-recv/3.3-1/src/events.c 2008-12-01 10:23:14 UTC (rev 16822) +++ projects/haf/tags/ke-recv/3.3-1/src/events.c 2008-12-01 10:25:22 UTC (rev 16823) @@ -603,17 +603,29 @@ } } -static void handle_e_rename(mmc_info_t *mmc, const char *udi) +static void handle_e_rename(mmc_info_t *mmc) { const char* args[] = {MMC_RENAME_PROG, NULL, NULL, NULL}; int ret; - char *dev; + volume_list_t *vol; - dev = get_prop_string(udi, "block.device"); - if (dev == NULL) { - return; + vol = get_nth_volume(mmc, mmc->preferred_volume); + + if (vol == NULL || vol->dev_name == NULL) { + ULOG_ERR_F("could not find partition number %d", + mmc->preferred_volume); + if (mmc->preferred_volume != 1 && mmc->internal_card) { + /* workaround for not yet partitioned systems */ + ULOG_DEBUG_F("%s: falling back to partition 1!"); + vol = get_nth_volume(mmc, 1); + if (vol == NULL || vol->dev_name == NULL) + return; + } else + return; } - args[1] = dev; + + ULOG_DEBUG_F("using device file %s", vol->dev_name); + args[1] = vol->dev_name; args[2] = mmc->desired_label; /* check validity of volume label */ @@ -621,11 +633,9 @@ assert(ret < 1 && ret > -3); if (ret == -1) { ULOG_ERR_F("too long name"); - libhal_free_string(dev); return; } else if (ret == -2) { ULOG_ERR_F("invalid characters"); - libhal_free_string(dev); return; } @@ -641,7 +651,6 @@ /* even if renaming failed it makes sense to * try mounting the card */ } - libhal_free_string(dev); update_mmc_label(mmc); ULOG_DEBUG_F("successful renaming"); @@ -650,7 +659,6 @@ display_dialog(MSG_MEMORY_CARD_IS_CORRUPTED); } } else { - libhal_free_string(dev); ULOG_DEBUG_F("umount failed"); display_system_note(dgettext("osso-filemanager", "sfil_ni_mmc_rename_mmc_in_use")); @@ -698,6 +706,7 @@ if (!mmc->control_partitions) { args[1] = vol->dev_name; args[2] = mmc->desired_label; + ULOG_DEBUG_F("using device file %s", args[1]); if (vol->mountpoint != NULL) ret = do_unmount(vol->mountpoint); @@ -713,6 +722,7 @@ args[2] = buf; } else args[2] = vol->dev_name; + ULOG_DEBUG_F("using device file %s", args[2]); args[3] = mmc->desired_label; ret = unmount_volumes(&mmc->volumes); @@ -1125,7 +1135,7 @@ } break; case E_RENAME: - handle_e_rename(mmc, arg); + handle_e_rename(mmc); break; case E_FORMAT: handle_e_format(mmc); Modified: projects/haf/tags/ke-recv/3.3-1/src/ke-recv.c =================================================================== --- projects/haf/tags/ke-recv/3.3-1/src/ke-recv.c 2008-12-01 10:23:14 UTC (rev 16822) +++ projects/haf/tags/ke-recv/3.3-1/src/ke-recv.c 2008-12-01 10:25:22 UTC (rev 16823) @@ -322,11 +322,9 @@ static DBusHandlerResult rename_handler(DBusConnection *c, DBusMessage *m, void *data) { - volume_list_t *l; mmc_info_t *mmc; DBusMessageIter iter; char* dev = NULL, *label = NULL; - const char *udi = NULL; ULOG_DEBUG_F("entered"); the_connection = c; @@ -365,19 +363,6 @@ send_reply(); - l = &mmc->volumes; - while (l != NULL) { - if (l->udi != NULL && l->volume_number == 1) { - udi = l->udi; - break; - } - l = l->next; - } - if (udi == NULL) { - ULOG_ERR_F("could not find udi for first partition"); - goto rename_exit; - } - if (label[0] == '\0') { /* empty label */ strncpy(mmc->desired_label, " ", 11); @@ -387,7 +372,7 @@ mmc->desired_label[11] = '\0'; ULOG_DEBUG_F("got label: '%s'", mmc->desired_label); /* validity of the label is checked later */ - handle_event(E_RENAME, mmc, udi); + handle_event(E_RENAME, mmc, NULL); rename_exit: /* invalidate */
- Previous message: [maemo-commits] r16822 - projects/haf/trunk/ke-recv/src
- Next message: [maemo-commits] r16824 - projects/haf/trunk/hildon-thumbnail/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]