From b47f748182098aa9a2aa8971ac169ce1308987ce Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Fri, 30 Dec 2016 17:31:15 +0900 Subject: [PATCH] usbotg popup : fix bugs in UsbStorageNotiOn and remove useless code in mount, unmount Change-Id: I90f3d2d723dc7f04a8bc0e4bc4b96638aaf885fa Signed-off-by: lokilee73 --- signal-sender/signal-sender.c | 4 ++-- src/usb/usbotg-mobile.c | 27 +++++---------------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/signal-sender/signal-sender.c b/signal-sender/signal-sender.c index e699343..ec2a1a3 100755 --- a/signal-sender/signal-sender.c +++ b/signal-sender/signal-sender.c @@ -252,8 +252,8 @@ static int send_usbstorage_unmount_popup_signal(char *path) param[2] = "_DEVICE_PATH_"; param[3] = buf; - return request_to_launch_by_dbus(BUS_NAME, POPUP_PATH_SYSTEM, POPUP_IFACE_SYSTEM, - "PopupLaunchDouble", "ssss", param); + return request_to_launch_by_dbus_for_pairs(BUS_NAME, POPUP_PATH_SYSTEM, POPUP_IFACE_SYSTEM, + "PopupLaunch", sizeof(param)/sizeof(param[0]), param); } static int send_cooldown_popup_signal(void) diff --git a/src/usb/usbotg-mobile.c b/src/usb/usbotg-mobile.c index b68ce05..d83bba5 100755 --- a/src/usb/usbotg-mobile.c +++ b/src/usb/usbotg-mobile.c @@ -53,7 +53,7 @@ static const struct popup_ops storage_removed_unsafe_ops; static void remove_otg_popup(const struct popup_ops *ops, char *path) { int len; - char *popup_path; + char *popup_path = NULL; if (ops == &storage_mounted_ops) popup_path = added_path; @@ -180,23 +180,15 @@ static void storage_unmount(const struct popup_ops *ops) static int storage_mounted_launch(bundle *b, const struct popup_ops *ops) { - int ret; - struct object_ops *obj; char *path; if (!ops) return -1; - ret = get_object_by_ops(ops, &obj); - if (ret < 0) { - _E("Failed to get object (%d)", ret); - return -2; - } - - path = (char *)bundle_get_val(obj->b, USB_MOUNT_PATH); + path = (char *)bundle_get_val(b, USB_MOUNT_PATH); if (!path) { _E("Failed to get mount path"); - return -3; + return -2; } _I("USB storage mount path (%s)", path); @@ -206,24 +198,15 @@ static int storage_mounted_launch(bundle *b, const struct popup_ops *ops) static int unmount_storage_launch(bundle *b, const struct popup_ops *ops) { - int ret; - struct object_ops *obj; char *path; if (!ops) return -1; - ret = get_object_by_ops(ops, &obj); - _D("ops = %s obj = %s", ops, obj); - if (ret < 0) { - _E("Failed to get object (%d)", ret); - return -2; - } - - path = (char *)bundle_get_val(obj->b, USB_MOUNT_PATH); + path = (char *)bundle_get_val(b, USB_MOUNT_PATH); if (!path) { _E("Failed to get mount path"); - return -3; + return -2; } remove_otg_popup(&storage_mounted_ops, path); -- 2.7.4