|
|
ec003f6 |
From 6d7f1a8a842376be8f72cc1fc90fc3101e9752a3 Mon Sep 17 00:00:00 2001
|
|
|
ec003f6 |
From: Tomas Bzatek <tbzatek@redhat.com>
|
|
|
ec003f6 |
Date: Fri, 2 Oct 2009 15:35:41 +0200
|
|
|
ec003f6 |
Subject: [PATCH 3/3] Silently drop eject error messages when detaching drive
|
|
|
ec003f6 |
|
|
|
ec003f6 |
If there's no media in drive and yet it's marked as detachable,
|
|
|
ec003f6 |
calling eject would cause "no media in drive" error.
|
|
|
ec003f6 |
This is the case with my USB SD card reader.
|
|
|
ec003f6 |
---
|
|
|
ec003f6 |
monitor/gdu/ggdudrive.c | 15 +++++++++++++--
|
|
|
ec003f6 |
1 files changed, 13 insertions(+), 2 deletions(-)
|
|
|
ec003f6 |
|
|
|
ec003f6 |
diff --git a/monitor/gdu/ggdudrive.c b/monitor/gdu/ggdudrive.c
|
|
|
ec003f6 |
index 3509382..eb70d75 100644
|
|
|
ec003f6 |
--- a/monitor/gdu/ggdudrive.c
|
|
|
ec003f6 |
+++ b/monitor/gdu/ggdudrive.c
|
|
|
ec003f6 |
@@ -648,6 +648,18 @@ eject_cb (GduDevice *device,
|
|
|
ec003f6 |
{
|
|
|
ec003f6 |
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
|
|
|
ec003f6 |
GGduDrive *drive;
|
|
|
ec003f6 |
+ gboolean drive_detachable;
|
|
|
ec003f6 |
+
|
|
|
ec003f6 |
+ drive = G_GDU_DRIVE (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
|
|
|
ec003f6 |
+ drive_detachable = drive->can_stop == FALSE && drive->start_stop_type == G_DRIVE_START_STOP_TYPE_SHUTDOWN;
|
|
|
ec003f6 |
+
|
|
|
ec003f6 |
+ if (error != NULL && error->code == G_IO_ERROR_FAILED &&
|
|
|
ec003f6 |
+ drive_detachable && ! drive->has_media && drive->is_media_removable)
|
|
|
ec003f6 |
+ {
|
|
|
ec003f6 |
+ /* Silently drop the error if there's no media in drive and we're still trying to detach it (see below) */
|
|
|
ec003f6 |
+ g_error_free (error);
|
|
|
ec003f6 |
+ error = NULL;
|
|
|
ec003f6 |
+ }
|
|
|
ec003f6 |
|
|
|
ec003f6 |
if (error != NULL)
|
|
|
ec003f6 |
{
|
|
|
ec003f6 |
@@ -658,8 +670,7 @@ eject_cb (GduDevice *device,
|
|
|
ec003f6 |
goto out;
|
|
|
ec003f6 |
}
|
|
|
ec003f6 |
|
|
|
ec003f6 |
- drive = G_GDU_DRIVE (g_async_result_get_source_object (G_ASYNC_RESULT (simple)));
|
|
|
ec003f6 |
- if (drive->can_stop == FALSE && drive->start_stop_type == G_DRIVE_START_STOP_TYPE_SHUTDOWN)
|
|
|
ec003f6 |
+ if (drive_detachable)
|
|
|
ec003f6 |
{
|
|
|
ec003f6 |
/* If device is not ejectable but it is detachable and we don't support stop(),
|
|
|
ec003f6 |
* then also run Detach() after Eject() - see update_drive() for details for why...
|
|
|
ec003f6 |
--
|
|
|
ec003f6 |
1.6.5.rc2
|
|
|
ec003f6 |
|