Index: squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
===================================================================
--- squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua	(revision 9221)
+++ squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua	(working copy)
@@ -864,12 +864,12 @@
 	if System:getMachine()=='baby' then
 		-- check if headphones are plugged in 
 		-- (code taken from TestAudioRoutingApplet who can show the Headphones status in the factory test)
-		local fh = _assert(io.popen("amixer cget name=\"Headphone Switch\"  | grep : | sed 's/^.*=\\([^,]*\\).*$/\\1/'"))
-		local state = fh:read("*a")
+		local fh = _assert(io.popen("amixer cget name=\"Headphone Switch\""))
+		local _,_,state = fh:read("*a"):find(": values=(%d+)")
 		fh:close()
 		
 		-- revert to headphones if needed
-		if state and state:sub(1,1) == "1" then
+		if state == "1" then
 			os.execute("amixer -q sset Endpoint Headphone")
 		end 
 	end