Author: titmuss
Date: Wed Oct 22 06:36:58 2008
New Revision: 3186

URL: http://svn.slimdevices.com?rev=3186&root=Jive&view=rev
Log:
 [EMAIL PROTECTED] (orig r3176):  titmuss | 2008-10-21 22:39:41 +0100
 Bug: N/A
 Description:
 Implement reconnect bit in slimproto. This needs more testing.
 Fixed a bug in the NetworkThread that prevented the timing out when the 
streaming connection gets disconnected.
 Minor bug fixes in the PlaybackApplet.
 
 
 [EMAIL PROTECTED] (orig r3177):  titmuss | 2008-10-21 22:57:04 +0100
 Bug: N/A
 Description:
 Missing file.
 
 
 [EMAIL PROTECTED] (orig r3178):  bklaas | 2008-10-21 23:01:23 +0100
 Bug: 9680
 Description: typo in ffwd player control, needs to be KEY_FWD not KEY_BACK
 [EMAIL PROTECTED] (orig r3180):  titmuss | 2008-10-22 09:49:52 +0100
 Bug: N/A
 Description:
 Fix initialization order for playback, sometimes a player could be created 
before the uuid and mac address had been set.
 
 
 [EMAIL PROTECTED] (orig r3181):  titmuss | 2008-10-22 10:06:36 +0100
 Bug: N/A
 Description:
 Make sure the player id (mac address) is normalized to lower case.
 
 
 [EMAIL PROTECTED] (orig r3182):  titmuss | 2008-10-22 10:19:03 +0100
 Bug: N/A
 Description:
 Make sure the player id (mac address) is normalzied to lower case.
 
 
 [EMAIL PROTECTED] (orig r3183):  titmuss | 2008-10-22 10:38:02 +0100
 Bug: N/A
 Description:
 Disable screensaver in the debug playback window.
 
 
 [EMAIL PROTECTED] (orig r3184):  titmuss | 2008-10-22 14:30:54 +0100
 Bug: N/A
 Description:
 Added mixer control to select endpoints for jive audio playback (speaker or 
headphone).
 
 
 [EMAIL PROTECTED] (orig r3185):  titmuss | 2008-10-22 14:32:06 +0100
 Bug: N/A
 Description:
 Squeezeplay changes to switch between speaker and headphone output on jive.
 
 

Added:
    7.4/trunk/squeezeplay/src/squeezeplay/share/jive/slim/LocalPlayer.lua
Modified:
    7.4/trunk/   (props changed)
    7.4/trunk/squeezeos/src/s3c2412/linux-2.6.22/sound/soc/s3c24xx/jive_wm8750.c
    
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
    
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Playback/PlaybackApplet.lua
    
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Playback/PlaybackMeta.lua
    7.4/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
    7.4/trunk/squeezeplay/src/squeezeplay/share/jive/net/NetworkThread.lua
    7.4/trunk/squeezeplay/src/squeezeplay/share/jive/net/SlimProto.lua
    7.4/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
    
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
    7.4/trunk/squeezeplay/src/squeezeplay_jive/src/jive_bsp.c

Propchange: 7.4/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Wed Oct 22 06:36:58 2008
@@ -2,7 +2,7 @@
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.1/branches/discovery-refactor:2596
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.1/trunk:2920
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.2/trunk:2921
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.3/trunk:3173
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.3/trunk:3185
 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.4/trunk/squeezeos/src/s3c2412/linux-2.6.22/sound/soc/s3c24xx/jive_wm8750.c
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeos/src/s3c2412/linux-2.6.22/sound/soc/s3c24xx/jive_wm8750.c?rev=3186&root=Jive&r1=3185&r2=3186&view=diff
==============================================================================
--- 
7.4/trunk/squeezeos/src/s3c2412/linux-2.6.22/sound/soc/s3c24xx/jive_wm8750.c 
(original)
+++ 
7.4/trunk/squeezeos/src/s3c2412/linux-2.6.22/sound/soc/s3c24xx/jive_wm8750.c 
Wed Oct 22 06:36:58 2008
@@ -15,7 +15,6 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/timer.h>
-#include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 
@@ -26,11 +25,21 @@
 #include <sound/soc-dapm.h>
 
 #include <asm/mach-types.h>
