Bug 14228 - Lua/C bindings to make SetupTZ, etc cleaner
: Lua/C bindings to make SetupTZ, etc cleaner
Status: CLOSED FIXED
Product: SqueezePlay
Classification: Unclassified
Component: API
: unspecified
: PC Other
: P1 normal (vote)
: 7.5.0
Assigned To: Brandon Black
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-23 13:13 UTC by Brandon Black
Modified: 2010-04-08 17:24 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments
SqueezePlay patch (proposed) (16.03 KB, patch)
2009-10-09 10:02 UTC, Brandon Black
Details | Diff
SC/SN patch (proposed) (2.77 KB, patch)
2009-10-09 10:03 UTC, Brandon Black
Details | Diff
SqueezePlay patch (proposed, v2) (16.37 KB, patch)
2009-10-21 10:06 UTC, Brandon Black
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brandon Black 2009-09-23 13:13:02 UTC
Create Lua/C readlink(), settimeofday(), and symlink() bindings, and use them to replace various os.execute() and io.popen() calls in squeezeplay_squeezeos's SetupTZ and Squeezebox{Jive|Baby|Fab4}'s setDate.
Comment 1 Brandon Black 2009-10-09 10:02:50 UTC
Created attachment 6074 [details]
SqueezePlay patch (proposed)
Comment 2 Brandon Black 2009-10-09 10:03:19 UTC
Created attachment 6075 [details]
SC/SN patch (proposed)
Comment 3 Brandon Black 2009-10-09 10:06:34 UTC
Patches to SP and the server-side stuff proposed and attached.  These patches were both just done "all in my head", I haven't yet tried to compile and/or test this code, but if anyone has an opinion on whether the logic is sane, that would be good.

Summary: All software clock, RTC clock, and timezone set/get code was pushed down to squeezeplay_squeezeos C code.  The SetupTZ applet no longer has to load its (fat) self to attempt timezone guessing at applet registration / server connect time, and 7.5 SC/SN only send "date_epoch" which is unix epoch seconds used to set the SP software clock directly without any date-parsing magic.
Comment 4 Brandon Black 2009-10-21 10:06:10 UTC
Created attachment 6185 [details]
SqueezePlay patch (proposed, v2)


Updated the SP half of the patch now that I've actually compiled and tested it, it works.  The SC/SN patch was fine as-is.  Summary above still applies.  Richard can you review this?
Comment 5 Richard Titmuss 2009-11-02 13:02:26 UTC
I've reviewed the SP patch, looks good to me. One minor thing, in lua you should use namesLikeThis, not names_like_this. I'd suggest something like:

static const struct luaL_Reg squeezeos_bsp_lib[] = {
 	{ "reboot", squeezeos_reboot },
 	{ "poweroff", squeezeos_poweroff },
+	{ "swclockSetEpoch", squeezeos_swclock_set_epoch },
+	{ "sys2hwclock", squeezeos_hwclock_sys2hc },
+	{ "hwclock2sys", squeezeos_hwclock_hc2sys },
+	{ "getTimezone", squeezeos_get_timezone },
+	{ "setTimezone", squeezeos_set_timezone },
 	{ NULL, NULL }
 };
Comment 6 SVN Bot 2009-11-04 08:36:33 UTC
 == Auto-comment from SVN commit #29156 to the slim repo by blblack ==
 == https://svn.slimdevices.com/slim?view=revision&revision=29156 ==

bug 14228: switch to serving time to SP players in epoch seconds
Comment 7 SVN Bot 2009-11-04 08:37:21 UTC
 == Auto-comment from SVN commit #8008 to the jive repo by blblack ==
 == https://svn.slimdevices.com/jive?view=revision&revision=8008 ==

bug 14228: replace all the io.popen/os.execute calls related to time and timezone with C code in squeezeos.c, set time from network via epoch integer instead of date string, and do not load the heavy SetupTZ applet just for the initial timezone guessing.  Needs slim/7.5/trunk r29156 to fully function
Comment 8 Brandon Black 2009-11-04 08:49:33 UTC
The above two commits should fix this all up.
Comment 9 SVN Bot 2009-11-04 10:13:36 UTC
 == Auto-comment from SVN commit #8011 to the jive repo by blblack ==
 == https://svn.slimdevices.com/jive?view=revision&revision=8011 ==

bug 14228: fix two missing "then"s from r8008
Comment 10 Chris Owens 2010-04-08 17:24:59 UTC
This bug has been marked fixed in a released version of Squeezebox Server or the accompanying firmware or mysqueezebox.com release.

If you are still seeing this issue, please let us know!