[maemo-commits] [maemo-commits] r16934 - in projects/haf/trunk/ke-recv: debian src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Thu Dec 11 11:13:13 EET 2008
- Previous message: [maemo-commits] r16933 - in projects/haf/trunk/ke-recv: debian src
- Next message: [maemo-commits] r16935 - in projects/haf/trunk: . raptor raptor/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: kihamala Date: 2008-12-11 11:13:11 +0200 (Thu, 11 Dec 2008) New Revision: 16934 Modified: projects/haf/trunk/ke-recv/debian/changelog projects/haf/trunk/ke-recv/src/ke-recv-test.c projects/haf/trunk/ke-recv/src/osso-usb-mass-storage-enable.sh Log: fixed ke-recv-test, added check for pnatd Modified: projects/haf/trunk/ke-recv/debian/changelog =================================================================== --- projects/haf/trunk/ke-recv/debian/changelog 2008-12-10 13:51:00 UTC (rev 16933) +++ projects/haf/trunk/ke-recv/debian/changelog 2008-12-11 09:13:11 UTC (rev 16934) @@ -3,6 +3,8 @@ * Fourth partition is now FAT. * Send TERM to pnatd before trying to remove g_nokia. * Updated the unofficial partitioning script for internal memory card. + * Fixed ke-recv-test to provide correct device parameters for rename, + format and repair messages. -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> Wed, 10 Dec 2008 14:59:10 +0200 Modified: projects/haf/trunk/ke-recv/src/ke-recv-test.c =================================================================== --- projects/haf/trunk/ke-recv/src/ke-recv-test.c 2008-12-10 13:51:00 UTC (rev 16933) +++ projects/haf/trunk/ke-recv/src/ke-recv-test.c 2008-12-11 09:13:11 UTC (rev 16934) @@ -26,19 +26,15 @@ #include "ke-recv.h" #include <stdio.h> -#define INT_DEV "/dev/mmcblk0p3" -#define EXT_DEV "/dev/mmcblk1p1" - static DBusConnection *ses_conn = NULL; static DBusConnection *sys_conn = NULL; -static void format_mmc(int mode) +static void format_mmc(const char *device) { DBusMessage* m = NULL, *reply = NULL; dbus_bool_t ret = FALSE; DBusError err; const char* label = ""; - char *dev; ULOG_DEBUG_F("entering"); dbus_error_init(&err); @@ -47,13 +43,8 @@ "com.nokia.ke_recv", "dummymethodname"); assert(m != NULL); - if (mode == 'i') { - dev = INT_DEV; - } else { - dev = EXT_DEV; - } ret = dbus_message_append_args(m, DBUS_TYPE_STRING, - &dev, DBUS_TYPE_INVALID); + &device, DBUS_TYPE_INVALID); if (!ret) { ULOG_CRIT_F("dbus_message_append_args failed"); exit(1); @@ -110,13 +101,12 @@ dbus_connection_send(sys_conn, m, NULL); } -static void rename_mmc(int mode) +static void rename_mmc(const char *device) { DBusMessage* m = NULL, *reply = NULL; dbus_bool_t ret = FALSE; DBusError err; const char* label = "KERECVTEST"; - char *dev; ULOG_DEBUG_F("entering"); dbus_error_init(&err); @@ -126,13 +116,8 @@ "com.nokia.ke_recv", "dummymethodname"); assert(m != NULL); - if (mode == 'i') { - dev = INT_DEV; - } else { - dev = EXT_DEV; - } ret = dbus_message_append_args(m, DBUS_TYPE_STRING, - &dev, DBUS_TYPE_INVALID); + &device, DBUS_TYPE_INVALID); if (!ret) { ULOG_CRIT_F("dbus_message_append_args failed"); exit(1); @@ -309,7 +294,7 @@ ULOG_DEBUG_F("leaving"); } -static void repair_card(const char *type) +static void repair_card(const char *device) { DBusMessage* m = NULL; ULOG_DEBUG_F("entering"); @@ -319,7 +304,7 @@ "dummymethodname"); assert(sys_conn != NULL && m != NULL); dbus_message_append_args(m, DBUS_TYPE_STRING, - &type, DBUS_TYPE_INVALID); + &device, DBUS_TYPE_INVALID); dbus_connection_send(sys_conn, m, NULL); ULOG_DEBUG_F("leaving"); } @@ -369,14 +354,12 @@ int main(int argc, char* argv[]) { - if (argc != 2) { - printf("Usage: %s <command>\n", argv[0]); + if (argc != 2 && argc != 3) { + printf("Usage: %s <command> [/dev/mmcblk(1|0)]\n", argv[0]); printf("cb - close battery cover signal\n" "ob - open battery cover signal\n" - "f - format (ext-)MMC (Note: hard-coded to " EXT_DEV ")\n" - "fi - format (int-)MMC (Note: hard-coded to " INT_DEV ")\n" - "r - rename (ext-)MMC (" EXT_DEV ")\n" - "ri - rename (int-)MMC (" INT_DEV ")\n" + "f - format device <arg>\n" + "r - rename device <arg>\n" "l - send device locked signal\n" "u - send device unlocked signal\n" "at - send USB attached signal\n" @@ -385,8 +368,7 @@ "si - swap on (int-)MMC\n" "t - swap off (ext-)MMC\n" "ti - swap off (int-)MMC\n" - "e - repair (ext-)MMC (" EXT_DEV ")\n" - "ei - repair (int-)MMC (" INT_DEV ")\n" + "e - repair device <arg>\n" "ej - eject USB\n" "ec - cancel eject USB\n" "p - enable PC Suite\n" @@ -407,10 +389,10 @@ } break; case 'f': - format_mmc(argv[1][1]); + format_mmc(argv[2]); break; case 'r': - rename_mmc(argv[1][1]); + rename_mmc(argv[2]); break; case 'l': send_device_locked(); @@ -441,14 +423,12 @@ } break; case 'e': - if (argv[1][1] == 'i') { - repair_card(INT_DEV); - } else if (argv[1][1] == 'j') { + if (argv[1][1] == 'j') { usb_eject(); } else if (argv[1][1] == 'c') { usb_cancel_eject(); } else { - repair_card(EXT_DEV); + repair_card(argv[2]); } break; default: 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-12-10 13:51:00 UTC (rev 16933) +++ projects/haf/trunk/ke-recv/src/osso-usb-mass-storage-enable.sh 2008-12-11 09:13:11 UTC (rev 16934) @@ -24,9 +24,15 @@ /sbin/lsmod | grep g_nokia > /dev/null if [ $? = 0 ]; then echo "$0: removing g_nokia" - # kill pnatd to make it release its grip on g_nokia - kill `pidof pnatd` - sleep 1 + + PNATD_PID=`pidof pnatd` + if [ $? = 0 ]; then + # kill pnatd to make it release its grip on g_nokia + kill $PNATD_PID + sleep 1 + else + echo "$0: pnatd is not running" + fi /sbin/rmmod g_nokia fi
- Previous message: [maemo-commits] r16933 - in projects/haf/trunk/ke-recv: debian src
- Next message: [maemo-commits] r16935 - in projects/haf/trunk: . raptor raptor/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]