Author: bklaas
Date: Mon Feb  1 07:41:56 2010
New Revision: 8440

URL: http://svn.slimdevices.com/jive?rev=8440&view=rev
Log:
 r38...@daddymac-520 (orig r8422):  vferey | 2010-01-28 19:15:31 -0500
 export the /var/log directory as a read-only folder. This should enable the 
user to monitor the logs including samba logs.
 
 r38...@daddymac-520 (orig r8424):  felix | 2010-01-29 10:00:11 -0500
 Bug: 15556 
 Description: DHCP client fix - enable option to check IP address before using 
it (and decline if already in use) 
 
 r38...@daddymac-520 (orig r8425):  bklaas | 2010-01-29 13:48:06 -0500
 Bug: n/a
 Description: add support for a setSelectedIndex param to be used in 
conjunction with a nextWindow param
 This allows for example, the Sleep window UI to jump to the top of the menu 
after a "Sleep in X Minutes" item is selected.
 
 r38...@daddymac-520 (orig r8426):  bklaas | 2010-01-29 13:54:22 -0500
 Bug: n/a
 Description: support for setSelectedIndex in _hideToX() call
 
 r38...@daddymac-520 (orig r8427):  adrian | 2010-01-30 10:09:49 -0500
 Bug: N/A
 Description: can be called with h or w set to NULL - avoid crashing in the 
error condition by dereferencing
 
 r38...@daddymac-520 (orig r8428):  adrian | 2010-01-30 13:21:36 -0500
 Bug: 15561
 Description: logging to understand reason for labels not being displayed and 
returning a null surface here (most likely cause is that they result in an SDL 
surface width > 16k pixels)
 
 r38...@daddymac-520 (orig r8429):  adrian | 2010-01-30 13:29:39 -0500
 Bug: 15561
 Description: don't display the problem string in the logging message
 
 r38...@daddymac-520 (orig r8430):  adrian | 2010-01-31 08:44:42 -0500
 Bug: N/A
 Description: update rtmp handler to include amf0 serialisation code so that 
applets can use the handler directly without server support
 
 r38...@daddymac-520 (orig r8431):  ayoung | 2010-02-01 00:23:10 -0500
 Fixed bug 15402: add parsing for "m4ae" box
 r38...@daddymac-520 (orig r8432):  ayoung | 2010-02-01 01:46:56 -0500
 Fix startup interval when jive_jiffies() > MAX_INT_32
 r38...@daddymac-520 (orig r8433):  michael | 2010-02-01 03:44:52 -0500
 Bug: 15522
 Description: wait up to 10 seconds for SBS to be stopped before continuing the 
firmware download. Always use kill() instead of os.execute() to stop SBS.
 
 We still have to better handle out of memory issues in other cases (as seen on 
Radio too)
 r38...@daddymac-520 (orig r8434):  michael | 2010-02-01 05:30:46 -0500
 Bug: 15522
 Description: use squeezeos.kill() instead of os.execute() to stop Samba.
 r38...@daddymac-520 (orig r8435):  michael | 2010-02-01 05:47:40 -0500
 Bug: n/a
 Description: rename SBSSettings, as the SBS settings should go to a different 
menu.
 
 Step one - rename the folder...
 r38...@daddymac-520 (orig r8436):  michael | 2010-02-01 05:49:49 -0500
 Bug: n/a
 Description: rename SBSSettings, as the SBS settings should go to a different 
menu.
 
 Step one - rename the files
 r38...@daddymac-520 (orig r8437):  michael | 2010-02-01 07:42:05 -0500
 Bug: n/a
 Description: remove debugging statement
 r38...@daddymac-520 (orig r8438):  michael | 2010-02-01 08:19:05 -0500
 Bug: 15522
 Description: return immediately to "Try again" page if error occurs.
 
 Ben - should we have a "restart SB and try again" option in this case? 
Repeated trial won't help if we run out of memory.
 r38...@daddymac-520 (orig r8439):  bklaas | 2010-02-01 09:41:32 -0500
  r38...@daddymac-520 (orig r8423):  ayoung | 2010-01-29 07:33:17 -0500
  Fixed Bug 15444: note when current player disconnects so that reconnection is 
noticed later
 

Added:
    7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupStorage/
      - copied from r8403, 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SBSSettings/
    
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupStorage/SetupStorageApplet.lua
    
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupStorage/SetupStorageMeta.lua
Removed:
    7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SBSSettings/
Modified:
    7.6/trunk/   (props changed)
    
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/busybox/busybox-1.15.2/busybox_udhcpd_syslog.patch
    7.6/trunk/squeezeos/poky/meta-squeezeos/packages/busybox/busybox_1.15.2.bb
    7.6/trunk/squeezeos/poky/meta-squeezeos/packages/samba/files/samba
    
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
    7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua
    7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
    7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.c
    7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c
    7.6/trunk/squeezeplay/src/squeezeplay/src/ui/jive_font.c
    7.6/trunk/squeezeplay/src/squeezeplay/src/ui/jive_surface.c
    
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua
    
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
    
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/UpgradeUBI.lua

Propchange: 7.6/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Mon Feb  1 07:41:56 2010
@@ -12,8 +12,8 @@
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/fab4-autoswitch:5831
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/fab4-skin:4552
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/new-alsa:6567
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8418
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:8419
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8423
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:8439
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:2013
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Modified: 
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/busybox/busybox-1.15.2/busybox_udhcpd_syslog.patch
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeos/poky/meta-squeezeos/packages/busybox/busybox-1.15.2/busybox_udhcpd_syslog.patch?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/busybox/busybox-1.15.2/busybox_udhcpd_syslog.patch
 (original)
+++ 
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/busybox/busybox-1.15.2/busybox_udhcpd_syslog.patch
 Mon Feb  1 07:41:56 2010
