static gboolean enumerate_usb(gpointer data) { struct timeval tv; /* We arrive here twice: when app sync is done * and when the app sync timeout gets triggered. * The tags are used to filter out these repeats. */ if( enum_tag == sync_tag ) { log_debug("ignoring enumeration trigger"); } else { #ifdef NOKIA /* activate usb connection/enumeration */ write_to_file("/sys/devices/platform/musb_hdrc/gadget/softconnect", "1"); log_debug("Softconnect enumeration done\n"); #endif enum_tag = sync_tag; /* Debug: how long it took from sync start to get here */ gettimeofday(&tv, 0); timersub(&tv, &sync_tv, &tv); log_debug("sync to enum: %.3f seconds", tv.tv_sec + tv.tv_usec * 1e-6); /* remove dbus service */ usb_moded_appsync_cleanup(); } /* return false to stop the timer from repeating */ return FALSE; }
static void enumerate_usb(void) { struct timeval tv; /* Stop the timer in case of explicit enumeration call */ cancel_enumerate_usb_timer(); /* Debug: how long it took from sync start to get here */ gettimeofday(&tv, 0); timersub(&tv, &sync_tv, &tv); log_debug("sync to enum: %.3f seconds", tv.tv_sec + tv.tv_usec * 1e-6); #ifdef APP_SYNC_DBUS /* remove dbus service */ usb_moded_appsync_cleanup(); #endif /* APP_SYNC_DBUS */ }