In the last couple checkins, introduced a bug where when a SD is popped out
authorskeezix <skeezix@flotsam-vm.(none)>
Thu, 17 Dec 2009 03:27:39 +0000 (22:27 -0500)
committerskeezix <skeezix@flotsam-vm.(none)>
Thu, 17 Dec 2009 03:27:39 +0000 (22:27 -0500)
the icons are not removed from desktop. That'll teach me to out-clever myself.

apps/pndnotifyd.c
include/pnd_notify.h
lib/pnd_notify.c

index 0fa18ba..b511930 100644 (file)
@@ -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
index f83c6f9..a555bc9 100644 (file)
@@ -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
index a5b8c44..9be749b 100644 (file)
@@ -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
+}