+#include <asm/arch/regs-gpio.h>
+#include <asm/arch/regs-irq.h>
+
+#include <asm/hardware.h>
 
 #include "s3c24xx-pcm.h"
 #include "s3c2412-i2s.h"
 
 #include "../codecs/wm8750.h"
+
+/* define the scenarios */
+#define JIVE_AUDIO_OFF                  0
+#define JIVE_SPEAKER                    1
+#define JIVE_HEADPHONE                  2
+#define JIVE_SPEAKER_HEADPHONE          3
 
 static const char *audio_map[][2] = {
        [0]     = { "Headphone Jack", "LOUT1" },
@@ -48,16 +57,71 @@
        SND_SOC_DAPM_LINE("Line In", NULL),
 };
 
+static const char *jive_scenarios[] = { "Off", "Speaker", "Headphone", 
"Speaker+Headphone" };
+
+static const struct soc_enum jive_scenarios_enum[] = {
+       SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(jive_scenarios),jive_scenarios),
+};
+
+static int jive_scenario = 1; /* default speaker on */
+
+static int jive_get_scenario(struct snd_kcontrol *kcontrol,
+        struct snd_ctl_elem_value *ucontrol)
+{
+        ucontrol->value.integer.value[0] = jive_scenario;
+        return 0;
+}
+
+static void set_scenario_endpoints(struct snd_soc_codec *codec)
+{
+        switch(jive_scenario) {
+        case JIVE_SPEAKER:
+               snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 0);
+               snd_soc_dapm_set_endpoint(codec, "Internal Speaker", 1);
+               break;
+        case JIVE_HEADPHONE:
+               snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 1);
+               snd_soc_dapm_set_endpoint(codec, "Internal Speaker", 0);
+               break;
+        case JIVE_SPEAKER_HEADPHONE:
+               snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 1);
+               snd_soc_dapm_set_endpoint(codec, "Internal Speaker", 1);
+               break;
+       default:
+               snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 0);
+               snd_soc_dapm_set_endpoint(codec, "Internal Speaker", 0);
+               break;
+       }
+
+       snd_soc_dapm_sync_endpoints(codec);
+}
+
+static int jive_set_scenario(struct snd_kcontrol *kcontrol,
+        struct snd_ctl_elem_value *ucontrol)
+{
+        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+
+        if (jive_scenario == ucontrol->value.integer.value[0])
+                return 0;
+
+        jive_scenario = ucontrol->value.integer.value[0];
+        set_scenario_endpoints(codec);
+        return 1;
+}
+
+
 static int jive_startup(struct snd_pcm_substream *substream)
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_codec *codec = rtd->socdev->codec;
-
-       snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 1);
-       snd_soc_dapm_set_endpoint(codec, "Internal Speaker", 1);
+       int val;
+
+       s3c2410_gpio_cfgpin(S3C2410_GPG14, S3C2410_GPG14_INP);
+       val = (s3c2410_gpio_getpin(S3C2410_GPG14) > 0);
+       s3c2410_gpio_cfgpin(S3C2410_GPG14, S3C2410_GPG14_EINT22);
+
        snd_soc_dapm_set_endpoint(codec, "Line In", 1);
-
-       snd_soc_dapm_sync_endpoints(codec);
+        set_scenario_endpoints(codec);
 
        return 0;
 }
@@ -161,7 +225,8 @@
 };
 
 static const struct snd_kcontrol_new wm8750_jive_controls[] = {
-
+        SOC_ENUM_EXT("Endpoint", jive_scenarios_enum[0],
+                jive_get_scenario, jive_set_scenario),
 };
 
 static int jive_wm8750_init(struct snd_soc_codec *codec)
@@ -197,6 +262,7 @@
        }
 
        snd_soc_dapm_sync_endpoints(codec);
+
        return 0;
 }
 

Modified: 
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua?rev=3186&root=Jive&r1=3185&r2=3186&view=diff
==============================================================================
--- 
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
 (original)
+++ 
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/NowPlaying/NowPlayingApplet.lua
 Wed Oct 22 06:36:58 2008
@@ -548,7 +548,7 @@
                        fwd = Button(
                                Icon('fwd'),
                                function() 
-                                       
window:dispatchNewEvent(EVENT_KEY_PRESS, KEY_REW) 
+                                       
window:dispatchNewEvent(EVENT_KEY_PRESS, KEY_FWD) 
                                        return EVENT_CONSUME 
                                end
                        ),

