Bug 352130

Summary: OpenSync cannot handle SONY-ERICSSON-DST which leads to an +/-1h offset
Product: [openSUSE] openSUSE 11.0 Reporter: Forgotten User zOWss6Gs9u <forgotten_zOWss6Gs9u>
Component: Mobile DevicesAssignee: Christopher Stender <cstender>
Status: RESOLVED NORESPONSE QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P3 - Medium    
Version: Factory   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Community User Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: "syncml-obex-client -u 0 --slow-sync text/x-vcalendar calendar --wbxml --useStringTable" output
KOrganizer export
korganizer screenshot

Description Forgotten User zOWss6Gs9u 2008-01-07 21:00:39 UTC
Synchronizing my Sony Ericsson K530i cell phone with KDE-PIM through KitchenSync/OpenSync I found a problem.

Using syncml-obex-client I see that one entry is:
  DTSTART:20081227T230000Z
  DTEND:20081228T225900Z
  X-SONYERICSSON-DST:0
and another one is:
  DTSTART:20080519T230000Z
  DTEND:20080520T225900Z
  X-SONYERICSSON-DST:0

The first entry imports correctly in KOrganizer, but the second one has an offset of +1 hour.
The first entry date is 28 of December (winter time) and the second entry date is 20 of May (summer time). And I suppose this is the problem.
If I export the KOrganizer calendar to a vCalendar file I see that the time is correct... it's just KOrganizer that offsets it.
I suppose "X-SONYERICSSON-DST" isn't something standard. But is this a problem in the vCalendar standard, in the way my cell phone implements it or in the way KOrganizer implements it?

I'm using package kdepim3-3.5.7.enterprise.0.20070904.708012-38.2 from KDE:KDE3 OBS repository.
Comment 1 Forgotten User zOWss6Gs9u 2008-01-07 21:02:27 UTC
Created attachment 189617 [details]
"syncml-obex-client -u 0 --slow-sync text/x-vcalendar calendar --wbxml --useStringTable" output
Comment 2 Forgotten User zOWss6Gs9u 2008-01-07 21:03:22 UTC
Created attachment 189618 [details]
KOrganizer export
Comment 3 Forgotten User zOWss6Gs9u 2008-01-07 21:05:02 UTC
Created attachment 189620 [details]
korganizer screenshot
Comment 4 Forgotten User zOWss6Gs9u 2008-01-18 18:53:47 UTC
Thinking about it... probably it is a phone firmware bug?
20 May in Spain starts at 19 May 22:00:00UTC while 28 December starts at 27 December 23:00:00 UTC since May is in summer time and Spain is at UTC+2.
I reported the bug: http://developer.sonyericsson.com/thread.jspa?messageID=113057#113057
But since I don't expect too much from Sony Ericsson, could OpenSync be patched to modify his behaviour when it finds a "X-SONYERICSSON-DST" field?

I add cstender and dmueller CC since they are in the last changelogs from libopensync and libopensync-plugin-syncml packages.
Comment 5 Daniel Gollub 2008-01-19 20:16:30 UTC
Not quite sure who is to blame - the mobile or OpenSync. You hit something which already made us lot of headache. We call this phenomenon All-Day event.

Your mobile is using vCalendar, kdepim is using interally iCalendar. OpenSync converts the vCalendar to an internal XMLFormat and then to iCalendar and pass it to kdepim. It doesn't touch the timestamps. Your phone is interpreting this (odd) timestamps as "allday" events. kdepim is interpreting this as regular event which takes about one 24h-1minute. Only the phone calendar identifies this as All day event. This posting might sum it up best:

http://mail.kde.org/pipermail/korganizer-devel/2007-February/001180.html

So actually it's an issue of the interoperability of your mobile, the vCalendar and iCalendar (rfc2445) format.

This could and should be fixed/workaround within the OpenSync vformat plugin.
Comment 6 Forgotten User zOWss6Gs9u 2008-01-19 21:53:39 UTC
Ok.
I see that OpenSync:OpenSync-0.3x and OpenSync:OpenSync-svn OBS repositories already have libopensync-plugin-vformat packages. To me this isn't an urgent problem, I was just playing with the synchronizing capabilities of my new phone. But if you need some testing just say me what packages to install.
Comment 7 Christopher Stender 2008-01-20 11:52:47 UTC
Daniel, are you sure this is a all-day bug? Of course kdepim isn't able to show this kind of all-day events (24h-1m), but if I understood Christian correctly, I guess there is something wrong with winter/summer time encodings.

> Using syncml-obex-client I see that one entry is:
>   DTSTART:20081227T230000Z
>   DTEND:20081228T225900Z
>   X-SONYERICSSON-DST:0
> and another one is:
>   DTSTART:20080519T230000Z
>   DTEND:20080520T225900Z
>   X-SONYERICSSON-DST:0

