hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Thu Dec 6 11:42:10 PST 2007


 hald/linux/addons/addon-storage.c |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 26ac446dd1b1f2338275c6f2934bf1dbca19cb05
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Thu Dec 6 20:41:55 2007 +0100

    fix endless loop in storage-addon
    
    This fixes a endless loop if you attach e.g. a USB floppy device which
    already contains a floppy media (because of the initial media_status). The
    result is that the media in the device get never detected until the state
    change again (remove/readd the media to the device).
    
    IMO this could theoretically also happen on other devices which already
    contains a media when attached.

diff --git a/hald/linux/addons/addon-storage.c b/hald/linux/addons/addon-storage.c
index a58b8aa..42385fc 100644
--- a/hald/linux/addons/addon-storage.c
+++ b/hald/linux/addons/addon-storage.c
@@ -473,6 +473,14 @@ poll_for_media (gpointer user_data)
 		}
 	}
 	
+	/* set correct state on startup, this avoid endless loops if there was a media in the device on startup */
+	if (media_status == MEDIA_STATUS_UNKNOWN) {
+		if (got_media) 
+			media_status = MEDIA_STATUS_NO_MEDIA;
+		else 
+			media_status = MEDIA_STATUS_GOT_MEDIA;	
+	}
+
 	switch (media_status) {
 	case MEDIA_STATUS_GOT_MEDIA:
 		if (!got_media) {


More information about the hal-commit mailing list