Author Topic: Wrong Date And Pdaxrom On/off Issues  (Read 7573 times)

kkazakov13

  • Sr. Member
  • ****
  • Posts: 408
    • View Profile
Wrong Date And Pdaxrom On/off Issues
« on: February 18, 2007, 01:58:42 am »
When I started with beta3, had some time issues and pdaxrom occasionally "locking up" - which turns out to be because of wrong clock. Here I share my way of fixing them.

I use the following pair of scripts.
When you need date synchronization, just call 'dt' script.

(modify the values to your needs, I live in Sofia and use for sync ntp.intergenia.de, which you might not be able to access. Place the files in /usr/local/bin, and 'chmod +x' )

dt
Code: [Select]
#!/bin/bash

lt_unset

ntpdate ntp.intergenia.de
hwclock --systohc

lt_set

lt_set:
Code: [Select]
#!/bin/bash

rm -f /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Sofia /etc/localtime

lt_unset:
Code: [Select]
#!/bin/bash

rm -f /etc/localtime


in /etc/apm/scripts.d/hwclock the functions inside look like this:

Code: [Select]
suspend() {
  lt_unset
  hwclock --systohc
  lt_set
  return 0
}

resume() {
  lt_unset
  hwclock --hctosys
  lt_set
  return 0
}

I can guarantee you that you will have _no_ problems with the clock anymore, just set the correct timezone and ntp server. If you don't have internet, you just can issue commands in 'dt' one by one, replacing ntpdate with 'date xxxx' command to set the clock.

Also, if you accidentally turn off your zaurus, don't turn it on immediately. wait 3-4 seconds at least, and then do it.