IIRC we already got such a report.
Comment 8 Daniel Gollub 2008-01-20 12:43:13 UTC
There can't be a timezone issue for all day events. Since for all day events there isn't any relevant timestamp which we have to care about. You can even see that the calendar of the SE mobile doesn't care about timezone either. The X-SONYERICSSON-DST: (which very likely stands for daylight saving time) is in both cases set to 0 - if the mobile would care about this shouldn't be set at least once to 1 (or != 0)? So the mobile doesn't really care about so we shouldn't care about it either - to fit the needs of the pim application like korganizer or evoluation. Additionatlly we don't have to care about any timezone issue ... since there is not timetstamp.

The comment from the mailinglist posting, which i posted, should be the way we should go. Just ignore the timestamp for all day events like this and convert it from YYYYMMDDTHHMMSS[Z] to YYYYMMDD. So it would also fit the needs of the unspecified area about just using the datestamp (like mentioned in the mailing list posting).

The oustanding question is, how does the mobile interpret all day event which contains only of a datestamp (YYYYMMDD).

DTEND: YYYYMMDD(+1 day)
DTSTART: YYYYMMDD

Does the mobile still show it as all day event .. or does it get rejected?
I guess the mobiles have all-day events fixed to categories, so it hopefully wouldn't hurt if we would just sent a datetamp.
Comment 9 Christopher Stender 2008-01-21 13:19:39 UTC
Of course you're right. These events should be all-day events and there can't be a timezone problem. But what Christian means is the offset of +1. If you change these events to 

DTSTART:20081227T230000Z
DTEND:20081228T205900Z
X-SONYERICSSON-DST:0

and another one to:
DTSTART:20080519T230000Z
DTEND:20080520T205900Z
X-SONYERICSSON-DST:0

we don't have an all-day event anymore. What now happens, is that the first entry appears correctly in korganizer, but the second one has an offset of +1 and will not start on 20080519 anymore. Christian, is this right?
Comment 10 Forgotten User zOWss6Gs9u 2008-01-21 18:49:10 UTC
Yes, that's correct.

I must admit I never tried anything different than a birthday (all-day event). I just tried... Now that I'm in UTC+1 I created an event for 15th May (when I will be at UTC+2) from 8:00AM to 12:00AM and Kontact thinks it starts at 9:00AM and ends at 13:00AM.