@@ -6,7 +6,7 @@
                return 0;
  #endif
 -      return execute("udhcpc " UDHCPC_CMD_OPTIONS " -p 
/var/run/udhcpc.%iface%.pid "
-+      return execute("udhcpc -R -p /var/run/udhcpc.%iface%.pid "
++      return execute("udhcpc -R -a -p /var/run/udhcpc.%iface%.pid "
 +                                      "-b --syslog "
                        "-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s 
%script%]][[ %udhcpc_opts%]]",
                        ifd, exec);

Modified: 
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/busybox/busybox_1.15.2.bb
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeos/poky/meta-squeezeos/packages/busybox/busybox_1.15.2.bb?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 7.6/trunk/squeezeos/poky/meta-squeezeos/packages/busybox/busybox_1.15.2.bb 
(original)
+++ 7.6/trunk/squeezeos/poky/meta-squeezeos/packages/busybox/busybox_1.15.2.bb 
Mon Feb  1 07:41:56 2010
@@ -1,5 +1,5 @@
 require busybox.inc
-PR = "r5"
+PR = "r6"
 
 SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.gz \
           file://busybox_udhcpd_syslog.patch;patch=1 \

Modified: 7.6/trunk/squeezeos/poky/meta-squeezeos/packages/samba/files/samba
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeos/poky/meta-squeezeos/packages/samba/files/samba?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 7.6/trunk/squeezeos/poky/meta-squeezeos/packages/samba/files/samba 
(original)
+++ 7.6/trunk/squeezeos/poky/meta-squeezeos/packages/samba/files/samba Mon Feb  
1 07:41:56 2010
@@ -48,6 +48,17 @@
                valid users = root
        " >> $DESTCONFIG
        done
+
+       ## Add /var/log to the list of the shared folders. This should ebable 
the user to look at the log files.
+       ## The content of the directory will be read-only, for we do not want 
anyone to change the files under log directory.   
+       echo "
+       [logs]
+               comment = logs
+               path = /var/log
+               public = no
+               writable = no
+               valid users = root
+       " >> $DESTCONFIG
 }
 
 

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
 Mon Feb  1 07:41:56 2010
@@ -967,36 +967,48 @@
 end
 
 
-local function _refreshMe()
+local function _refreshMe(setSelectedIndex)
        local step = _getCurrentStep()
        if step then
                local timer = Timer(100,
                        function()
                                _refreshJSONAction(step)
+                               if step.menu and setSelectedIndex then
+                                       
step.menu:setSelectedIndex(setSelectedIndex)
+                                       step.lastBrowseIndexUsed = 
setSelectedIndex
+                               end
                        end, true)
                timer:start()
        end
 
 end
 
-local function _refreshGrandparent()
+local function _refreshGrandparent(setSelectedIndex)
        local step = _getGrandparentStep()
        if step then
                local timer = Timer(100,
                        function()
                                _refreshJSONAction(step)
+                               if step.menu and setSelectedIndex then
+                                       
step.menu:setSelectedIndex(setSelectedIndex)
+                                       step.lastBrowseIndexUsed = 
setSelectedIndex
+                               end
                        end, true)
                timer:start()
        end
 end
 
 
-local function _refreshOrigin()
+local function _refreshOrigin(setSelectedIndex)
        local step = _getParentStep()
        if step then
                local timer = Timer(100,
                        function()
                                _refreshJSONAction(step)
+                               if step.menu and setSelectedIndex then
+                                       
step.menu:setSelectedIndex(setSelectedIndex)
+                                       step.lastBrowseIndexUsed = 
setSelectedIndex
+                               end
                        end, true)
                timer:start()
        end
@@ -1005,7 +1017,7 @@
 
 -- _hideMe
 -- hides the top window and refreshes the parent window, via a new request. 
Optionally, noRefresh can be set to true and the parent window will not be 
refreshed
-local function _hideMe(noRefresh, silent)
+local function _hideMe(noRefresh, silent, setSelectedIndex)
 
        if not silent then
                Framework:playSound("WINDOWHIDE")
@@ -1019,6 +1031,10 @@
                local timer = Timer(1000,
                        function()
                                _refreshJSONAction(currentStep)
+                               if currentStep.menu and setSelectedIndex then
+                                       
currentStep.menu:setSelectedIndex(setSelectedIndex)
+                                       currentStep.lastBrowseIndexUsed = 
setSelectedIndex
+                               end
                        end, true)
                timer:start()
        end
@@ -1026,7 +1042,7 @@
 
 -- _hideToX
 -- hides all windows back to window named X, or top of stack, whichever comes 
first
-local function _hideToX(windowId)
+local function _hideToX(windowId, setSelectedIndex)
        log:debug("_hideToX, x=", windowId)
 
        while _getCurrentStep() and _getCurrentStep().window and 
_getCurrentStep().window:getWindowId() ~= windowId do
@@ -1038,7 +1054,12 @@
                log:info('refreshing window: ', windowId)
                local timer = Timer(1000,
                        function()
-                               _refreshJSONAction(_getCurrentStep())
+                               local currentStep = _getCurrentStep()
+                               _refreshJSONAction(currentStep)
+                               if _getCurrentStep().menu and setSelectedIndex 
then
+                                       
_getCurrentStep().menu:setSelectedIndex(setSelectedIndex)
+                                       _getCurrentStep().lastBrowseIndexUsed = 
setSelectedIndex
+                               end
                        end, true)
                timer:start()
        end
@@ -1048,11 +1069,11 @@
 
 -- _hideMeAndMyDad
 -- hides the top window and the parent below it, refreshing the 'grandparent' 
window via a new request
-local function _hideMeAndMyDad()
+local function _hideMeAndMyDad(setSelectedIndex)
        log:debug("_hideMeAndMyDad")
 
        _hideMe(true)
-       _hideMe()
+       _hideMe(_, _, setSelectedIndex)
 end
 
 -- _goNowPlaying
@@ -1713,6 +1734,11 @@
                --nextWindow on the action
                local aNextWindow
 
