From a6b3ac0b3482ca5992004a8492b36cea1afeac5c Mon Sep 17 00:00:00 2001 From: skeezix Date: Wed, 16 Dec 2009 22:27:39 -0500 Subject: [PATCH] In the last couple checkins, introduced a bug where when a SD is popped out the icons are not removed from desktop. That'll teach me to out-clever myself. --- apps/pndnotifyd.c | 10 ++++++---- include/pnd_notify.h | 7 +++++++ lib/pnd_notify.c | 25 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/apps/pndnotifyd.c b/apps/pndnotifyd.c index 0fa18ba..b511930 100644 --- a/apps/pndnotifyd.c +++ b/apps/pndnotifyd.c @@ -235,6 +235,10 @@ int main ( int argc, char *argv[] ) { // lets not eat up all the CPU // should use an alarm or select() or something -- I mean really, why aren't I putting interval_secs into // the select() call above in pnd_notify_whatsitcalled()? -- but lets not break this right before release shall we + // NOTE: Oh right, I remember now -- inotify will spam when a card is inserted, and it will not be instantaneoous.. + // the events will dribble in over a second. So this sleep is a lame trick that generally works. I really should + // do select(), and then when it returns just spin for a couple seconds slurping up events until no more and a thresh-hold + // time is hit, but this will do for now. I suck. sleep ( interval_secs ); } // while @@ -520,12 +524,10 @@ unsigned char perform_discoveries ( char *appspath, char *overridespath, // attempt to auto-discover applications in the given path applist = pnd_disco_search ( appspath, overridespath ); - if ( ! applist ) { - return ( 0 ); + if ( applist ) { + process_discoveries ( applist, emitdesktoppath, emiticonpath ); } - process_discoveries ( applist, emitdesktoppath, emiticonpath ); - // run a clean up, to remove any dotdesktop files that we didn't // just now create (that seem to have been created by pndnotifyd // previously.) This allows SD eject (or .pnd remove) to remove diff --git a/include/pnd_notify.h b/include/pnd_notify.h index f83c6f9..a555bc9 100644 --- a/include/pnd_notify.h +++ b/include/pnd_notify.h @@ -32,6 +32,13 @@ void pnd_notify_watch_path ( pnd_notify_handle h, char *fullpath, unsigned int f */ unsigned char pnd_notify_rediscover_p ( pnd_notify_handle h ); +/* wait_until_ready() will loop (up to a max of secs_timeout) until inotify seems to + * be responding. Returns 0 if inotify is never ready during the interval, otherwise + * it suggests inotify is up and going. + * secs_timeout may be 0 which means 'forever' + */ +unsigned char pnd_notify_wait_until_ready ( unsigned int secs_timeout ); + #ifdef __cplusplus } /* "C" */ #endif diff --git a/lib/pnd_notify.c b/lib/pnd_notify.c index a5b8c44..9be749b 100644 --- a/lib/pnd_notify.c +++ b/lib/pnd_notify.c @@ -172,3 +172,28 @@ unsigned char pnd_notify_rediscover_p ( pnd_notify_handle h ) { return ( 1 ); } + +/* we've run into the issue where inotify returns that it is set up, but in + * fact is not doing anything; restarting the process repairs it.. so here + * we devise a wank that continually tests inotify until it responds, then + * returns knowing we're good + */ +unsigned char pnd_notify_wait_until_ready ( unsigned int secs_timeout ) { + return ( 0 ); // fail +} + +static unsigned char _inotify_test_run ( void ) { +#if 0 + // set up inotify + int fd; + + fd = inotify_init(); + + if ( fd < 0 ) { + return ( 0 ); // failed to init at all + } + + + +#endif +} -- 2.39.2