BEGIN:VEVENT
DTSTART:20080515T070000Z
DTEND:20080515T110000Z
DESCRIPTION:
SUMMARY:Floo
LAST-MODIFIED:20080121T183721Z
X-SONYERICSSON-DST:0
X-IRMC-LUID:0000000000E1
END:VEVENT
Comment 11 Christopher Stender 2008-02-04 14:31:24 UTC
Daniel, IIRC you already had such a problem before. Is there anything we can do (I'm not speaking about all-day-events)?
Comment 14 Christopher Stender 2008-04-15 11:51:45 UTC
Well, I've no idea what we can do here. If DST is 0 in both cases, there is no easy way to find out how to handle timestamps.
Comment 15 Christopher Stender 2008-04-15 13:21:30 UTC
http://developer.sonyericsson.com/message/113057#113057

It smells like a firmware bug.
Comment 16 Forgotten User zOWss6Gs9u 2008-04-15 16:59:24 UTC
I am who reported that problem in the Sony Ericsson forum. The problem is... oh surprise, Sony Ericsson ignores his users. There have been no firmware updates or any kind of explanations since I reported the bug...
So what I am really asking for is a patch for a Sony Ericsson problem... in case it is posible to identify the problematic phones from the vCalendar output. I *suppose* the Windows software Sony Ericsson bundles with the phone is able to correctly sync with Outlook... but right now I don't have Windows to test.

But looks like the problem isn't only from Sony Ericsson. Pavel Machek (from Novell up to where I know, perhaps he can give you a defective hardware to play) seems to have the same problem with a Nokia 6230 -> http://pavelmachek.livejournal.com/55906.htm

I have seen some outputs with X-SONYERICSSON-DST != 0, but I have been no able to understand why. It seems to be a random thing, and anyway... even when X-SONYERICSSON-DST != 0 the output is still incorrect.

If there are no ideas I will try to test different combinations in a systematic way and post them here in case someone can see a logic in the outputs.
Comment 17 Forgotten User zOWss6Gs9u 2008-04-15 17:01:58 UTC
I deleted the last 'l'.
http://pavelmachek.livejournal.com/55906.html
Comment 18 Forgotten User zOWss6Gs9u 2008-04-15 20:22:40 UTC
This doesn't solves the Nokia 6230 problem, but... http://www.gammu.org/bugs/view.php?id=81

After some tests looks like the "The calendar event has a field named 'X-SONYERICSSON-DST', with value 0 (standard time) or 4 (DST), which indicates when this entry was made." description is correct.
Up to where I can remember I really have just seen '0' and '4' values. So... doesn't make any sense, but there is information enough to obtain the correct date. :-p

When I have time I will verify the edge cases (if DTSTART and DTEND are in different "DSTs" each one has a different behavior or DTSTART date marks the behavior of both?).
Comment 19 Forgotten User zOWss6Gs9u 2008-04-15 22:36:35 UTC
After all looks like it's just a:
if (X-SONYERICSSON-DST == 4 && cite_is_at_winter())
    real_hour=retrieved_hour+1;
else if (X-SONYERICSSON-DST == 0 && cite_is_at_summer())
    real_hour=retrieved_hour-1;
else if (X-SONYERICSSON-DST != 0 && X-SONYERICSSON-DST != 4)
    printf("We all hate Sony Ericsson");

I don't know if there will be problems with cite_is_at_winter/summer if OS region is different from the phone region. Each country changes to/from DST at different dates, doesn't?
Comment 20 Christopher Stender 2008-04-22 18:43:08 UTC
Thanks a lot for this information. I think you're right but we need to know if this only happens from phone to computer or also the other way around.

Btw: this code blob can identify if we are in dst or not:
--------------------
#include <stdio.h>
#include <time.h>

int main() {
        time_t current_time;
        struct tm *time_info;
        int dst;

        time(&current_time);
        time_info = localtime(&current_time);
        dst = time_info->tm_isdst;

        printf("dst: %i\n", dst);
}
--------------------

Can you please test if we need your workaround for computer to phone synchronization? Thanks in advance.
Comment 21 Forgotten User zOWss6Gs9u 2008-04-23 18:23:47 UTC
Yes, from computer to phone also fails.

Today I created an event for 9 Dec from 9:45 to 15:00 and when syncing the phone says 10:45 to 16:00.
Another date created for tomorrow works fine.
Comment 22 Christopher Stender 2008-04-25 14:04:58 UTC
Okay, so we need a workaround for some/all Sony Ericsson cellphones. I guess it is the same behavior with irmc and syncml, isn't it? Which protocol did you use?
Comment 23 Forgotten User zOWss6Gs9u 2008-04-25 16:29:02 UTC
I have used syncml all the time, irmc opensync plugin was not even installed.

I though irmc was only for InfraRed connections. Looking into it now I see I can select between Bluetooth, IR and cable... but I don't have bluetooth/IR in the PC and I'm not sure about the cable thing.
By default it says /dev/ttyS0. I suppose I can use the USB port like a serial connection, but not really sure about how. I will look at it, but if you can explain me how it will be faster/more reliable.
Comment 24 Forgotten User zOWss6Gs9u 2008-04-26 09:01:25 UTC
I took an USB<->BT adapter from another computer. But still the best I can archieve was
$ msynctool --sync irmc
Synchronizing group "irmc"
Member 1 of type kdepim-sync just connected
Member 2 of type irmc-sync had an error while connecting: Request failed
Member 1 of type kdepim-sync just disconnected
All clients have disconnected
The sync failed: Unable to connect one of the members
Error while synchronizing: Unable to connect one of the members

while the phone shows a "syncing" screen for half a second.

...it doesn't supports IrMC?
Comment 25 Forgotten User zOWss6Gs9u 2008-04-26 09:57:19 UTC
With Opensync 0.36 from OBS IrMC works. But also has the +/-1hour offset.
Comment 26 Christopher Stender 2008-05-02 14:27:34 UTC
Thanks for the info. BTW could you please provide the irmc-sync config? We still miss an example config for the irmc-sync README. :-)

I have to discuss this bug with some OpenSync developers to find a good way how we can fix this. It is a bad idea to add workarounds to irmc-sync AND syncml because these plugins should not modify any data. I guess we will see a solution in OpenSync 0.40 but not in 0.22. Sorry for that and thanks a lot for your help.
Comment 27 Forgotten User zOWss6Gs9u 2008-05-02 17:02:36 UTC
Do you mean the ~/.opensync/group1/2/irmc-sync.conf file?
> <?xml version="1.0"?>
> <config>
>   <connectmedium>bluetooth</connectmedium>
>   <btunit>$MAC</btunit>
>   <btchannel>$CHANNEL</btchannel>
> </config>
Is the same explained in /usr/share/doc/packages/libopensync-plugin-irmc/README from libopensync-plugin-irmc-0.36-2.1.
Probably kitchensync should talk to kdebluetooth to make this easier?

Yes, the workaround can be funny.
irmc-sync: bad
sync-ml: bad
gnokii: '?', gammu is supposed to fix the problem. And even if today fails a new version can fix the problem.
Comment 28 Larry Finger 2011-04-04 02:26:06 UTC
The version with which you had the bug is now obsolete. I'll close this as NORESPONSE. If you can still reproduce it in current 11.4, please reopen the bug and move it to the appropriate version. Thanks!