<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>/dev/full</title>
	<atom:link href="http://devfull.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://devfull.wordpress.com</link>
	<description>write error: No space left on device</description>
	<lastBuildDate>Sat, 05 Dec 2009 08:25:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='devfull.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>/dev/full</title>
		<link>http://devfull.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://devfull.wordpress.com/osd.xml" title="/dev/full" />
	<atom:link rel='hub' href='http://devfull.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Sound in two X Sessions with Pulseaudio</title>
		<link>http://devfull.wordpress.com/2009/07/27/sound-in-two-x-sessions-with-pulseaudio/</link>
		<comments>http://devfull.wordpress.com/2009/07/27/sound-in-two-x-sessions-with-pulseaudio/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 18:10:23 +0000</pubDate>
		<dc:creator>turyn</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://devfull.wordpress.com/?p=7</guid>
		<description><![CDATA[Frequently, I find myself starting more than one X session for a variety of reasons. Maybe I want to run a full screen game that won&#8217;t minimize and still be able to use my desktop, or maybe I have a Wine program that crashes on minimizing. I usually create scripts to launch the second X [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devfull.wordpress.com&amp;blog=8719983&amp;post=7&amp;subd=devfull&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Frequently, I find myself starting more than one X session for a variety of reasons. Maybe I want to run a full screen game that won&#8217;t minimize and still be able to use my desktop, or maybe I have a Wine program that crashes on minimizing. I usually create scripts to launch the second X Session and just plug them into my Gnome menu. But after updating to Ubuntu Jaunty (and then to Mint 7), I noticed that my method didn&#8217;t work anymore, at least when it came to sound. Sound would only work for the currently active session, which meant I couldn&#8217;t play music on my desktop and hear it while playing a game in the second session. But just real quick for the uninitiated, here&#8217;s how I am starting my second X sessions.</p>
<p>1. In /etc/X11/XWrapper.config:</p>
<p>Add or change the allowed_users option to be &#8220;allowed_users=anybody&#8221;</p>
<p>2. Use a shell script like the following. This one is specifically for launching a game called Enemy Territory: Quake Wars. The good thing about this script is that it preserves command line arguments, so it can be a drop-in replacement for the original executable by placing it in a directory whose path comes before the directory that contains the executable (most likely ~/bin will be an excellent choice).</p>
<p><pre class="brush: bash;">

#!/bin/sh -u

#path to enemy-territory install
ET_PATH=&quot;/usr/local/games/etqw&quot;

#give the authorization to launch a window from the current X server (:0)
# to future new X server (:1)
MIT=`xauth list | grep  'unix:0' | head -n 1 | grep -o 'MIT-MAGIC-COOKIE.*'`
xauth add :1 $MIT

#Various shell variables for ETQW

SDL_VIDEO_X11_DGAMOUSE=0
SDL_MOUSE_RELATIVE=0
SDL_AUDIODRIVER=&quot;pulse&quot;

cd &quot;$ET_PATH&quot;
#launch et in :1
xinit &quot;$ET_PATH/etqw&quot; &quot;$@&quot; -- :1 -br &amp;

</pre></p>
<p>3. Add your user to the group audio.</p>
<pre>sudo usermod -aG audio &lt;username&gt;</pre>
<p>This allows extra X sessions created by &lt;username&gt; to output audio in the first place.</p>
<p>And it&#8217;s that simple. That script could use some improvements, of course, (like launching in a third X session if the second is currently in use) but I am a lazy person. Now back to my problem: getting sound to work in two X sessions at once. I could not for the life of me figure out what had changed between my Ubuntu Intrepid and Jaunty/Mint7. An hour of Google searches turned up nothing, mainly just developers on bug reports and other people stating that sound playing in more than one X session at a time is blocked on purpose for a reason, which was usually for fast user switching to not play sounds from both users at once. But they failed to mention any way to override that behavior if a user wants to. I don&#8217;t use that feature rarely, if at all even, and I found it more important to be able to play music and also play a game at the same time.</p>
<p>But I was in luck. After even more Google searching, I discovered a mailing list where a solution was proposed. Apparently, policy kit will (indirectly) disable an inactive X session&#8217;s access to the audio hardware by default now.</p>
<p>A simple command will fix this by allowing inactive X sessions access to the sound device:</p>
<pre>sudo polkit-action --set-defaults-inactive org.freedesktop.hal.device-access.sound yes</pre>
<p>And if we ever want to reset to the default (e.g. disallowing inactive access), we can do this:</p>
<pre>sudo polkit-action --reset-defaults org.freedesktop.hal.device-access.sound</pre>
<p>Just remember this may break the standard user switching capabilities, though.</p>
<p>EDIT: Ubuntu 9.10 Karmic Koala apparently switched to a different version of policykit, which does not support the above commands. After grumbling about how the devs decided to switch to a new implementation that does not support the previous implementation&#8217;s features, I discovered a hackish way to accomplish the same thing. The problem arises from that fact that the new PolicyKit does not manage the sound card&#8217;s access anymore, and delegates that task to udev. Unfortunately, I could not figure out how to modify udev&#8217;s access control list (not even sure if it&#8217;s possible or not). So instead I disabled the sound card being controlled by an ACL and just used basic udev permissions. Here&#8217;s how to do it:</p>
<p>In the file /lib/udev/rules.d/70-acl.rules, disable this line by commenting it out (just add a # character to the very front to it):</p>
<pre>SUBSYSTEM=="sound", ENV{ACL_MANAGE}="1"</pre>
<p>Now, access to the sound card is limited to only users that are part of the audio group (which is the default setting without that above line enabled). So we need to do one more thing: add the user that the login screen runs under to the audio group, so you can hear that Ubuntu drum sound on the login screen. =] )</p>
<pre>sudo usermod -aG audio gdm
</pre>
<p>Remember that you must be root to edit that rules file. (Use &#8220;gksu gedit &lt;filename&gt;&#8221; in a terminal.) After editing the file and fixing the gdm user&#8217;s access to the sound card, reboot. That should do it!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devfull.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devfull.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devfull.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devfull.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/devfull.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/devfull.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/devfull.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/devfull.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devfull.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devfull.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devfull.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devfull.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devfull.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devfull.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devfull.wordpress.com&amp;blog=8719983&amp;post=7&amp;subd=devfull&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://devfull.wordpress.com/2009/07/27/sound-in-two-x-sessions-with-pulseaudio/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/76d64db32333523092e1f6e29a3b4079?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">turyn</media:title>
		</media:content>
	</item>
	</channel>
</rss>