Modified: 
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Playback/PlaybackApplet.lua
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Playback/PlaybackApplet.lua?rev=3186&root=Jive&r1=3185&r2=3186&view=diff
==============================================================================
--- 
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Playback/PlaybackApplet.lua 
(original)
+++ 
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Playback/PlaybackApplet.lua 
Wed Oct 22 06:36:58 2008
@@ -116,6 +116,7 @@
 
 function _debugMenu(self)
        local window = Window("window", self:string("DEBUG_AUDIO"))
+       window:setAllowScreensaver(false)
 
        local values = {}
        for i=1,6 do
@@ -136,7 +137,7 @@
        window:addTimer(1000, function()
                        local status = Decode:status()
 
-                       values[1]:setValue(decoders[string.char(status.decoder 
or "")] or "?")
+                       values[1]:setValue(decoders[string.char(status.decoder 
or 0)] or "?")
                        values[2]:setValue(string.format('%0.1f%%', 
status.decodeFull / status.decodeSize * 100))
                        values[3]:setValue(string.format('%0.1f%%', 
status.outputFull / status.outputSize * 100))
                        values[4]:setValue(status.elapsed)

Modified: 
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Playback/PlaybackMeta.lua
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Playback/PlaybackMeta.lua?rev=3186&root=Jive&r1=3185&r2=3186&view=diff
==============================================================================
--- 
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Playback/PlaybackMeta.lua 
(original)
+++ 
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/Playback/PlaybackMeta.lua 
Wed Oct 22 06:36:58 2008
@@ -1,5 +1,5 @@
 
-local getmetatable = getmetatable
+local assert, getmetatable = assert, getmetatable
 
 local oo            = require("loop.simple")
 
@@ -41,25 +41,25 @@
        -- this allows us to share state with the applet
        meta.state = {}
 
-       local settings = meta:getSettings()
-
-       if settings.enableAudio & 1 == 1 then
-               -- Create player instance
-               local uuid, mac = jnt:getUUID()
-               meta.state.player = LocalPlayer(jnt, mac, uuid)
-       end
-
        jiveMain:addItem(meta:menuItem('audioPlayback', 'advancedSettings', 
"AUDIO_PLAYBACK", function(applet, ...) applet:settingsShow(meta.state) end, 1))
 end
 
 
 function configureApplet(meta)
-       if not meta.state.player then
+       local settings = meta:getSettings()
+
+       if settings.enableAudio & 1 == 0 then
                -- no audio playback
                return
        end
 
-       local settings = meta:getSettings()
+
+       -- Create player instance
+       local uuid, id = jnt:getUUID()
+       assert(uuid)
+       assert(id)
+
+       meta.state.player = LocalPlayer(jnt, id, uuid)
 
        -- Connect player
        local server = nil
@@ -68,7 +68,10 @@
                server:updateInit(settings.serverInit)
        end
 
-       meta.state.player:updateInit(server, settings.playerInit)
+       -- Init player
+       if settings.playerInit then
+               meta.state.player:updateInit(server, settings.playerInit)
+       end
 
        -- Subscribe to changes in player status
        jnt:subscribe(meta)

Modified: 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua?rev=3186&root=Jive&r1=3185&r2=3186&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua 
(original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua Wed Oct 
22 06:36:58 2008
@@ -35,6 +35,9 @@
 local TCP_CLOSE_LOCAL_TIMEOUT = 4
 
 
+local STREAM_READ_TIMEOUT = 30
+local STREAM_WRITE_TIMEOUT = 5
+
 
 function __init(self, jnt, slimproto)
        assert(slimproto)
@@ -50,6 +53,8 @@
                status.opcode = "STAT"
                status.event = event
                status.serverTimestamp = serverTimestamp
+               status.isStreaming = (obj.stream ~= nil)
+               status.isLooping = obj.isLooping
                
                return status
        end)
@@ -105,7 +110,7 @@
 
        -- enable stream reads when decode buffer is not full
        if status.decodeFull < status.decodeSize and self.stream then
-               self.jnt:t_addRead(self.stream, self.rtask, 0) -- XXXX timeout?
+               self.jnt:t_addRead(self.stream, self.rtask, STREAM_READ_TIMEOUT)
        end
 
        if status.decodeState & DECODE_UNDERRUN ~= 0 or
@@ -229,10 +234,10 @@
        log:info("connect streambuf")
 
        local wtask = Task("streambufW", self, _streamWrite)
-       self.jnt:t_addWrite(self.stream, wtask, 5)
+       self.jnt:t_addWrite(self.stream, wtask, STREAM_WRITE_TIMEOUT)
        
        self.rtask = Task("streambufR", self, _streamRead)
-       self.jnt:t_addRead(self.stream, self.rtask, 0) -- XXXX timeout?
+       self.jnt:t_addRead(self.stream, self.rtask, STREAM_READ_TIMEOUT)
 
        self.slimproto:sendStatus('STMc')
 end
@@ -349,6 +354,7 @@
                self.sentDecoderUnderrunEvent = false
                self.sentOutputUnderrunEvent = false
                self.sentAudioUnderrunEvent = false
+               self.isLooping = false
 
                -- connect to server
                self:_streamConnect(serverIp, data.serverPort)
@@ -402,10 +408,10 @@
 
 
 function _cont(self, data)
-       log:info("cont loop=", data.loop)
+       log:debug("cont loop=", data.loop)
 
        if data.loop == 1 then
-               log:warn("LOOP")
+               self.isLooping = true
                self.stream:markLoop()
        end
 

Modified: 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/net/NetworkThread.lua
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/jive/net/NetworkThread.lua?rev=3186&root=Jive&r1=3185&r2=3186&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/net/NetworkThread.lua 
(original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/net/NetworkThread.lua Wed 
Oct 22 06:36:58 2008
@@ -45,6 +45,7 @@
 local DNS               = require("jive.net.DNS")
 local Process           = require("jive.net.Process")
 
+local debug             = require("jive.utils.debug")
 local log               = require("jive.utils.log").logger("net.thread")
 
 local perfhook          = jive.perfhook
@@ -64,21 +65,22 @@
        if not sock then 
                return
        end
-       
+
        if not sockList[sock] then
                -- add us if we're not already in there
                table.insert(sockList, sock)
+
+               sockList[sock] = {
+                       lastSeen = Framework:getTicks()
+               }
        else
                -- else remove previous task
                sockList[sock].task:removeTask()
        end     
-       
+
        -- remember the pump, the time and the desired timeout
-       sockList[sock] = {
-               task = task,
-               lastSeen = Framework:getTicks(),
-               timeout = (timeout or 60) * 1000
-       }
+       sockList[sock].task = task
+       sockList[sock].timeout = (timeout or 60) * 1000
 end
 
 

Modified: 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/net/SlimProto.lua
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/jive/net/SlimProto.lua?rev=3186&root=Jive&r1=3185&r2=3186&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/net/SlimProto.lua 
(original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/net/SlimProto.lua Wed Oct 
22 06:36:58 2008
@@ -77,6 +77,7 @@
 
 local DEVICEID = 7 -- XXXX using recevier device id
 
+local READ_TIMEOUT = 35
 local WRITE_TIMEOUT = 10
 
 -- connection state
@@ -136,12 +137,18 @@
                        uuidp[#uuidp + 1] = string.char(tonumber(v, 16))
                end
 
+               local wlanList = 0
+               if data.reconnect then
+                       -- reconnection bit
+                       wlanList = wlanList | 0x4000
+               end
+
                return {
                        packNumber(data.deviceID or DEVICEID, 1),
                        packNumber(data.revision, 1),
                        table.concat(macp),
                        table.concat(uuidp),
-                       packNumber(0, 2), -- XXXX reconnection bit
+                       packNumber(wlanList, 2),
                        packNumber(0, 8), -- XXXX bytes received
                        "EN", -- XXXX language
                }
@@ -346,8 +353,6 @@
 
 -- Open the slimproto connection to SqueezeCenter.
 function connect(self, serverip)
-       assert(serverip)
-
        local pump = function(NetworkThreadErr)
                if NetworkThreadErr then
                        return _handleDisconnect(self, NetworkThreadErr)
@@ -402,14 +407,31 @@
                if not statusSent then
                        self:sendStatus(opcode)
                end
-       end
-
-       self.serverip = serverip
-       self.socket = SocketTcp(self.jnt, serverip, PORT, "SlimProto")
+
+               -- any future connections to this server are reconnects
+               self.reconnect = true
+       end
+
+       if serverip then
+               self.serverip = serverip
+               self.reconnect = false
+       end
+
+       self.socket = SocketTcp(self.jnt, self.serverip, PORT, "SlimProto")
 
        -- connect
        self.socket:t_connect()
-       self.socket:t_addRead(pump, 0) -- no timeout
+
+       -- SC and SN ping the player every 5 and 30 seconds respectively.
+       -- This timeout could be made shorter in the SC case.
+       self.socket:t_addRead(pump, READ_TIMEOUT)
+
+       -- the reconnect bit means that we have a running data connection
+       -- for this server or we're looping
+       local status = self.statusCallback(self, event, serverTimestamp)
+       self.heloPacket.reconnect =
+               self.reconnect and
+               (status.isStreaming or status.isLooping)
 
        self.state = CONNECTED
 
@@ -428,7 +450,6 @@
        self.socket:close()
 
        self.socket = nil
-       self.serverip = nil
 end
 
 

Added: 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/slim/LocalPlayer.lua
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/jive/slim/LocalPlayer.lua?rev=3186&root=Jive&view=auto
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/slim/LocalPlayer.lua 
(added)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/slim/LocalPlayer.lua Wed 
Oct 22 06:36:58 2008
@@ -1,0 +1,128 @@
+--[[
+
+Player instance for local playback.
+
+--]]
+
+local assert = assert
+
+local oo             = require("loop.simple")
+
+local Player         = require("jive.slim.Player")
+
+local SlimProto      = require("jive.net.SlimProto")
+local Playback       = require("jive.audio.Playback")
+
+local debug          = require("jive.utils.debug")
+local log            = require("jive.utils.log").logger("player")
+
+
+-- can be overridden by hardware specific classes
+local DEVICE_MODEL   = "SqueezePlay"
+
+
+module(...)
+oo.class(_M, Player)
+
+
+local device2id = {
+       ["Controller"] = 9,
+       ["SqueezePlay"] = 12,
+}
+
+function __init(self, jnt, playerId, uuid)
+       local obj = oo.rawnew(self, Player(jnt, playerId))
+
+       local deviceid = device2id[DEVICE_MODEL]
+       assert(deviceid)
+
+       obj.slimproto = SlimProto(jnt, {
+               opcode = "HELO",
+               deviceID = deviceid,
+               revision = 0,
+               mac = obj.id,
+               uuid = uuid,
+       })
+       obj.playback = Playback(jnt, obj.slimproto)
+
+       -- initialize with default values
+       obj:updateInit(nil, {
+               name = DEVICE_MODEL,
+               model = DEVICE_MODEL,
+       })
+
+       return obj
+end
+
+
+function free(self, server)
+       -- close any previous connection
+       if self.slimproto then
+               self.slimproto:disconnect()
+               self.slimproto = nil
+       end
+
+       if self.playback then
+               self.playback:free()
+               self.playback = nil
+       end
+
+       Player.free(self, server)
+
+end
+
+
+function updateInit(self, server, init)
+       Player.updateInit(self, squeezeCenter, init)
+
+       if server then
+               self:connectToServer(server)
+       end
+end
+
+
+function needsNetworkConfig(self)
+       return false
+end
+
+
+function needsMusicSource(self)
+       return not self.slimproto:isConnected()
+end
+
+
+function canConnectToServer(self)
+       return true
+end
+
+
+function connectToServer(self, server)
+       -- close any previous connection
+       self.slimproto:disconnect()
+
+       -- make sure the server we are connecting to is awake
+       server:wakeOnLan()
+
+       if server then
+               local serverip = server:getIpPort()
+               self.slimproto:connect(serverip)
+       end
+end
+
+
+function __tostring(self)
+       return "LocalPlayer {" .. self:getName() .. "}"
+end
+
+
+
+--[[
+
+=head1 LICENSE
+
+Copyright 2007 Logitech. All Rights Reserved.
+
+This file is subject to the Logitech Public Source License Version 1.0. Please 
see the LICENCE file for details.
+
+=cut
+--]]

Modified: 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua?rev=3186&root=Jive&r1=3185&r2=3186&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua (original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay/share/jive/slim/Player.lua Wed Oct 22 
06:36:58 2008
@@ -202,6 +202,7 @@
        -- Only create one player object per id. This avoids duplicates
        -- when moving between servers
 
+       playerId = string.lower(playerId)
        if playerIds[playerId] then
                return playerIds[playerId]
        end

Modified: 
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua?rev=3186&root=Jive&r1=3185&r2=3186&view=diff
==============================================================================
--- 
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
 (original)
+++ 
7.4/trunk/squeezeplay/src/squeezeplay_jive/share/applets/SqueezeboxJive/SqueezeboxJiveApplet.lua
 Wed Oct 22 06:36:58 2008
@@ -175,11 +175,9 @@
 
                                      elseif sw == SW_PHONE_DETECT then
                                              if val == 1 then
-                                                     jiveBSP.mixer(0, 97, 97)
-                                                     jiveBSP.mixer(5, 0, 0)
+                                                     os.execute("amixer -q 
sset Endpoint Headphone")
                                              else
-                                                     jiveBSP.mixer(0, 0, 0)
-                                                     jiveBSP.mixer(5, 97, 97)
+                                                     os.execute("amixer -q 
sset Endpoint Speaker")
                                              end
                                      end
 
@@ -245,11 +243,9 @@
        -- headphone or speaker
        local headphone = jiveBSP.ioctl(18)
        if headphone == 1 then
-               jiveBSP.mixer(0, 97, 97)
-               jiveBSP.mixer(5, 0, 0)
+               os.execute("amixer -q sset Endpoint Headphone")
        else
-               jiveBSP.mixer(0, 0, 0)
-               jiveBSP.mixer(5, 97, 97)
+               os.execute("amixer -q sset Endpoint Speaker")
        end
 
        -- set initial state

Modified: 7.4/trunk/squeezeplay/src/squeezeplay_jive/src/jive_bsp.c
URL: 
http://svn.slimdevices.com/7.4/trunk/squeezeplay/src/squeezeplay_jive/src/jive_bsp.c?rev=3186&root=Jive&r1=3185&r2=3186&view=diff
==============================================================================
--- 7.4/trunk/squeezeplay/src/squeezeplay_jive/src/jive_bsp.c (original)
+++ 7.4/trunk/squeezeplay/src/squeezeplay_jive/src/jive_bsp.c Wed Oct 22 
06:36:58 2008
@@ -18,11 +18,9 @@
 
 
 static const char *bsp_devname = "/dev/misc/jive_mgmt";
-static const char *mixer_devname = "/dev/mixer";
 
 
 static int bsp_fd = -1;
-static int mixer_fd = -1;
 static int switch_event_fd = -1;
 static int wheel_event_fd = -1;
 static int motion_event_fd = -1;
@@ -53,35 +51,6 @@
 
        lua_pushinteger(L, v);
        return 1;
-}
-
-
-static int l_jivebsp_mixer(lua_State *L) {
-       unsigned int channel, l, r, volume;
-
-       if (mixer_fd == -1) {
-               // silently fail
-               return 0;
-       }
-
-       channel = luaL_checkinteger(L, 1); // mixer
-       l = luaL_checkinteger(L, 2); // left
-       r = luaL_checkinteger(L, 3); // right
-
-       if (l > 100) {
-               l = 100;
-       }
-       if (r > 100) {
-               r = 100;
-       }
-
-       volume = l | (r << 8);
-       if (ioctl(mixer_fd, MIXER_WRITE(channel), &volume) == -1) {
-               lua_pushstring(L, "Mixer ioctl failed");
-               lua_error(L);
-       }
-
-       return 0;
 }
 
 
@@ -306,7 +275,6 @@
 
 static const struct luaL_Reg jivebsplib[] = {
        { "ioctl", l_jivebsp_ioctl },
-       { "mixer", l_jivebsp_mixer },
        { NULL, NULL }
 };
 
@@ -316,11 +284,6 @@
                perror("jivebsp:");
        }
 
-       mixer_fd = open(mixer_devname, O_RDWR);
-       if (mixer_fd == -1) {
-               perror("jivebsp mixer:");
-       }
-
        open_input_devices();
 
        jive_sdlevent_pump = event_pump;

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

Reply via email to