+               -- setSelectedIndex will set the selected index of a menu. To 
be used in concert with nextWindow
+               local iSetSelectedIndex
+               local bSetSelectedIndex
+               local aSetSelectedIndex
+
                -- onClick handler, for allowing refreshes of this window when 
using a checkbox/radio/choice item (or 1 above, or 2 steps above)
                local iOnClick
                local bOnClick
@@ -1725,6 +1751,10 @@
                -- dissect base and item for nextWindow params
                bNextWindow = _safeDeref(chunk, 'base', 'nextWindow')
                iNextWindow = item['nextWindow']
+
+               -- same for setSelectedIndex
+               bSetSelectedIndex = _safeDeref(chunk, 'base', 
'setSelectedIndex')
+               iSetSelectedIndex = item['setSelectedIndex']
                
                bOnClick = _safeDeref(chunk, 'base', 'onClick')
                iOnClick = item['onClick']
@@ -1797,9 +1827,18 @@
 
                -- is there a nextWindow on the action
                aNextWindow = _safeDeref(item, 'actions', actionName, 
'nextWindow') or _safeDeref(chunk, 'base', 'actions', actionName, 'nextWindow')
+               aSetSelectedIndex = _safeDeref(item, 'actions', actionName, 
'setSelectedIndex') or _safeDeref(chunk, 'base', 'actions', actionName, 
'setSelectedIndex')
 
                -- actions take precedence over items/base, item takes 
precendence over base
                nextWindow = aNextWindow or iNextWindow or bNextWindow
+
+               setSelectedIndex = aSetSelectedIndex or iSetSelectedIndex or 
bSetSelectedIndex
+               setSelectedIndex = tonumber(setSelectedIndex)
+
+               -- in the presence of a setSelectedIndex directive default to 
nextWindow = 'refresh' if nothing is set
+               if setSelectedIndex and not nextWindow then 
+                       nextWindow = 'refresh'
+               end
 
                -- XXX: After an input box is used, chunk is nil, so base can't 
be used
        
@@ -1901,25 +1940,25 @@
                                        end
                                        
                                elseif nextWindow == 'parentNoRefresh' then
-                                       _hideMe(true)
+                                       _hideMe(true, _, setSelectedIndex)
                                elseif nextWindow == 'parent' then
-                                       _hideMe()
+                                       _hideMe(_, _, setSelectedIndex)
                                elseif nextWindow == 'grandparent' then
                                        local currentStep = _getCurrentStep()
                                        if currentStep and currentStep.window 
and currentStep.window:isContextMenu() then
                                                Window:hideContextMenus()
                                        else
-                                               _hideMeAndMyDad()
+                                               
_hideMeAndMyDad(setSelectedIndex)
                                        end
                                elseif onClick == 'refreshGrandparent' then
-                                       _refreshGrandparent()
+                                       _refreshGrandparent(setSelectedIndex)
                                elseif nextWindow == 'refreshOrigin' or onClick 
== 'refreshOrigin' then
-                                       _refreshOrigin()
+                                       _refreshOrigin(setSelectedIndex)
                                elseif nextWindow == 'refresh' or onClick == 
'refreshMe' then
-                                       _refreshMe()
+                                       _refreshMe(setSelectedIndex)
                                -- if we have a nextWindow but none of those 
reserved words above, hide back to that named window
                                elseif nextWindow then
-                                       _hideToX(nextWindow)
+                                       _hideToX(nextWindow, setSelectedIndex)
                                elseif itemType == "slideshow" or (item and 
item["slideshow"]) then
                                        from, qty = 0, 200
                                        

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua Mon Feb  1 
07:41:56 2010
@@ -7,9 +7,11 @@
 --
 -- (c) Triode, 2009, [email protected]
 --
--- The implementation here contains just the low level state machine for 
processing the rtmp protocol.
--- It relies on the server module to create serialised amf0 objects necessary 
to establish the stream and
--- returns amf0 response packets to the server for decoding.  It makes the 
following assumptions:
+-- The implementation (api v2) here contains both the low level state machine 
for processing the rtmp protocol and
+-- serialisation code for generating amf0 request objects.  Parsing of amf0 
responses is not implemented here and requires
+-- server support.
+--
+-- It makes the following assumptions:
 --
 -- 1) streams use a streamingId of 1 (it ignores the streamingId inside the 
amf0 _result reponse to a createStream message)
 -- 2) only implements single byte chunk headers (chunk id < 63)
@@ -18,7 +20,7 @@
 -- Due to the way the stream object is created it is necessary to switch 
methods in the stream object's meta table
 -- so that the Rtmp read and write methods here are used (this is done in 
Playback.lua)
 
-local string, table, math = string, table, math
+local string, table, math, pairs, type = string, table, math, pairs, type
 
 local Stream   = require("squeezeplay.stream")
 
@@ -28,6 +30,8 @@
 local log      = require("jive.utils.log").logger("audio.decode")
 
 module(...)
+
+local FLASH_VER  = "LNX 10,0,22,87"
 
 
 -- session params (can't be stored in the object as we reuse the streambuf 
object)
@@ -41,7 +45,8 @@
 
 function init(self, slimprotoObj)
        slimproto = slimprotoObj
-       slimproto:capability("Rtmp", 1)
+       -- api version 2 includes abilty to format and serialise amf objects
+       slimproto:capability("Rtmp", 2)
 end
 
 
@@ -60,6 +65,17 @@
 end
 
 
