Contents of /trunk/hal/patches/hal-0.5.10-fix-endless-loop-in-storage-addon.patch
Parent Directory | Revision Log
Revision 597 -
(show annotations)
(download)
Mon May 19 19:05:19 2008 UTC (16 years, 4 months ago) by niro
File size: 1315 byte(s)
Mon May 19 19:05:19 2008 UTC (16 years, 4 months ago) by niro
File size: 1315 byte(s)
-gentoo patches
1 | From e0b5cb8dce7e3a1c2203c5e7a83d0391a46845ef Mon Sep 17 00:00:00 2001 |
2 | From: Danny Kukawka <danny.kukawka@web.de> |
3 | Date: Thu, 6 Dec 2007 20:41:55 +0100 |
4 | Subject: [PATCH] fix endless loop in storage-addon |
5 | |
6 | This fixes a endless loop if you attach e.g. a USB floppy device which |
7 | already contains a floppy media (because of the initial media_status). The |
8 | result is that the media in the device get never detected until the state |
9 | change again (remove/readd the media to the device). |
10 | |
11 | IMO this could theoretically also happen on other devices which already |
12 | contains a media when attached. |
13 | --- |
14 | hald/linux/addons/addon-storage.c | 8 ++++++++ |
15 | 1 files changed, 8 insertions(+), 0 deletions(-) |
16 | |
17 | diff --git a/hald/linux/addons/addon-storage.c b/hald/linux/addons/addon-storage.c |
18 | index a58b8aa..42385fc 100644 |
19 | --- a/hald/linux/addons/addon-storage.c |
20 | +++ b/hald/linux/addons/addon-storage.c |
21 | @@ -473,6 +473,14 @@ poll_for_media (gpointer user_data) |
22 | } |
23 | } |
24 | |
25 | + /* set correct state on startup, this avoid endless loops if there was a media in the device on startup */ |
26 | + if (media_status == MEDIA_STATUS_UNKNOWN) { |
27 | + if (got_media) |
28 | + media_status = MEDIA_STATUS_NO_MEDIA; |
29 | + else |
30 | + media_status = MEDIA_STATUS_GOT_MEDIA; |
31 | + } |
32 | + |
33 | switch (media_status) { |
34 | case MEDIA_STATUS_GOT_MEDIA: |
35 | if (!got_media) { |
36 | -- |
37 | 1.5.3.7 |
38 |