timezones package from the feed is required.
« Last Edit: February 18, 2007, 03:20:47 am by kkazakov13 »
SL-C3200 ** FOR SALE :( **
https://www.oesf.org/forum/index.php?showtopic=25969

Canon K30225 CF wireless card
Taxan iTax-LAN10 wired card
My packages for customized pdaXrom beta 3

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Wrong Date And Pdaxrom On/off Issues
« Reply #1 on: February 18, 2007, 04:39:56 am »
Quote
When I started with beta3, had some time issues and pdaxrom occasionally "locking up" - which turns out to be because of wrong clock. Here I share my way of fixing them.

I use the following pair of scripts.
When you need date synchronization, just call 'dt' script.

(modify the values to your needs, I live in Sofia and use for sync ntp.intergenia.de, which you might not be able to access. Place the files in /usr/local/bin, and 'chmod +x' )

dt
Code: [Select]
#!/bin/bash

lt_unset

ntpdate ntp.intergenia.de
hwclock --systohc

lt_set

Unfortunately the hwclock function has not been compiled into busybox in r121 and, to my knowlage, no alternative is yet avalible.
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

kkazakov13

  • Sr. Member
  • ****
  • Posts: 408
    • View Profile
Wrong Date And Pdaxrom On/off Issues
« Reply #2 on: February 18, 2007, 07:43:49 am »
I did not said it's for r121, but for beta3
SL-C3200 ** FOR SALE :( **
https://www.oesf.org/forum/index.php?showtopic=25969

Canon K30225 CF wireless card
Taxan iTax-LAN10 wired card
My packages for customized pdaXrom beta 3

ZDevil

  • Hero Member
  • *****
  • Posts: 1998
    • View Profile
    • http://
Wrong Date And Pdaxrom On/off Issues
« Reply #3 on: February 18, 2007, 09:20:35 am »
I simply get rid of atd, which meddles with the system clock, and date setting works fine.
I am sure there is a thread talking about this a couple of months ago, though i can't recall it off the top of my head. The last thing i remember but didn't try is to turn atd on and off by a script, but I I didn't have the resource to spend on researching this.
Also as a result, i lost the last reason to keep KO/Pi in my system. Now still searching for a good alternative...  

Life is too precious for hacking *too much*
Visit my Z screencap gallery[/color]
My EeePC 701 Black = Debian (Lenny) on IceRocks + Transcend SDHC Class6 8GB + 2GB RAM
My Zaurus SL-C3200 = Debian EABI (kernel 2.6.24.3-yonggun) on a swapped internal Sandisk Extreme III CF 16gb
My Debian EABI feed: http://matrixmen.free.fr/zaurus/debian/
My OpenBSD/Zaurus feeds:  Link1, Link2
[/i][/font][/color][/size]

tombraider

  • Sr. Member
  • ****
  • Posts: 409
    • View Profile
    • http://atoah.com/zaurus/
Wrong Date And Pdaxrom On/off Issues
« Reply #4 on: February 18, 2007, 11:52:59 am »
ZDevil:

The date/time setting going to a total crash problem healed itself somehow on my beta3 installation on my C1000 after I installed a bunch of libs and software.  Unfortunately,  it was one of those things where I did not NOTICE it was fixed until after I had done a bunch of changes so I can't say exactly what DID fix it.      But I did not have to remove atd...amazingly, and I don't have to stop and start it via the console commands anymore.

Of course I still have the on/off switch problem;  the changing date and time arbitrarily problem, and the running down the battery problem when it is in suspend....oh,well.

I have to say that pdaxrom is so amazing that despite absolute show-stopper problems,  I still have it installed on my C1000.  Of course, one can only take so much pain so I will, perhaps, be going back to a Sharp Rom sometime.

I don't understand scripts or I would try kkazakov13's method of at least keeping a correct date.



Quote
I simply get rid of atd, which meddles with the system clock, and date setting works fine.
I am sure there is a thread talking about this a couple of months ago, though i can't recall it off the top of my head. The last thing i remember but didn't try is to turn atd on and off by a script, but I I didn't have the resource to spend on researching this.
Also as a result, i lost the last reason to keep KO/Pi in my system. Now still searching for a good alternative...   
[div align=\"right\"][a href=\"index.php?act=findpost&pid=154584\"][{POST_SNAPBACK}][/a][/div]
Learning Chinese?  Have a Mac?  Try Hanzi Master: Download for free

Tombraider's Zaurus C1000 Tips Web Site

SL-3200 from Conics.net: Sharp ROM| SL-C1000: Pdaxrom Beta 3

kkazakov13

  • Sr. Member
  • ****
  • Posts: 408
    • View Profile
Wrong Date And Pdaxrom On/off Issues
« Reply #5 on: February 18, 2007, 01:08:13 pm »
I really _rely_ on Z's date/time now, something I couldn't do few months ago. All thanks to my scripts. I like to make scripts. Have even one which I use to reinstall beta3 from plain files, and then bring it back to the exact settings like I want it, without the garbage (when I mess too much). So this means, reinstalling beta3 and having it usable with all the packages, fixes and all, takes about 20 minutes.
SL-C3200 ** FOR SALE :( **
https://www.oesf.org/forum/index.php?showtopic=25969

Canon K30225 CF wireless card
Taxan iTax-LAN10 wired card
My packages for customized pdaXrom beta 3

tovarish

  • Sr. Member
  • ****
  • Posts: 297
    • View Profile
Wrong Date And Pdaxrom On/off Issues
« Reply #6 on: February 19, 2007, 02:15:50 am »
you dont need to delete /etc/localtime if you do
hwclock --utc --systohc
and
hwclock --utc --hctosys

Quote
When I started with beta3, had some time issues and pdaxrom occasionally "locking up" - which turns out to be because of wrong clock. Here I share my way of fixing them.

I use the following pair of scripts.
When you need date synchronization, just call 'dt' script.

(modify the values to your needs, I live in Sofia and use for sync ntp.intergenia.de, which you might not be able to access. Place the files in /usr/local/bin, and 'chmod +x' )

dt
Code: [Select]
#!/bin/bash

lt_unset

ntpdate ntp.intergenia.de
hwclock --systohc

lt_set

lt_set:
Code: [Select]
#!/bin/bash

rm -f /etc/localtime
ln -s /usr/share/zoneinfo/Europe/Sofia /etc/localtime

lt_unset:
Code: [Select]
#!/bin/bash

rm -f /etc/localtime


in /etc/apm/scripts.d/hwclock the functions inside look like this:

Code: [Select]
suspend() {
  lt_unset
  hwclock --systohc
  lt_set
  return 0
}

resume() {
  lt_unset
  hwclock --hctosys
  lt_set
  return 0
}

I can guarantee you that you will have _no_ problems with the clock anymore, just set the correct timezone and ntp server. If you don't have internet, you just can issue commands in 'dt' one by one, replacing ntpdate with 'date xxxx' command to set the clock.

Also, if you accidentally turn off your zaurus, don't turn it on immediately. wait 3-4 seconds at least, and then do it.

timezones package from the feed is required.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=154561\"][{POST_SNAPBACK}][/a][/div]

Meanie

  • Hero Member
  • *****
  • Posts: 2803
    • View Profile
    • http://www.users.on.net/~hluc/myZaurus/
Wrong Date And Pdaxrom On/off Issues
« Reply #7 on: February 19, 2007, 02:27:56 am »
this is what I have in /etc/apm.d/scripts/hwclock

Code: [Select]
suspend() {
  /etc/rc.d/init.d/atd stop 2>/dev/null >/dev/null
  hwclock --systohc
  return 0
}

resume() {
  hwclock --hctosys
  /etc/rc.d/init.d/atd start 2>/dev/null >/dev/null
  return 0
}

and my time is always correct
SL-C3000 - pdaXii13 build5.4.9 (based on pdaXrom beta3) / SL-C3100 - Sharp ROM 1.02 JP (heavily customised)
Netgear MA701 CF, SanDisk ConnectPlus CF, Socket Bluetooth CF, 4GB Kingston CF,  4GB pqi SD, 4GB ChoiceOnly SD, 2GB SanDisk SD USB Plus, 1GB SanDisk USB Plus, 1GB Transcend SD, 2GB SanDisk MicroSD with SD adaptor, Piel Frama Leather Case, GoldX 5-in-1 USB cable, USB hub, USB mouse, USB keyboard, USB ethernet, USB HDD, many other USB accessories...
(Zaurus SL-C3000 owner since March 14. 2005, Zaurus SL-C3100 owner since September 21. 2005)
http://members.iinet.net.au/~wyso/myZaurus - zBook3K

Ling

  • Sr. Member
  • ****
  • Posts: 350
    • View Profile
    • http://
Wrong Date And Pdaxrom On/off Issues
« Reply #8 on: February 19, 2007, 07:24:29 am »
Is this the default for pdaXii13? I assume so as I have never had a problem.
SL-C3200 w/ pdaXii13 5.3
SL-C860 w/ OZ GPE 3.4.1
Accessories: 4GB Microdrive, 4GB Transcend SD, Linksys WFC12 CF 802.11b, Ambicom CF Modem, Socket Bluetooth

daniel3000

  • Hero Member
  • *****
  • Posts: 1003
    • View Profile
    • http://
Wrong Date And Pdaxrom On/off Issues
« Reply #9 on: February 19, 2007, 09:12:21 am »
Quote
this is what I have in /etc/apm.d/scripts/hwclock

Code: [Select]
suspend() {
  /etc/rc.d/init.d/atd stop 2>/dev/null >/dev/null
  hwclock --systohc
  return 0
}

resume() {
  hwclock --hctosys
  /etc/rc.d/init.d/atd start 2>/dev/null >/dev/null
  return 0
}

and my time is always correct
[div align=\"right\"][a href=\"index.php?act=findpost&pid=154633\"][{POST_SNAPBACK}][/a][/div]

Interesting - does KO/PI alarm work from suspend, although atd is stopped prior to suspending?

daniel
SL-C3200 with weeXpc, based on pdaXrom 1.1.0beta3
HP 200LX with MS-DOS 5.0

tombraider

  • Sr. Member
  • ****
  • Posts: 409
    • View Profile
    • http://atoah.com/zaurus/
Wrong Date And Pdaxrom On/off Issues
« Reply #10 on: February 19, 2007, 12:13:15 pm »
I also have this code below in hwclock.  Would I leave that in or delete it? And does this fix the problem that when the Z is rebooted it goes back 3 days and 8 hours?

Code: [Select]
case "$1" in
  suspend)
      suspend
;;
  resume)
      resume
;;
  *)
    echo "Usage: $0 {suspend|resume}"
    exit 1
esac

exit $?
BTW Why doesn't the internet time checking work in the Date/Time utility when I am internet connected?  I put in what I believe to be a valid ntd server?  Would be nice if it worked.  It DOES look so nice...it's a shame it seems to serve no function.  Or do others have this feature working for them?

Quote
this is what I have in /etc/apm.d/scripts/hwclock

Code: [Select]
suspend() {
  /etc/rc.d/init.d/atd stop 2>/dev/null >/dev/null
  hwclock --systohc
  return 0
}

resume() {
  hwclock --hctosys
  /etc/rc.d/init.d/atd start 2>/dev/null >/dev/null
  return 0
}

and my time is always correct
[div align=\"right\"][a href=\"index.php?act=findpost&pid=154633\"][{POST_SNAPBACK}][/a][/div]
Learning Chinese?  Have a Mac?  Try Hanzi Master: Download for free

Tombraider's Zaurus C1000 Tips Web Site

SL-3200 from Conics.net: Sharp ROM| SL-C1000: Pdaxrom Beta 3

zeigerpuppy

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Wrong Date And Pdaxrom On/off Issues
« Reply #11 on: April 10, 2007, 07:15:23 am »
I am having a problem with my clock on Beta 3,
it resets to Feb 28th on every suspend (very annnoying) and I noticed that there is something wrong with my hwclock:

# hwclock --systohc --debug
hwclock from util-linux-2.12j
hwclock: Open of /dev/rtc failed, error=16: Device or resource busy.
No usable clock interface found
Cannot access the Hardware Clock via any known method.

I have recently installed the kdepim2.2.7 and kopi-apm_1.1
but I think things were flakey before (I didn't try the hwclock command previously however).

Anyone know what to try next??

EDIT
sorry - found the problem, had to stop /etc/rc.d/init.d/atd first!
I guess this should be added to the above scripts
« Last Edit: April 10, 2007, 07:19:55 am by zeigerpuppy »
Zaurus C3100, CE-RH2, Socket lowpower CF Wifi, Socket CF Bluetooth
pdaXrom r198 - testing!, IceWM, Bluetooth modem: Sony Ericsson v600i with 3G.
see some howtos and tips at http://greenant.net/portal/greenant/wiki/Zaurus3100

ToneBlind

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Wrong Date And Pdaxrom On/off Issues
« Reply #12 on: July 10, 2009, 02:40:39 pm »
Quote from: daniel3000
Quote
this is what I have in /etc/apm.d/scripts/hwclock

Code: [Select]
suspend() {
  /etc/rc.d/init.d/atd stop 2>/dev/null >/dev/null
  hwclock --systohc
  return 0
}

resume() {
  hwclock --hctosys
  /etc/rc.d/init.d/atd start 2>/dev/null >/dev/null
  return 0
}

and my time is always correct
[div align=\"right\"][a href=\"index.php?act=findpost&pid=154633\"][{POST_SNAPBACK}][/a][/div]

Interesting - does KO/PI alarm work from suspend, although atd is stopped prior to suspending?

daniel
Blast from the past, I know. I just wanted to say that the KO/PI alarm wakeup fix (kopi-apm) doesn't appear to work in pdaXii13. When I suspend and there is a pending KO/PI alarm, my Zaurus won't wake up and I need to perform a hard reset.

I verified that disabling the hwclock script allows the KO/PI alarm wakeup fix to work. Apparently the original solution for the KO/PI alarm wakeup involved apm, and not atd, but since apm didn't work properly due to some bugs, the atd solution took its place. I might work on trying to fix apm to use that as a solution. However, I'm wondering if stopping atd on suspend might affect some other things, and therefore a better solution for the conflict might be to edit hwclock and reimplement it so that atd is not stopped.

I'm not expecting an answer to this, since pdaXrom seems to be pretty much done in terms of user base and support, but I'm documenting it for the benefit of future generations.  

ToneBlind

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Wrong Date And Pdaxrom On/off Issues
« Reply #13 on: July 10, 2009, 05:13:37 pm »
Quote from: ToneBlind
Blast from the past, I know. I just wanted to say that the KO/PI alarm wakeup fix (kopi-apm) doesn't appear to work in pdaXii13. When I suspend and there is a pending KO/PI alarm, my Zaurus won't wake up and I need to perform a hard reset.

I verified that disabling the hwclock script allows the KO/PI alarm wakeup fix to work. Apparently the original solution for the KO/PI alarm wakeup involved apm, and not atd, but since apm didn't work properly due to some bugs, the atd solution took its place. I might work on trying to fix apm to use that as a solution. However, I'm wondering if stopping atd on suspend might affect some other things, and therefore a better solution for the conflict might be to edit hwclock and reimplement it so that atd is not stopped.

I'm not expecting an answer to this, since pdaXrom seems to be pretty much done in terms of user base and support, but I'm documenting it for the benefit of future generations.  
Obviously, atd must be stopped for hwclock to work (in Beta3 and pdaXii13 at least.) So the only way to solve this conflict and have both proper time and wakeup for KO/PI alarms is to change the kopi-apm script to actually use apm, which to my knowledge would involve fixing apm. I'll have a look.

And yes, I know I'm talking to myself here. And no, I'm not crazy (at least not because of this.  )

ToneBlind

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Wrong Date And Pdaxrom On/off Issues
« Reply #14 on: July 10, 2009, 06:30:23 pm »
The obvious solution was to only stop atd before calling hwclock, and starting it right after. I've tested this, and now both the clock and atd (which means KO/PI alarm wakeup events) work.

Code: [Select]
suspend() {
 /etc/rc.d/init.d/atd stop 2>/dev/null >/dev/null
 hwclock --systohc
 /etc/rc.d/init.d/atd start 2>/dev/null >/dev/null
 return 0
}

resume() {
 /etc/rc.d/init.d/atd stop 2>/dev/null >/dev/null
 hwclock --hctosys
 /etc/rc.d/init.d/atd start 2>/dev/null >/dev/null
 return 0
}