int update(Flash* flash, const char* obj_path) { pid_t pid; int status=-1; pid = fork(); if (pid == 0) { const gchar* path = flash_get_flasher_path(flash); const gchar* name = flash_get_flasher_name(flash); const gchar* inst = flash_get_flasher_instance(flash); const gchar* filename = flash_get_filename(flash); status = execl(path, name, inst, filename, obj_path, NULL); return status; } return 0; }
static gboolean on_init(Flash *f, GDBusMethodInvocation *invocation, gpointer user_data) { flash_complete_init(f,invocation); //tune flash if(strcmp(flash_get_flasher_instance(f),"bios") == 0) { flash_set_filename(f,""); const gchar* obj_path = g_dbus_object_get_object_path((GDBusObject*)user_data); int rc = update(f,obj_path); if(rc==-1) { printf("ERROR FlashControl: Unable to init\n"); } sleep(3); rc = update(f,obj_path); } return TRUE; }