+local function packNumber(v, len, le)
+       local t = {}
+       for i = 1, len do
+               t[#t + 1] = string.char(v & 0xFF)
+               v = v >> 8
+       end
+       local str = table.concat(t)
+       return le and str or string.reverse(str)
+end
+
+
 local function changeState(newstate)
        log:info(state, " -> ", newstate)
        state = newstate
@@ -99,9 +115,19 @@
        ackWindow, nextAck, receivedBytes = 10240, 10240, 0
        state = "reset"
 
-       -- extract the pre built rtmp packets within the header
+       -- extract the pre built rtmp packets or params within the header
        for k, v in string.gmatch(header, "(%w+)=([a-zA-Z0-9%/%+]+%=*)&") do
                rtmpMessages[k] = mime.unb64("", v)
+       end
+
+       -- create serialised amf packets if params rather than prebuild packets 
extracted
+       if rtmpMessages["streamname"] then
+               rtmpMessages["create"]  = createStreamPacket()
+               rtmpMessages["play"]    = 
playPacket(rtmpMessages["streamname"], rtmpMessages["live"], 
rtmpMessages["start"])
+               rtmpMessages["connect"] = connectPacket(rtmpMessages["app"], 
rtmpMessages["swfurl"] or "", rtmpMessages["tcurl"])
+               if rtmpMessages["subname"] then
+                       rtmpMessages["subscribe"] = 
subscribePacket(rtmpMessages["subname"])
+               end
        end
 
        -- create the handshake token
@@ -270,14 +296,17 @@
                           end
 
                           if state ~= "Playing" then
+                                  if state ~= "Buffering" then
+                                          if rtmpMessages["meta"] ~= nil then
+                                                  slimproto:send({ opcode = 
"RESP", headers = "" })
+                                          end
+                                          changeState("Buffering")
+                                  end
                                   -- don't start playing live streams 
immediately as it causes stutter
                                   if rtmpMessages["subscribe"] and 
rtmp["timestamp"] < 4500 then
                                           return 0
                                   else
                                           changeState("Playing")
-                                          if rtmpMessages["meta"] ~= nil then
-                                                  slimproto:send({ opcode = 
"RESP", headers = "" })
-                                          end
                                   end
                           end
 
@@ -596,4 +625,131 @@
 end
 
 
-
+-- amf packet formatting and serialisation code
+-- this is added for api version 2 so we don't rely on server code to generate 
serialsed amf0
+
+-- emulate pack "d" to serialise numbers as doubles
+-- this only implements most signficant 28 bits of the mantissa, rest are 0
+function _todouble(v)
+       local s, e, m
+
+       if v == 0 then
+               return string.char(0, 0, 0, 0, 0, 0, 0, 0)
+       end
+
+       s = v > 0 and 0 or 1
+       v = v > 0 and v or -v
+       e = 0
+
+       local i = v
+       while i >= 2 do
+               i = i / 2
+               e = e + 1
+       end
+
+       m = v / math.pow(2, e - 28)
+       e = e + 1023
+
+       return string.char(
+               (s << 7) | 
+               ((e & 0x7f0) >> 4),
+               ((e & 0x00f) << 4) |
+               ((m & 0x0f000000) >> 24),
+                (m & 0x00ff0000) >> 16,
+                (m & 0x0000ff00) >>  8,
+                (m & 0x000000ff),
+               0, 0, 0)
+end
+
+
+function amfFormatNumber(n)
+       return string.char(0x00) .. _todouble(n)
+end
+
+
+function amfFormatBool(b)
+       return string.char(0x01, b and 0x01 or 0x00)
+end
+
+
+function amfFormatString(s)
+       return string.char(0x02) .. packNumber(string.len(s), 2) .. s
+end
+
+
+function amfFormatNull()
+       return string.char(0x05)
+end
+
+
+function amfFormatObject(o)
+       local res = string.char(0x03)
+       for k, v in pairs(o) do
+               res = res .. packNumber(string.len(k), 2) .. k
+               if type(v) == 'number' then
+                       res = res .. amfFormatNumber(v)
+               elseif type(v) == 'string' then
+                       res = res .. amfFormatString(v)
+               else
+                       res = res .. amfFormatNull()
+               end
+       end
+       return res .. string.char(0x00, 0x00, 0x09)
+end
+
+
+function formatRtmp(chan, type, streamId, body)
+       return
+               string.char(chan & 0x7f) ..        -- chan X, format 0
+               string.char(0x00, 0x00, 0x00) ..   -- timestamp (not 
implemented)
+               packNumber(string.len(body), 3) .. -- length
+               string.char(type & 0xff) ..        -- type
+               packNumber(streamId, 4, true) ..   -- streamId
+               body                               -- body
+end
+
+
+function connectPacket(app, swfurl, tcurl)
+       return formatRtmp(0x03, 20, 0,
+               amfFormatString('connect') ..
+               amfFormatNumber(1) ..
+               amfFormatObject({
+                       app         = app, 
+                       swfUrl      = swfurl,
+                       tcUrl       = tcurl,
+                       audioCodecs = 0x0404,
+                       videoCodecs = 0x0000,
+                       flashVer    = FLASH_VER
+               })
+       )
+end
+
+
+function createStreamPacket()
+       return formatRtmp(0x03, 20, 0,
+               amfFormatString('createStream') ..
+               amfFormatNumber(2) ..
+               amfFormatNull()
+       )
+end
+
+
+function subscribePacket(subscribe)
+       return formatRtmp(0x03, 20, 0,
+               amfFormatString('FCSubscribe') ..
+               amfFormatNumber(0) ..
+               amfFormatNull() ..
+               amfFormatString(subscribe)
+       )
+end
+
+
+function playPacket(streamname, live, start)
+       return formatRtmp(0x08, 20, 1, 
+               amfFormatString('play') ..
+               amfFormatNumber(0) ..
+               amfFormatNull() ..
+               amfFormatString(streamname) ..
+               amfFormatNumber(live and -1000 or (start or 0) * 1000)
+       )
+end

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua Mon Feb  1 
07:41:56 2010
@@ -417,7 +417,7 @@
        end
 
        -- Check have we changed SqueezeCenter
-        if self.serverRefreshInProgress or self.slimServer ~= slimServer then
+       if self.serverRefreshInProgress or self.slimServer ~= slimServer then
                if self.slimServer == slimServer and 
self.serverRefreshInProgress then
                        log:info("Same server but serverRefreshInProgress in 
progress: ", slimServer)
                end
@@ -615,7 +615,7 @@
 
        if self == currentPlayer then
                self.jnt:notify('playerDisconnected', self)
-
+               self.info.connected = false
                -- dont' delete state if this is the current player
                return
        end

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.c
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.c?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.c (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.c Mon Feb  1 
07:41:56 2010
@@ -120,13 +120,14 @@
 
 
 static void decode_resume_audio_handler(void) {
-       int start_interval;
-
-       start_interval = mqueue_read_u32(&decode_mqueue) - jive_jiffies();
+       int start_interval = 0;
+       Uint32 start_jiffies;
+
+       start_jiffies = mqueue_read_u32(&decode_mqueue);
        mqueue_read_complete(&decode_mqueue);
        
-       if (start_interval < 0) {
-               start_interval = 0;
+       if (start_jiffies) {
+               start_interval = start_jiffies - jive_jiffies();
        }
        
        LOG_DEBUG(log_audio_decode, "decode_resume_audio_handler 
start_interval=%d", start_interval);

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c Mon Feb  1 07:41:56 
2010
@@ -83,6 +83,7 @@
        { "co64", &mp4_parse_chunk_large_offset_box, },
        { "mp4a", &mp4_parse_mp4a_box, },
        { "esds", &mp4_parse_esds_box, },
+       { "m4ae", &mp4_parse_mp4a_box, },       // same as mp4a
        { "mdat", &mp4_parse_mdat_box, },
        { "alac", &mp4_parse_alac_box, },
        { NULL, NULL }

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/ui/jive_font.c
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/ui/jive_font.c?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/ui/jive_font.c (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/ui/jive_font.c Mon Feb  1 
07:41:56 2010
@@ -244,6 +244,10 @@
        clr.b = (color >> 8) & 0xFF;
 
        srf = TTF_RenderUTF8_Blended(font->ttf, str, clr);
+
+       if (!srf) {
+               LOG_ERROR(log_ui_draw, "render returned error: %s\n", 
TTF_GetError());
+       }
 
 #if 0
        // draw text bounding box for debugging

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/ui/jive_surface.c
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/ui/jive_surface.c?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/ui/jive_surface.c (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/ui/jive_surface.c Mon Feb  1 
07:41:56 2010
@@ -530,8 +530,10 @@
 void jive_surface_get_size(JiveSurface *srf, Uint16 *w, Uint16 *h) {
        if (!srf->sdl) {
                LOG_ERROR(log_ui, "Underlying sdl surface already freed, 
possibly with release()");
-               *w = 0;
-               *h = 0;
+               if (w)
+                       *w = 0;
+               if (h)
+                       *h = 0;
                return;
        }
        if (w) {

Added: 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupStorage/SetupStorageApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupStorage/SetupStorageApplet.lua?rev=8440&view=auto
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupStorage/SetupStorageApplet.lua
 (added)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupStorage/SetupStorageApplet.lua
 Mon Feb  1 07:41:56 2010
@@ -1,0 +1,428 @@
+
+local ipairs, tostring = ipairs, tostring, tonumber
+
+-- stuff we use
+local oo               = require("loop.simple")
+local os               = require("os")
+local io               = require("io")
+local math             = require("math")
+local string           = require("string")
+local table            = require("jive.utils.table")
+local lfs              = require("lfs")
+
+local Applet           = require("jive.Applet")
+local Framework        = require("jive.ui.Framework")
+local Checkbox         = require("jive.ui.Checkbox")
+local Label            = require("jive.ui.Label")
+local Group            = require("jive.ui.Group")
+local Keyboard         = require("jive.ui.Keyboard")
+local SimpleMenu       = require("jive.ui.SimpleMenu")
+local Surface          = require("jive.ui.Surface")
+local Task             = require("jive.ui.Task")
+local Textarea         = require("jive.ui.Textarea")
+local Textinput        = require("jive.ui.Textinput")
+local Window           = require("jive.ui.Window")
+local squeezeos        = require("squeezeos_bsp")
+
+local debug            = require("jive.utils.debug")
+
+local jnt = jnt
+local appletManager    = appletManager
+
+
+module(..., Framework.constants)
+oo.class(_M, Applet)
+
+
+-- ------------------------------ DEVICES ------------------------------ --
+
+local devicesTests = {
+       "USB_DISK_VOLUMENAME",
+       "USB_DISK_SIZE",
+       "USB_DISK_FREE",
+       "SD_CARD_VOLUMENAME",
+       "SD_CARD_SIZE",
+       "SD_CARD_FREE",
+}
+
+
+function setValue(self, menu, key, value)
+       if not value then
+               value = '-'
+       end
+       menu:setText(self.labels[key], self:string(key, value))
+end
+
+
+function doDevicesValues(self)
+       local usbLabel = tostring( self:string("DEVICES_NONE"))
+       local sdCardLabel = tostring( self:string("DEVICES_NONE"))
+       local blkid = io.popen("/sbin/blkid")
+
+       -- Allow a-z, A-Z, 0-9, '_' , '-' and ' ' in volume lables => [%w_%- ]
+       -- Win2k and OSX 10.6.1 do not allow '.' in volume labels
+       for line in blkid:lines() do
+
+               local label = string.match(line, "/dev/sda1:%s*LABEL=\"([%w_%- 
]*)\"")
+               if label then
+                       usbLabel = tostring(label)
+               else
+                       -- No LABEL but a UUID means it is 'untitled'
+                       local uuid = string.match(line, 
"/dev/sda1:%s*UUID=\"(%S*)\"")
+                       if uuid then
+                               usbLabel = tostring( 
self:string("DEVICES_UNTITLED"))
+                       end
+               end
+
+               label = string.match(line, "/dev/mmcblk0p1:%s*LABEL=\"([%w_%- 
]*)\"")
+               if label then
+                       sdCardLabel = tostring(label)
+               else
+                       -- No LABEL but a UUID means it is 'untitled'
+                       local uuid = string.match(line, 
"/dev/mmcblk0p1:%s*UUID=\"(%S*)\"")
+                       if uuid then
+                               sdCardLabel = tostring( 
self:string("DEVICES_UNTITLED"))
+                       end
+               end
+       end
+       blkid:close()
+       self:setValue(self.devicesMenu, "USB_DISK_VOLUMENAME", usbLabel)
+       self:setValue(self.devicesMenu, "SD_CARD_VOLUMENAME", sdCardLabel)
+
+       local usbSize = "-"
+       local usbFree = "-"
+       local sdCardSize = "-"
+       local sdCardFree = "-"
+       local df = io.popen("/bin/df")
+
+       for line in df:lines() do
+               local size, free = string.match(line, 
"/dev/sda1%s*(%d+)%s*%d+%s*(%d+)")
+               if size and free then
+                       usbSize = tostring(math.floor(size / 1000)) .. " MB"
+                       usbFree = tostring(math.floor(free / 1000)) .. " MB"
+               end
+
+               size, free = string.match(line, 
"/dev/mmcblk0p1%s*(%d+)%s*%d+%s*(%d+)")
+               if size and free then
+                       sdCardSize = tostring(math.floor(size / 1000)) .. " MB"
+                       sdCardFree = tostring(math.floor(free / 1000)) .. " MB"
+               end
+       end
+       df:close()
+       self:setValue(self.devicesMenu, "USB_DISK_SIZE", usbSize)
+       self:setValue(self.devicesMenu, "USB_DISK_FREE", usbFree)
+       self:setValue(self.devicesMenu, "SD_CARD_SIZE", sdCardSize)
+       self:setValue(self.devicesMenu, "SD_CARD_FREE", sdCardFree)
+end
+
+
+function showDevicesMenu(self)
+       local window = Window("text_list", self:string("DEVICES"))
+       window:setAllowScreensaver(false)
+       window:setButtonAction("rbutton", nil)
+
+       local menu = SimpleMenu("menu")
+
+       self.labels = {}
+
+       for i,name in ipairs(devicesTests) do
+               self.labels[name] = {
+                       text = self:string(name, ''),
+                       style = 'item_info',
+               }
+               menu:addItem(self.labels[name])
+       end
+
+       self.devicesMenu = menu
+       doDevicesValues(self)
+       menu:addTimer(5000, function()
+               doDevicesValues(self)
+       end)
+
+       window:addWidget(menu)
+
+       self:tieAndShowWindow(window)
+       return window
+end
+
+-- ------------------------------ SHARING ------------------------------ --
+
+function _enableSharing(self, window)
+       -- enable Samba 
+       log:info("Enabling Samba Access")
+       os.execute("echo enabled > /etc/samba/status");
+       os.execute("/etc/init.d/samba restart");
+end
+
+
+function _disableSharing(self, window)
+       -- disable Samba        
+       log:info("Disabling Samba Access")
+       os.execute("echo disabled > /etc/samba/status");
+       os.execute("/etc/init.d/samba stop");
+end
+
+function stopFileSharing(self)
+       self:_killByPidFile("/var/run/nmbd.pid")
+       self:_killByPidFile("/var/run/smbd.pid")
+end
+
+function _killByPidFile(self, file)
+       local pid = _readPidFile(file)
+
+       if pid then
+               squeezeos.kill(pid, 15)
+       end
+       os.remove(file)
+end
+
+function _readPidFile(file)
+       local fh = io.open(file, "r")
+
+       if fh == nil then
+               return
+       end
+
+       local pid = fh:read("*all")
+       fh:close()
+
+       log:debug("found pid " .. pid .. " reading " .. file)
+       
+       return pid
+end
+
+
+function _fileMatch(file, pattern)
+       local fi = io.open(file, "r")
+
+       for line in fi:lines() do
+               if string.match(line, pattern) then
+                       fi:close()
+                       return true
+               end
+       end
+       fi:close()
+       
+       return false
+end
+
+
+function _updateSharingHelpText(self)
+       self.howto = Textarea("help_text", self:string("SHARING_HOWTO", 
self:getSettings()['sharingAccount'], self:getSettings()['sharingPassword']))
+       self.networkSharingMenu:setHeaderWidget(self.howto)
+end
+
+
+function _setSharingAccount(self)
+       local window = Window("input", self:string("SHARING_ACCOUNT"), 
'setuptitle')
+       window:setAllowScreensaver(false)
+
+       local v = Textinput.textValue(self:getSettings()['sharingAccount'], 1, 
32)
+       local textinput = Textinput("textinput", v,
+                               function(widget, value)
+                                       value = tostring(value)
+
+                                       if #value == 0 then
+                                               return false
+                                       end
+
+                                       -- Remove some special chars samba 
cannot handle
+                                       value = string.gsub(value, '\\', '')
+                                       value = string.gsub(value, '"', '')
+                                       value = string.gsub(value, "'", '')
+
+                                       -- Store for later reference
+                                       self:getSettings()['sharingAccount'] = 
value
+                                       self:storeSettings()
+
+                                       -- Quote to support spaces etc.
+                                       value = '"' .. value .. '"'
+
+                                       -- Set samba user alias for root
+                                       -- Samba daemon doesn't need to be 
restarted
+                                       os.execute("echo 'root = " .. value .. 
"' > /etc/samba/smbusers")
+
+                                       self:_updateSharingHelpText()
+
+                                       -- close the window
+                                       window:playSound("WINDOWHIDE")
+                                       window:hide()
+
+                                       return true
+                               end
+                       )
+
+       local backspace = Keyboard.backspace()
+       local group = Group('keyboard_textinput', { textinput = textinput, 
backspace = backspace } )
+
+        window:addWidget(group)
+       window:addWidget(Keyboard("keyboard", 'qwerty', textinput))
+        window:focusWidget(group)
+
+--     _helpAction(self, window, 'NETWORK_NETWORK_NAME_HELP', 
'NETWORK_NETWORK_NAME_HELP_BODY', menu)
+
+       self:tieAndShowWindow(window)
+end
+
+
+function _setSharingPassword(self)
+
+       local window = Window("input", self:string("SHARING_PASSWORD"), 
'setuptitle')
+       window:setAllowScreensaver(false)
+
+       -- Allow length to be 0 for no password
+       local v = Textinput.textValue(self:getSettings()['sharingPassword'], 0, 
32)
+
+       local textinput = Textinput("textinput", v,
+                               function(widget, value)
+                                       value = tostring(value)
+
+                                       -- Remove some special chars samba 
cannot handle
+                                       value = string.gsub(value, "'", "")
+
+                                       -- Store for later reference
+                                       -- Not sure we want that as it is 
cleartext
+                                       self:getSettings()['sharingPassword'] = 
value
+                                       self:storeSettings()
+
+                                       -- Escape some special chars
+                                       value = string.gsub(value, '\\', '\\\\')
+                                       value = string.gsub(value, '"', '\\"')
+                                       value = string.gsub(value, "`", "\\`")
+
+                                       -- Quote to support spaces etc.
+                                       value = '"' .. value .. '"'
+
+                                       -- Set samba password
+                                       -- Samba daemon doesn't need to be 
restarted
+                                       -- A valid smb.conf file is needed
+                                       os.execute("(echo " .. value .. "; echo 
" .. value .. ") | smbpasswd -s -a -c /etc/samba/smb.conf.dist root")
+
+                                       self:_updateSharingHelpText()
+
+                                       -- close the window
+                                       window:playSound("WINDOWHIDE")
+                                       window:hide()
+
+                                       return true
+                               end
+                       )
+
+       local backspace = Keyboard.backspace()
+       local group = Group('keyboard_textinput', { textinput = textinput, 
backspace = backspace } )
+
+        window:addWidget(group)
+       window:addWidget(Keyboard("keyboard", 'qwerty', textinput))
+        window:focusWidget(group)
+
+--     _helpAction(self, window, 'NETWORK_NETWORK_NAME_HELP', 
'NETWORK_NETWORK_NAME_HELP_BODY', menu)
+
+       self:tieAndShowWindow(window)
+end
+
+
+function showNetworkSharingMenu(self)
+       local window = Window("text_list", self:string("SHARING"))
+       window:setAllowScreensaver(false)
+       window:setButtonAction("rbutton", nil)
+
+       local sharingEnabled = _fileMatch("/etc/samba/status", "enabled")
+
+       local menu = SimpleMenu("menu")
+
+       menu:addItem({
+               text = self:string("SHARING_ENABLE"),
+               style = 'item_choice',
+               check = Checkbox("checkbox",
+                                       function(_, isSelected)
+                                               if isSelected then
+                                                       self:_enableSharing()
+                                               else
+                                                       self:_disableSharing()
+                                               end
+                                       end,
+                                       sharingEnabled
+                               )
+       })
+
+       menu:addItem({
+               text = self:string("SHARING_ACCOUNT"),
+               style = 'item',
+               sound = "WINDOWSHOW",           
+               callback = function ()
+                       self:_setSharingAccount()
+               end
+       })
+
+       menu:addItem({
+               text = self:string("SHARING_PASSWORD"),
+               style = 'item',
+               sound = "WINDOWSHOW",           
+               callback = function ()
+                       self:_setSharingPassword()
+               end
+       })
+
+       self.networkSharingMenu = menu
+
+       self:_updateSharingHelpText()
+
+       window:addWidget(menu)
+
+       self:tieAndShowWindow(window)
+       return window
+end
+
+-- ------------------------------ Main Menu ---------------------------- --
+
+function StorageSettingsMenu(self)
+       local window = Window("text_list", self:string("USB_SD_STORAGE"))
+       window:setAllowScreensaver(false)
+       window:setButtonAction("rbutton", nil)
+
+       local menu = SimpleMenu("menu")
+
+       self.labels = {}
+
+       menu:addItem({
+               text = self:string("DEVICES"),
+               style = 'item',
+               sound = "WINDOWSHOW",           
+               callback = function ()
+                       self:showDevicesMenu()
+               end
+       })
+
+       menu:addItem({
+               text = self:string("SHARING"),
+               style = 'item',
+               sound = "WINDOWSHOW",           
+               callback = function ()
+                       self:showNetworkSharingMenu()
+               end
+       })
+
+       self.sbsSettingsMenu = menu
+--     doValues(self)
+--     menu:addTimer(5000, function()
+--             doValues(self)
+--     end)
+
+       window:addWidget(menu)
+
+       self:tieAndShowWindow(window)
+       return window
+end
+
+
+--[[
+
+=head1 LICENSE
+
+Copyright 2010 Logitech. All Rights Reserved.
+
+This file is licensed under BSD. Please see the LICENSE file for details.
+
+=cut
+--]]
+

Added: 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupStorage/SetupStorageMeta.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupStorage/SetupStorageMeta.lua?rev=8440&view=auto
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupStorage/SetupStorageMeta.lua
 (added)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SetupStorage/SetupStorageMeta.lua
 Mon Feb  1 07:41:56 2010
@@ -1,0 +1,45 @@
+
+local oo            = require("loop.simple")
+
+local AppletMeta    = require("jive.AppletMeta")
+
+local Framework     = require("jive.ui.Framework")
+
+local appletManager = appletManager
+local jiveMain      = jiveMain
+
+
+module(...)
+oo.class(_M, AppletMeta)
+
+
+function jiveVersion(meta)
+       return 1, 1
+end
+
+
+function defaultSettings(meta)
+       return {
+               [ "sharingAccount" ] = "Squeezebox",
+               [ "sharingPassword" ] = "1234",
+       }
+end
+
+
+function registerApplet(meta)
+       jiveMain:addItem(meta:menuItem('storage_settings', 'advancedSettings', 
"USB_SD_STORAGE", function(applet, ...) applet:StorageSettingsMenu() end))
+       meta:registerService("stopFileSharing")
+end
+
+
+--[[
+
+=head1 LICENSE
+
+Copyright 2010 Logitech. All Rights Reserved.
+
+This file is licensed under BSD. Please see the LICENSE file for details.
+
+=cut
+--]]
+

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua
 Mon Feb  1 07:41:56 2010
@@ -265,28 +265,25 @@
                )
        end
 
-       os.execute("/etc/init.d/squeezecenter " .. action);
-
-end
-
-function stopSqueezeCenter(self)
-       -- first try the regular way
-       self:_stopServer(true)
-
-       -- try harder if this didn't work
-       if self:serverRunning() then
-
-               -- stop server
-               self:_killByPidFile("/var/run/squeezecenter.pid")
-               
-               -- stop resize helper daemon
-               self:_killByPidFile("/var/run/gdresized.pid")
-
-               -- stop scanner
---             local pid = _pidfor('scanner.pl')
---             if pid then
---                     squeezeos.kill(pid, 15)
---             end
+       if action == 'stop' then
+               -- don't use shell script, we might be out of memory
+               if self:serverRunning() then
+
+                       -- stop server
+                       self:_killByPidFile("/var/run/squeezecenter.pid")
+                       
+                       -- stop resize helper daemon
+                       self:_killByPidFile("/var/run/gdresized.pid")
+       
+                       -- stop scanner
+       --              local pid = _pidfor('scanner.pl')
+       --              if pid then
+       --                      squeezeos.kill(pid, 15)
+       --              end
+               end
+
+       else
+               os.execute("/etc/init.d/squeezecenter " .. action);
        end
 end
 
@@ -487,10 +484,15 @@
        if self:serverRunning() then
                -- attempt to stop SC
                log:debug('STOP SERVER')
-               self:_squeezecenterAction("icon_connecting", 
"STOPPING_SQUEEZECENTER", nil, 2000, "stop", silent)
-       end
-
-end
+               self:_squeezecenterAction("icon_connecting", 
"STOPPING_SQUEEZECENTER", nil, 3000, "stop", silent)
+       end
+
+end
+
+function stopSqueezeCenter(self)
+       self:_stopServer(true)
+end
+
 
 -- _unmountingDrive
 -- full screen popup that appears until unmounting is complete or failed

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
 Mon Feb  1 07:41:56 2010
@@ -56,6 +56,8 @@
 
 
 local MEDIA_PATH = "/media/"
+local STOP_SERVER_TIMEOUT = 10
+
 
 module(..., Framework.constants)
 oo.class(_M, Applet)
@@ -472,12 +474,6 @@
 function _t_upgrade(self)
        Task:yield(true)
 
-       -- stop memory hungry services before upgrading
-       os.execute("/etc/init.d/squeezecenter stop");
-       os.execute("/etc/init.d/samba stop");
-
-       Task:yield(true)
-
        local upgrade = Upgrade()
        local t, err = upgrade:start(self.url,
                function(...)
@@ -543,11 +539,27 @@
 
        -- stop memory hungry services before upgrading
        if (System:getMachine() == "fab4") then
+
                appletManager:callService("stopSqueezeCenter")
-       end     
-
-       -- start the upgrade
-       Task("upgrade", self, _t_upgrade, _upgradeFailed):addTask()
+               appletManager:callService("stopFileSharing")
+
+               -- start the upgrade once SBS is shut down or timed out
+               local timeout = 0
+               self.serverStopTimer = self.popup:addTimer(1000, function()
+
+                       timeout = timeout + 1
+                       
+                       if timeout <= STOP_SERVER_TIMEOUT and 
appletManager:callService("isBuiltInSCRunning") then
+                               return
+                       end
+
+                       Task("upgrade", self, _t_upgrade, 
_upgradeFailed):addTask()
+                       
+                       self.popup:removeTimer(self.serverStopTimer)
+               end)
+       else
+               Task("upgrade", self, _t_upgrade, _upgradeFailed):addTask()
+       end
 
        self:tieAndShowWindow(self.popup)
        return window

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/UpgradeUBI.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/UpgradeUBI.lua?rev=8440&r1=8439&r2=8440&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/UpgradeUBI.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/UpgradeUBI.lua
 Mon Feb  1 07:41:56 2010
@@ -305,14 +305,16 @@
                        if _action == "store" then
                                if not _fhsink then
                                        log:error("_fhsink not defined")
-                                       return nil, "Something went wrong... 
_fhsink not defined"
+                                       self.sinkErr = "Something went wrong... 
_fhsink not defined"
+                                       return nil
                                end
                        
                                -- write content to fhsink
                                local t, err = _fhsink(chunk)
                                if not t then
                                        log:error("FLASH err=", err)
-                                       return nil, err
+                                       self.sinkErr = "FLASH err=" .. err
+                                       return nil
                                end
 
                        elseif _action == "checksum" then
@@ -343,7 +345,7 @@
                        local filename = chunk.filename
 
                        if string.match(filename, "^zImage") or
-                          string.match(filename, "^Image") then
+                               string.match(filename, "^Image") then
                                if not self:verifyPlatformRevision() then
                                        self.sinkErr = "Incompatible firmware"
                                        return nil
@@ -352,7 +354,8 @@
                                _action = "store"
                                _fhsink, err = self:updatevol("kernel_upg", 
filename, chunk.uncompressed_size)
                                if not _fhsink then
-                                       return nil, err
+                                       self.sinkErr = err
+                                       return nil
                                end
 
                        elseif filename == "root.cramfs" then
@@ -364,7 +367,8 @@
                                _action = "store"
                                _fhsink = self:updatevol("cramfs_upg", 
filename, chunk.uncompressed_size)
                                if not _fhsink then
-                                       return nil, err
+                                       self.sinkErr = err
+                                       return nil
                                end
 
                        elseif filename == "upgrade.md5" then

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to