Hello community, here is the log from the commit of package libopensync-plugin-palm checked in at Thu Mar 29 22:21:31 CEST 2007. -------- --- libopensync-plugin-palm/libopensync-plugin-palm.changes 2006-11-06 20:20:17.000000000 +0100 +++ /mounts/work_src_done/STABLE/libopensync-plugin-palm/libopensync-plugin-palm.changes 2007-03-29 20:30:32.327762000 +0200 @@ -1,0 +2,8 @@ +Thu Mar 29 17:24:53 CEST 2007 - cstender@suse.de + +- updated to version 0.22 + o added osync_change_set_member(change, env->member) + o added anchor to store the lastsync of a device + o fixed timeouts and hanging after synchronization + +------------------------------------------------------------------- Old: ---- libopensync-plugin-palm-0.20.tar.bz2 New: ---- libopensync-plugin-palm-0.22.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libopensync-plugin-palm.spec ++++++ --- /var/tmp/diff_new_pack.M25585/_old 2007-03-29 22:20:29.000000000 +0200 +++ /var/tmp/diff_new_pack.M25585/_new 2007-03-29 22:20:29.000000000 +0200 @@ -1,7 +1,7 @@ # -# spec file for package libopensync-plugin-palm (Version 0.20) +# spec file for package libopensync-plugin-palm (Version 0.22) # -# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # @@ -13,7 +13,7 @@ Name: libopensync-plugin-palm BuildRequires: libopensync-devel pilot-link-devel URL: http://www.opensync.org -Version: 0.20 +Version: 0.22 Release: 1 Summary: Palm Synchronization Plug-In for OpenSync License: GNU Library General Public License v. 2.0 and 2.1 (LGPL) @@ -85,7 +85,12 @@ %{_libdir}/opensync/plugins/*.la %{_libdir}/opensync/formats/*.la -%changelog -n libopensync-plugin-palm +%changelog +* Thu Mar 29 2007 - cstender@suse.de +- updated to version 0.22 + o added osync_change_set_member(change, env->member) + o added anchor to store the lastsync of a device + o fixed timeouts and hanging after synchronization * Mon Nov 06 2006 - cstender@suse.de - updated to version 0.20 o changed default config to libusb port ++++++ libopensync-plugin-palm-0.20.tar.bz2 -> libopensync-plugin-palm-0.22.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libopensync-plugin-palm-0.20/configure.ac new/libopensync-plugin-palm-0.22/configure.ac --- old/libopensync-plugin-palm-0.20/configure.ac 2006-11-06 18:43:24.000000000 +0100 +++ new/libopensync-plugin-palm-0.22/configure.ac 2007-03-25 18:17:30.000000000 +0200 @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.58) -AC_INIT([OpenSync Palm Plugin], 0.20, [], [libopensync-plugin-palm]) +AC_INIT([OpenSync Palm Plugin], 0.22, [], [libopensync-plugin-palm]) AM_INIT_AUTOMAKE(foreign) AC_CONFIG_SRCDIR(src/palm_sync.c) AM_CONFIG_HEADER(config.h) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libopensync-plugin-palm-0.20/src/palm_contact.c new/libopensync-plugin-palm-0.22/src/palm_contact.c --- old/libopensync-plugin-palm-0.20/src/palm_contact.c 2006-08-22 23:28:55.000000000 +0200 +++ new/libopensync-plugin-palm-0.22/src/palm_contact.c 2007-02-22 15:30:53.000000000 +0100 @@ -21,7 +21,7 @@ #include "palm_sync.h" #include "palm_format.h" -static OSyncChange *psyncContactCreate(PSyncEntry *entry, OSyncError **error) +static OSyncChange *psyncContactCreate(PSyncEnv *env, PSyncEntry *entry, OSyncError **error) { osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, entry, error); PSyncDatabase *db = entry->db; @@ -29,7 +29,8 @@ OSyncChange *change = osync_change_new(); if (!change) goto error; - + osync_change_set_member(change, env->member); + char *uid = g_strdup_printf("uid-AddressDB-%ld", entry->id); osync_change_set_uid(change, uid); g_free(uid); @@ -95,7 +96,7 @@ for (n = 0; (entry = psyncDBGetNthEntry(db, n, error)); n++) { osync_trace(TRACE_INTERNAL, "Got record with id %ld", entry->id); - OSyncChange *change = psyncContactCreate(entry, error); + OSyncChange *change = psyncContactCreate(env, entry, error); if (!change) goto error; @@ -107,7 +108,7 @@ } } else { while ((entry = psyncDBGetNextModified(db, error))) { - OSyncChange *change = psyncContactCreate(entry, error); + OSyncChange *change = psyncContactCreate(env, entry, error); if (!change) goto error; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libopensync-plugin-palm-0.20/src/palm_event.c new/libopensync-plugin-palm-0.22/src/palm_event.c --- old/libopensync-plugin-palm-0.20/src/palm_event.c 2006-08-23 15:23:39.000000000 +0200 +++ new/libopensync-plugin-palm-0.22/src/palm_event.c 2007-02-22 15:30:53.000000000 +0100 @@ -21,7 +21,7 @@ #include "palm_sync.h" #include "palm_format.h" -static OSyncChange *psyncEventCreate(PSyncEntry *entry, OSyncError **error) +static OSyncChange *psyncEventCreate(PSyncEnv *env, PSyncEntry *entry, OSyncError **error) { osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, entry, error); PSyncDatabase *db = entry->db; @@ -29,6 +29,7 @@ OSyncChange *change = osync_change_new(); if (!change) goto error; + osync_change_set_member(change, env->member); char *uid = g_strdup_printf("uid-DatebookDB-%ld", entry->id); osync_change_set_uid(change, uid); @@ -107,7 +108,7 @@ osync_trace(TRACE_INTERNAL, "Got all recored with id %ld", entry->id); - OSyncChange *change = psyncEventCreate(entry, error); + OSyncChange *change = psyncEventCreate(env, entry, error); if (!change) goto error; @@ -125,7 +126,7 @@ if (entry == NULL) continue; - OSyncChange *change = psyncEventCreate(entry, error); + OSyncChange *change = psyncEventCreate(env, entry, error); if (!change) goto error; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libopensync-plugin-palm-0.20/src/palm_note.c new/libopensync-plugin-palm-0.22/src/palm_note.c --- old/libopensync-plugin-palm-0.20/src/palm_note.c 2006-08-22 23:28:55.000000000 +0200 +++ new/libopensync-plugin-palm-0.22/src/palm_note.c 2007-02-22 15:30:53.000000000 +0100 @@ -21,7 +21,7 @@ #include "palm_sync.h" #include "palm_format.h" -static OSyncChange *psyncNoteCreate(PSyncEntry *entry, OSyncError **error) +static OSyncChange *psyncNoteCreate(PSyncEnv *env, PSyncEntry *entry, OSyncError **error) { osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, entry, error); PSyncDatabase *db = entry->db; @@ -29,6 +29,7 @@ OSyncChange *change = osync_change_new(); if (!change) goto error; + osync_change_set_member(change, env->member); char *uid = g_strdup_printf("uid-MemoDB-%ld", entry->id); osync_change_set_uid(change, uid); @@ -107,7 +108,7 @@ osync_trace(TRACE_INTERNAL, "Got all recored with id %ld", entry->id); - OSyncChange *change = psyncNoteCreate(entry, error); + OSyncChange *change = psyncNoteCreate(env, entry, error); if (!change) goto error; @@ -125,7 +126,7 @@ if (entry == NULL) continue; - OSyncChange *change = psyncNoteCreate(entry, error); + OSyncChange *change = psyncNoteCreate(env, entry, error); if (!change) goto error; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libopensync-plugin-palm-0.20/src/palm_sync.c new/libopensync-plugin-palm-0.22/src/palm_sync.c --- old/libopensync-plugin-palm-0.20/src/palm_sync.c 2006-11-06 18:43:24.000000000 +0100 +++ new/libopensync-plugin-palm-0.22/src/palm_sync.c 2007-01-06 12:47:45.000000000 +0100 @@ -501,22 +501,24 @@ static gboolean _psyncPoll(gpointer data) { + gboolean poll_still_required = TRUE; osync_trace(TRACE_ENTRY, "%s(%p)", __func__, data); PSyncEnv *env = (PSyncEnv *)data; if (env->socket > 0) { osync_trace(TRACE_EXIT, "%s: Already have a socket", __func__); - return TRUE; + return FALSE; } OSyncError *error = NULL; - if (_connectDevice(env, 1, &error)) + if (_connectDevice(env, 1, &error)) { osync_member_request_synchronization(env->member); - else + poll_still_required = FALSE; + } else osync_error_free(&error); osync_trace(TRACE_EXIT, "%s", __func__); - return TRUE; + return poll_still_required; } static gboolean _psyncPing(gpointer data) @@ -540,20 +542,19 @@ static void psyncThreadStart(PSyncEnv *env) { - return; osync_trace(TRACE_ENTRY, "%s(%p)", __func__, env); GMainContext *context = osync_member_get_loop(env->member); GSource *source = g_timeout_source_new(5000); g_source_set_callback(source, _psyncPing, env, NULL); - g_source_attach(source, context); - + env->sourceTags->ping = g_source_attach(source, context); + g_source_unref (source); -//FIXME also polls at the end of a hot sync ... source = g_timeout_source_new(1000); g_source_set_callback(source, _psyncPoll, env, NULL); - g_source_attach(source, context); + env->sourceTags->poll = g_source_attach(source, context); + g_source_unref (source); osync_trace(TRACE_EXIT, "%s", __func__); } @@ -650,6 +651,10 @@ PSyncEnv *env = osync_try_malloc0(sizeof(PSyncEnv), error); if (!env) goto error; + env->sourceTags = NULL; + env->sourceTags = osync_try_malloc0(sizeof(PSyncSourceTags), error); + if (!env) + goto error; char *configdata = NULL; int configsize = 0; @@ -672,6 +677,8 @@ error_free_config: g_free(configdata); error_free_env: + if (env->sourceTags) + g_free(env->sourceTags); g_free(env); error: osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); @@ -685,6 +692,7 @@ OSyncError *error = NULL; int ret; struct SysInfo sys_info; + char anchor[25]; //now connect with the palm if (!_connectDevice(env, env->timeout, &error)) @@ -729,11 +737,14 @@ } }*/ - // TODO set anchor of lastSyncPC and check if got synced somewhere else in meantime.... if (env->user.lastSyncPC == 0) { - //Device has been reseted + //Device has been reset osync_trace(TRACE_INTERNAL, "Detected that the Device has been reset"); osync_member_set_slow_sync(env->member, "data", TRUE); + } else { + snprintf(anchor, 24, "%li", env->user.lastSyncPC); + if (!osync_anchor_compare(env->member, "lastSyncPC", anchor)) + osync_member_set_slow_sync(env->member, "data", TRUE); } osync_context_report_success(ctx); @@ -806,12 +817,19 @@ static void psyncDone(OSyncContext *ctx) { + char *anchor; osync_trace(TRACE_ENTRY, "%s(%p)", __func__, ctx); PSyncEnv *env = (PSyncEnv *)osync_context_get_plugin_data(ctx); PSyncDatabase *db = NULL; OSyncError *error = NULL; + osync_trace(TRACE_INTERNAL, "Removing Palm sync timer, ping: %i", + g_source_remove(env->sourceTags->ping)); + //Just in case it's still running + osync_trace(TRACE_INTERNAL, "Removing Palm sync timer, poll: %i", + g_source_remove(env->sourceTags->poll)); + if ((db = psyncDBOpen(env, "AddressDB", &error))) { osync_trace(TRACE_INTERNAL, "Reseting Sync Flags for AddressDB"); dlp_ResetSyncFlags(env->socket, db->handle); @@ -841,11 +859,30 @@ } //Set the log and sync entries on the palm - dlp_AddSyncLogEntry(env->socket, "Sync Successfull\n"); + dlp_AddSyncLogEntry(env->socket, "Sync Successful\n"); dlp_AddSyncLogEntry(env->socket, "Thank you for using\n"); dlp_AddSyncLogEntry(env->socket, "OpenSync"); - env->user.lastSyncPC = 1; + + anchor = osync_anchor_retrieve(env->member, "lastSyncPC"); + if ((anchor == NULL) || (env->user.lastSyncPC == 0)) { + srandom(time(NULL)); + // Stolen from jpilot (jpilot.org), complete with comment: + /* RAND_MAX is 32768 on Solaris machines for some reason. + * If someone knows how to fix this, let me know. + */ + if (RAND_MAX==32768) { + env->user.lastSyncPC = 1+(2000000000.0*random()/(2147483647+1.0)); + } else { + env->user.lastSyncPC = 1+(2000000000.0*random()/(RAND_MAX+1.0)); + } + anchor = malloc(25); + snprintf(anchor, 24, "%li", env->user.lastSyncPC); + osync_trace(TRACE_INTERNAL, "Made a new lastSyncPC of %s", anchor); + osync_anchor_update(env->member, "lastSyncPC", anchor); + free(anchor); + } + env->user.lastSyncDate = time(NULL); env->user.successfulSyncDate = time(NULL); @@ -884,6 +921,8 @@ osync_trace(TRACE_ENTRY, "%s(%p)", __func__, data); PSyncEnv *env = (PSyncEnv *)data; + if (env->sourceTags) + g_free(env->sourceTags); g_free(env); osync_trace(TRACE_EXIT, "%s", __func__); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libopensync-plugin-palm-0.20/src/palm_sync.h new/libopensync-plugin-palm-0.22/src/palm_sync.h --- old/libopensync-plugin-palm-0.20/src/palm_sync.h 2006-08-22 23:28:55.000000000 +0200 +++ new/libopensync-plugin-palm-0.22/src/palm_sync.h 2007-01-06 12:47:45.000000000 +0100 @@ -89,6 +89,11 @@ int index; } PSyncEntry; +typedef struct PSyncSourceTags { + guint ping; + guint poll; +} PSyncSourceTags; + struct PSyncEnv { OSyncMember *member; @@ -107,6 +112,8 @@ struct PilotUser user; char *codepage; + + PSyncSourceTags *sourceTags; }; void psyncDBClose(PSyncDatabase *db); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/libopensync-plugin-palm-0.20/src/palm_todo.c new/libopensync-plugin-palm-0.22/src/palm_todo.c --- old/libopensync-plugin-palm-0.20/src/palm_todo.c 2006-08-22 23:28:55.000000000 +0200 +++ new/libopensync-plugin-palm-0.22/src/palm_todo.c 2007-02-22 15:30:53.000000000 +0100 @@ -21,7 +21,7 @@ #include "palm_sync.h" #include "palm_format.h" -static OSyncChange *psyncTodoCreate(PSyncEntry *entry, OSyncError **error) +static OSyncChange *psyncTodoCreate(PSyncEnv *env, PSyncEntry *entry, OSyncError **error) { osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, entry, error); PSyncDatabase *db = entry->db; @@ -29,6 +29,7 @@ OSyncChange *change = osync_change_new(); if (!change) goto error; + osync_change_set_member(change, env->member); /* Set the uid */ char *uid = g_strdup_printf("uid-ToDoDB-%ld", entry->id); @@ -106,7 +107,7 @@ osync_trace(TRACE_INTERNAL, "Got all recored with id %ld", entry->id); - OSyncChange *change = psyncTodoCreate(entry, error); + OSyncChange *change = psyncTodoCreate(env, entry, error); if (!change) goto error; @@ -124,7 +125,7 @@ if (entry == NULL) continue; - OSyncChange *change = psyncTodoCreate(entry, error); + OSyncChange *change = psyncTodoCreate(env, entry, error); if (!change) goto error; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org