<?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/"
	>

<channel>
	<title>Abort, Retry, Hack? &#187; marcan</title>
	<atom:link href="http://marcansoft.com/blog/author/marcan/feed/" rel="self" type="application/rss+xml" />
	<link>http://marcansoft.com/blog</link>
	<description>[ marcan&#039;s blog ]</description>
	<lastBuildDate>Tue, 22 Dec 2009 16:26:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Making Firefox play nicely with Laptop Mode</title>
		<link>http://marcansoft.com/blog/2009/12/making-firefox-play-nicely-with-laptop-mode/</link>
		<comments>http://marcansoft.com/blog/2009/12/making-firefox-play-nicely-with-laptop-mode/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 04:58:08 +0000</pubDate>
		<dc:creator>marcan</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://marcansoft.com/blog/?p=202</guid>
		<description><![CDATA[Linux has a tweakable knob called laptop_mode which is meant as an energy saving tool for laptop users on battery: it basically says &#8220;try not to touch the disk for X minutes at a time, unless you really need to, and once you do, do everything that you&#8217;ve been piling up all at once&#8221;. It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Linux has a tweakable knob called <a href="http://samwel.tk/laptop_mode/">laptop_mode</a> which is meant as an energy saving tool for laptop users on battery: it basically says &#8220;try not to touch the disk for X minutes at a time, unless you really need to, and once you do, do everything that you&#8217;ve been piling up all at once&#8221;. It&#8217;s great for laptop users, and doubly so for things like my <a href="http://marcansoft.com/transf/eee_vs_aspire.jpg">huge</a> laptop with two 7200RPM HDDs. Seriously.</p>
<p>Now, there are two things that mean you &#8220;really need to&#8221; hit the disc: reading data that isn&#8217;t already cached (duh), and the fsync() and fdatasync() calls. The latter are requests by an application to ensure that all of the data written to far has hit the disc, and they cause the disk to spin up in laptop mode.</p>
<p>Unfortunately, Firefox has a habit of randomly issuing fdatasync() calls. It does this as part of the SQLite backend for its various databases (especially places.sqlite), in order to avoid data corruption. Now, data corruption isn&#8217;t terribly likely on a laptop with a battery (which is essentially a built-in UPS), so this is a terrible annoyance with little benefit anyway. There has been <a href="https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/221009">talk</a> about this problem, but apparently it&#8217;s still around (and the toolkit.storage.synchronous about:config property didn&#8217;t work for me). Most of the reports appear to claim that this happens while browsing, but I&#8217;ve seen it happen periodically even when Firefox is left idle. Maybe it&#8217;s caused by some extension or AJAX webapp? Who knows.</p>
<p><span id="more-202"></span><br />
Ideally this problem would be <a href="http://thunk.org/tytso/blog/2009/03/15/dont-fear-the-fsync/">fixed in laptop_mode itself</a>, but that doesn&#8217;t appear to be the case and I&#8217;m not going to poke this part of my kernel just yet, so here&#8217;s a simpler userspace solution: we can preload a library into Firefox that intercepts fsync() and fdatasync() and ignores them. Even better, we can make it do that only if we&#8217;re in laptop_mode. All it takes is a little C code:</p>
<pre>#define _GNU_SOURCE
#include &lt;unistd.h&gt;
#include &lt;dlfcn.h&gt;
#include &lt;sys/stat.h&gt;
#include &lt;fcntl.h&gt;

static int in_laptop_mode(void)
{
	char buf[2];
	int fd;
	int l;
	fd = open("/proc/sys/vm/laptop_mode", O_RDONLY);
	if (fd &lt; 0)
		return 0;
	l = read(fd, buf, 2);
	close(fd);
	if (l == 2 &#038;&#038; buf[0] == '0' &#038;&#038; buf[1] == '\n')
		return 0;
	else
		return 1;
}

int fsync(int fd)
{
	static int (*_fsync)(int);
	if (!_fsync)
		_fsync = dlsym(RTLD_NEXT, "fsync");
	if (!in_laptop_mode())
		return _fsync(fd);
	else
		return 0;
}

int fdatasync(int fd)
{
	static int (*_fdatasync)(int);
	if (!_fdatasync)
		_fdatasync = dlsym(RTLD_NEXT, "fdatasync");
	if (!in_laptop_mode())
		return _fdatasync(fd);
	else
		return 0;
}
</pre>
<p>To compile and use it:</p>
<pre>$ gcc -O2 -Wall -shared -fPIC -o killsync.so killsync.c -ldl
$ LD_PRELOAD=`pwd`/killsync.so firefox</pre>
<p>Et voilà, firefox no longer wakes up the hard drive(s). You can confirm that the fsync/fdatasync calls no longer make it to the kernel by running <code>strace -f -p `pidof firefox`</code>, but only in laptop_mode.</p>
<p>I&#8217;ve been typing this blog post with this hack applied and so far HDD spinups have been few, far in between, and fairly short. I still have a few offenders to nail (mostly KDE related), but Firefox was one of the worst ones and it&#8217;s now history. <a href="www.lesswatts.org/projects/powertop">PowerTOP</a> says I&#8217;m saving 3-4W of power. Huzzah! Now I just need to get a kernel with timer stats built so I can fix my insane wakeups-from-idle per second&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://marcansoft.com/blog/2009/12/making-firefox-play-nicely-with-laptop-mode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iPhone syncing on Linux, part 2</title>
		<link>http://marcansoft.com/blog/2009/10/iphone-syncing-on-linux-part-2/</link>
		<comments>http://marcansoft.com/blog/2009/10/iphone-syncing-on-linux-part-2/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 06:16:07 +0000</pubDate>
		<dc:creator>marcan</dc:creator>
				<category><![CDATA[iPhone on Linux]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[herebedragons]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://marcansoft.com/blog/?p=145</guid>
		<description><![CDATA[Last post was more along the lines of an announcement, so here&#8217;s a more concrete guide. There have been new releases of most parts of the software stack in the past few days, so now is the time to grab them if you&#8217;re interested. Libgpod is the exception, since it&#8217;s still being worked on to [...]]]></description>
			<content:encoded><![CDATA[<p>Last post was more along the lines of an announcement, so here&#8217;s a more concrete guide. There have been new releases of most parts of the software stack in the past few days, so now is the time to grab them if you&#8217;re interested. Libgpod is the exception, since it&#8217;s still being worked on to get proper support for the iPhone OS 3.x database. That said, if you&#8217;re interested in being an early adopter of iPhone sync support and helping us test it, here&#8217;s how.<br />
<span id="more-145"></span><br />
<b>If you are a new or inexperienced user, or you are not used to compiling things from source, editing configuration files, and doing some basic troubleshooting, stop here</b>. This isn&#8217;t ready for you. In the not too distant future, distros will package this, it will be delivered with your usual dose of healthy and working open source software, and it will all work automagically as soon as you plug in your device.</p>
<p>A few notes:</p>
<ul>
<li>Keep in mind that if you&#8217;re using distro packages for anything I&#8217;m going to mention here, you&#8217;ll need the development headers too (<code>-dev</code> package or similar).</li>
<li>When linking to packages below, I&#8217;ll link the name to the homepage and the version to a download link or something close to it: if you&#8217;re reading this post soon after it was posted, then the versions should be up to date. If it&#8217;s been more than a few days, you should check for newer versions.
<li>You&#8217;ll also need <a href="http://cmake.org/">cmake</a> to build some things (2.6 or newer); your distro should provide a package for it.</li>
<li>Most packages will install to <code>/usr/local</code> by default. This should be fine, but you may have to uninstall any older distro packages that live at <code>/usr</code>, and apps may or may not pick up libraries on <code>/usr/local</code>. If you want, you can change the prefix to /usr. You should already know how to do this for autotools-based packages. For CMake-based ones, pass something like <code>-DCMAKE_INSTALL_PREFIX=/usr</code> when calling cmake.</li>
<li>The libiphone/ifuse page has links to distro repositories with packaged versions of everything <a href="http://matt.colyer.name/projects/iphone-linux/index.php?title=Main_Page#Ubuntu_Intrepid.2FJaunty">here</a>. Yay, you&#8217;ve just saved a bunch of time! Do follow the steps below, but you can use these packages instead of building from source.</li>
</ul>
<p><b>Possible pitfalls</b>:</p>
<ul>
<li>If you&#8217;ve had prior versions of usbmuxd/libiphone/etc, make sure they&#8217;re gone, especially any udev rules files in <code>/etc/udev/rules.d</code>.</li>
<li>If you&#8217;ve been syncing via SSH, and you log in as root, your permissions might be messed up. Run <code>chown -R mobile /var/mobile/Media</code> on the phone, and make sure you don&#8217;t get any permission errors when changing files via an ifuse mount.</li>
<li>There&#8217;s a udev bug that causes usbmuxd not to respond to signals, which means it will never quit if you remove all devices, and it might not detect any new devices after you&#8217;ve plugged in the one that caused it to start up. As a workaround, <code>kill -9</code> it, and run it from the console. A workaround for this bug is also in the usbmuxd Git repo.</li>
</ul>
<h3>Step 1</h3>
<p>Install <a href="http://www.libusb.org/wiki/Libusb1.0">libusb</a>-<a href="http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.3/libusb-1.0.3.tar.bz2/download">1.0.3</a> (or newer). This should be straightforward. If your distro carries it, that&#8217;s fine, just make sure it&#8217;s 1.0.3 at least (if it isn&#8217;t, the repos I mentioned above probably have it).</p>
<h3>Step 2</h3>
<p>Install <a href="/blog/iphonelinux/usbmuxd/">usbmuxd</a>-<a href="http://marcansoft.com/uploads/usbmuxd/usbmuxd-1.0.0.tar.bz2">1.0.0</a>. Make sure you read the <code>README</code> file, especially the part about creating a user named <code>usbmux</code> with USB access permissions (does not apply if you&#8217;re using distro packages, hopefully). After installing usbmuxd, you should increase the syslog debug level by editing <code>/lib/udev/rules.d/85-usbmuxd.rules</code> and adding <code>-v -v</code> flags to the end of both <code>RUN</code> statements, like this: <code>RUN+="/usr/sbin/usbmuxd -u -U -v -v"</code> (and similarly for the other line). This will get you useful debug information in syslog without flooding you with messages.</p>
<p>Have syslog open (<code>tail -f</code>, xconsole, whatever). Plug in (or replug) your device. You should see something like this:</p>
<pre>usb 3-4.3: new high speed USB device using ehci_hcd and address 68
[...]
usbmuxd[12705]: [3] usbmux v1.0.0 starting up
usbmuxd[12707]: [4] Creating socket
usbmuxd[12707]: [3] Successfully dropped privileges to 'usbmux'
usbmuxd[12707]: [4] Initializing USB
usbmuxd[12707]: [4] Found new device with v/p 05ac:1290 at 3-68
usbmuxd[12707]: [4] Using wMaxPacketSize=512 for device 3-68
usbmuxd[12707]: [3] Connecting to new device on location 0x30044 as ID 1
usbmuxd[12707]: [4] 1 device detected
usbmuxd[12707]: [3] Initialization complete
usbmuxd[12707]: [3] Connected to v1.0 device 1 on location 0x30044 with serial number be2975afb30b6db9025f95261b9e0a7041044661</pre>
<p>If you don&#8217;t see anything related to usbmuxd, either you forgot the <code>-v -v</code> or you need to reload your udev rules: <code>$ sudo udevadm control --reload-rules</code>. As a last resort, try rebooting. If it still doesn&#8217;t work, something&#8217;s wrong. You can continue by running usbmuxd manually as explained in the README, but you should report a bug.</p>
<p>If you have a jailbroken phone with SSH, try running <code>$ iproxy 2222 22</code> and then SSH to localhost, port 2222 on another console. You should be able to SSH into your phone.</p>
<p>Unplug your phone. If usbmuxd was started via udev (not manually), it should quit. If it doesn&#8217;t, report a bug.</p>
<h3>Step 3</h3>
<p>Install <a href="http://github.com/JonathanBeck/libplist">libplist-<a href="http://cloud.github.com/downloads/JonathanBeck/libplist/libplist-0.16.tar.bz2">0.16</a> and then <a href="http://matt.colyer.name/projects/iphone-linux/index.php?title=Main_Page">libiphone</a>-<a href="http://cloud.github.com/downloads/MattColyer/libiphone/libiphone-0.9.4.tar.bz2">0.9.4</a> and <a href="http://matt.colyer.name/projects/iphone-linux/index.php?title=Main_Page">ifuse</a>-<a href="http://cloud.github.com/downloads/MattColyer/ifuse/ifuse-0.9.4.tar.bz2">0.9.4</a>.</p>
<p>Now you should be able to mount your phone by simply running <code>$ ifuse &lt;mountpoint&gt;</code>. You should be able to see the media folder structure and even grab photos and other stuff. If you have a jailbroken phone, you can use the <code>--root</code> option to mount the root filesystem with root privileges (I usually prefer ssh/sshfs for this, though). <b>Do NOT use the <code>--root</code> option to sync music, it will not work and may mess up your permissions.</b></p>
<p><b>If you have access to more than one iPhone or iPod Touch</b>, we could use some multiple-device testing! Usbmuxd should happily start up when you plug in the first device, keep running while you plug in any other devices, and stop once all devices have been removed. Usbmuxd will report the device UUIDs (it calls them &#8220;serial numbers&#8221;) as they are connected (if you&#8217;re using <code>-v -v</code>). You should be able to pass the <code>--uuid=&lt;uuid&gt;</code> option to ifuse to mount a specific device. Please test this for us!</p>
<h3>Intermission</h3>
<p><b>If you are not used to alpha software, checking out development sources, testing patches, and working with developers, stop here</b>. Now you&#8217;ve got all the underlying stuff working, so you&#8217;re probably better off waiting for some time until libgpod stabilizes some and things are merged and tested.</p>
<p>If you are a developer willing to help, a very enthusiastic power user, or simply a masochist, feel free to read on. Be warned: pain lies ahead, don&#8217;t even think about using the following for day-to-day use at this point in time. From here on there are no distro packages and no nice source tarballs. Experiments and feedback only. This Will Eat Your Music Collection For Dinner And Replace It With Hours And Hours Of &lt;insert terrible music&gt;.</p>
<h3 style="color: #d00">Step 4</h3>
<p>Clone <del datetime="2009-12-22T16:21:48+00:00"><a href="http://gitorious.org/~teuf/libgpod/teuf-sandbox">teuf&#8217;s sandbox</a> Git repository for libgpod, and <b>switch to the <code>iphone30</code> branch</b></del> <a href="http://gtkpod.git.sourceforge.net/git/gitweb.cgi?p=gtkpod/libgpod;a=summary">the libgpod git repository at SourceForge</a>, then compile and install it:</p>
<pre>$ git clone git://gtkpod.git.sourceforge.net/gitroot/gtkpod/libgpod
$ cd libgpod
$ CFLAGS="-g -O0" sh autogen.sh --prefix=/usr
$ make
$ sudo make install</pre>
<h3 style="color: #d00">Step 5</h3>
<p>Mount the device and create the <code>iTunes_Control/Device</code> directory. Then, get your UUID (it should be in the syslog from usbmuxd, or you can find it by running <code>$ lsusb -v | grep -i iSerial</code>). It should be 40 characters long. Then, run <code>$ tools/ipod-read-sysinfo-extended &lt;uuid&gt; &lt;mountpoint&gt;</code>. This should generate a file named <code>iTunes_Control/Device/SysInfoExtended</code>. Make sure it&#8217;s not empty and whatnot; it should be a large-ish plist (XML file) with a bunch of info.</p>
<h3 style="color: #d00">Step 6</h3>
<p>Make sure your device already contains a valid music database created by iTunes. If it doesn&#8217;t, drop me a line on IRC and we can try some cool new stuff. New databases can be created, but there might be issues and you need some way of generating the <code>HashInfo</code> file (more on this later).</p>
<h3 style="color: #d00">Step 7</h3>
<p>Open an application that uses libgpod to manage iPods. Gtkpod is recommended at this stage, as its what I use to test. Other apps (Rhythmbox, Amarok, etc) <i>theoretically</i> should work. Theoretically, because Amarok 1.4 crashes/hangs pretty badly for me, for example, and I&#8217;m not sure who is to blame. I&#8217;d like to hear any success or failure stories. Please run your app from a console so you can see any debug messages.</p>
<p>First, load your device. Once the application has accessed the music library, a new file called <code>HashInfo</code> should have popped up in the <code>iTunes_Control/Device</code> directory. If it isn&#8217;t there, you&#8217;ve got a problem: check stdout for any messages and and preferably ping me on IRC or at least e-mail me your UUID and your iTunes-created <code>iTunes_Control/iTunes/iTunesCDB</code> file (it shouldn&#8217;t have been modified yet).</p>
<p>Make some changes (add a song, make a playlist, etc), save, and cross your fingers. With any luck, you&#8217;ll get some debug spew, any songs will transfer, the iPhone/iPod will show a pretty &#8220;syncing&#8221; screen, the database will be written, the &#8220;syncing&#8221; screen will go away, and you&#8217;ll be able to launch the iPod application and see your changes and play any new songs. There will be bugs at this stage, but please do report any issues along with expected behavior.</p>
<h3 style="color: #d00">Step 8</h3>
<p>Plug your device into a computer running iTunes (unmount it on your Linux computer first!) and check that it can see the changes made with libgpod. This is very important, because <b>iTunes and the device use different databases</b>: the data managed by iTunes and libgpod is maintained in an <code>iTunesCDB</code> (a compressed version of the old, classic <code>iTunesDB</code> format), but it is converted to a new SQLite database format for the iPod app to use. So both libgpod and iTunes read the <code>iTunesCDB</code>, but they write out the <code>iTunesCDB</code> <b>and</b> the SQLite databases. You should be able to make changes in iTunes and swap your device from iTunes to libgpod and back and see them, etc.</p>
<h3>Bugs</h3>
<p>Tons. The only things tested to work are managing simple music and working with simple playlists. There&#8217;s a known annoying bug where the iTunes special playlists (Ringtones/etc) are converted to normal playlists by libgpod, and then iTunes recreates them if you use it again, creating duplicates each time you switch between using libgpod and iTunes. The DB schema is outdated (3.0 instead of 3.1), so you&#8217;ll see a (hopefully short) &#8220;Updating&#8221; step when you launch the iPod app. Please report issues, but keep in mind that they&#8217;re to be expected. This is very very very alpha code. I probably screwed up something on this post even, so chances are you&#8217;ll get stuck somewhere. Tough luck, it&#8217;s 7am and I need to catch some sleep <img src='http://marcansoft.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Hope you had fun! Keep in mind that you can usually find us on #gtkpod on freenode if you need to report an issue. Comments on this post are fine too, for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://marcansoft.com/blog/2009/10/iphone-syncing-on-linux-part-2/feed/</wfw:commentRss>
		<slash:comments>158</slash:comments>
		</item>
		<item>
		<title>iPhone syncing on Linux</title>
		<link>http://marcansoft.com/blog/2009/10/iphone-syncing-on-linux/</link>
		<comments>http://marcansoft.com/blog/2009/10/iphone-syncing-on-linux/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 18:46:11 +0000</pubDate>
		<dc:creator>marcan</dc:creator>
				<category><![CDATA[iPhone on Linux]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[usbmuxd]]></category>

		<guid isPermaLink="false">http://marcansoft.com/blog/?p=104</guid>
		<description><![CDATA[Those who watch my git repos may have noticed that I&#8217;ve been working on this for a while now. iPhones and iPod Touches have never been properly supported under Linux (especially non-jailbroken devices) because they are just so different from all the previous iPod models. There was a lot of new code to write and [...]]]></description>
			<content:encoded><![CDATA[<p>Those who watch my <a href="http://git.marcansoft.com/">git repos</a> may have noticed that I&#8217;ve been working on this for a while now. iPhones and iPod Touches have never been properly supported under Linux (especially non-jailbroken devices) because they are just so different from all the previous iPod models. There was a lot of new code to write and Apple hasn&#8217;t exactly made it easy either:</p>
<ul>
<li>The iPhone uses a custom USB communications protocol, connection-oriented, which is totally different from standard mass storage devices</li>
<li>It provides multiple services over this protocol, and many have to be interacted with to complete sync</li>
<li>iPhone OS 2.x brought us a new hash (designed to lock users into iTunes) that so far had not been reverse engineered</li>
<li>iPhone OS 3.x brought us a new SQLite-based database format which, although a lot more Linux-friendly than the old proprietary format, does require a bunch of new code (and the old format still needs to be supported for compatibility).</li>
</ul>
<p>Well, I&#8217;m happy to say that all of this is coming to an end and that Linux will finally get quite complete iPhone/iPod Touch syncing support soon, thanks to the work of many dedicated people. <span id="more-104"></span>This is what the software stack looks like:</p>
<p><img src="/transf/iphonelinux-stack.png" alt=""/></p>
<ul>
<li><a href="http://www.libusb.org/wiki/Libusb1.0">libusb-1.0</a> provides an advanced API to access USB devices under Linux, replacing the old libusb-0.1 API</li>
<li><a href="/blog/iphonelinux/usbmuxd/">usbmuxd</a> coordinates application access to the device and talks the specific iPhone/iTouch USB protocol</li>
<li><a href="http://matt.colyer.name/projects/iphone-linux/index.php?title=Main_Page">libiphone</a> implements the Apple-specific protocols that are tunneled through usbmuxd: it can launch services through lockdown, retrieve device info, send notifications, and access the filesystem via AFC.</li>
<li><a href="http://matt.colyer.name/projects/iphone-linux/index.php?title=Main_Page">iFuse</a> and <a href="http://cgit.sukimashita.com/gvfs-backend-afc.git/">gvfs-backend-afc</a> both provide access to AFC to regular Linux apps. iFuse does this by mounting via FUSE, while gvfs-backend-afc is obviously a backend for gVFS.</li>
<li><a href="http://www.gtkpod.org/libgpod/">libgpod</a> (the library that traditionally has managed music databases for iPods) is being extended to support the new SQLite format, the new hash, and also to talk to libiphone to properly put the device in to and out of sync mode.</li>
<li>Theoretically, actual music players such as Amarok and Rhythmbox will need none or very few modifications to work.</li>
</ul>
<p>I originally started work on usbmuxd which I am maintaining, and I&#8217;m now helping libgpod compatibility with the new formats. The software stack needs to be working from the bottom up, so I&#8217;ve just tagged and released the first <a href="/blog/iphonelinux/usbmuxd/">Release Candidate for usbmuxd-1.0.0</a>. If you have an iPhone or an iPod Touch and you&#8217;d like to use them with Linux in the future, I encourage you to test it out. If your device is jailbroken, you get the immediate benefit of being able to SSH over USB (which is a <b>lot</b> faster than over WiFi!), and if you&#8217;re using firmware 2.x or earlier and the hacky sync-over-WiFi-with-sshfs method, you can immediately get a speed boost by doing it over USB.</p>
<p>If you&#8217;re feeling adventurous, the development versions of libiphone and iFuse are also quite good. Theoretically, if your usbmuxd is working an you&#8217;ve got iFuse installed, you can just type &#8220;ifuse &lt;mountpoint&gt;&#8221; and instantly have your device mounted. Don&#8217;t expect to get libgpod to work at this time without quite some pain though. If you&#8217;re a developer and you&#8217;re feeling <b>really</b> adventurous though, you can join us on #gtkpod on freenode and help us test and fix the new libgpod support!</p>
<p>Please report any bugs or fixes in usbmuxd either directly to <a href="mailto:hector@marcansoft.com">me</a> or to the <a href="http://lists.mattcolyer.com/listinfo.cgi/iphone-linux-dev-mattcolyer.com">iphone-linux-dev mailing list</a>. Any issues with libiphone or iFuse should also go to the list.</p>
]]></content:encoded>
			<wfw:commentRss>http://marcansoft.com/blog/2009/10/iphone-syncing-on-linux/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Enabling Intel VT on the Aspire 8930G (and other InsydeH2O-based laptops)</title>
		<link>http://marcansoft.com/blog/2009/06/enabling-intel-vt-on-the-aspire-8930g/</link>
		<comments>http://marcansoft.com/blog/2009/06/enabling-intel-vt-on-the-aspire-8930g/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 16:30:49 +0000</pubDate>
		<dc:creator>marcan</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[acer]]></category>
		<category><![CDATA[bios]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[intelvt]]></category>
		<category><![CDATA[reveng]]></category>

		<guid isPermaLink="false">http://marcansoft.com/blog/?p=71</guid>
		<description><![CDATA[It seems the ongoing trend for laptops is to integrate and hide as much as possible from the user. We&#8217;re all used to minimalistic crappy BIOS setups with two or three configuration options. However, things go way too far when OEMs remove options related to features that the hardware is capable of but which are [...]]]></description>
			<content:encoded><![CDATA[<p>It seems the ongoing trend for laptops is to integrate and hide as much as possible from the user. We&#8217;re all used to minimalistic crappy BIOS setups with two or three configuration options. However, things go way too far when OEMs remove options related to features that the hardware is capable of but which are disabled by default. This happens with Intel VT on many laptops &#8211; even if the CPU supports it, you may not be able to find the BIOS setup option to turn it on. </p>
<p>I certainly wanted to use a feature that I <b>paid for</b>, so I started investigating the BIOS and here&#8217;s what I found out.<br />
<span id="more-71"></span></p>
<h3>Under the hood</h3>
<p>The InsydeH2O BIOS is no ordinary old-style BIOS. Instead, it&#8217;s based around the <a href="http://www.uefi.org/">UEFI</a> platform. This goes way beyond the old BIOS paradigm and turns system firmware into practically its own separate OS, that even runs in full 64-bit mode on 64-bit machines. Unfortunately, they make no effort to expose any of this to the user. The firmware has support for booting EFI executables, there&#8217;s an EFI shell, there&#8217;s an EFI boot manager&#8230; but I haven&#8217;t been able to figure out how to access any of this.</p>
<p>If you want to reverse engineer EFI stuff, downloading <a href="https://www.tianocore.org/">TianoCore&#8217;s EDK2</a> is a must. It contains source code for a lot of Intel&#8217;s framework, which is what most vendors use as a base for their EFI support. A lot of the code is exactly the same as what&#8217;s in the Insyde BIOS (read the spec <a href="http://download.intel.com/technology/framework/docs/HII_9_2.pdf">here</a>). </p>
<p>As for the Setup tool, it does indeed have a huge Advanced menu with even more options than your average desktop. There&#8217;s also a hidden Power menu. EFI defines a &#8220;form browser&#8221; protocol and formats for user input, which is what Insyde uses for their setup utility (spec <a href="http://download.intel.com/technology/framework/docs/HII_9_2.pdf">here</a>). I found these tables when disassembling the Setup binary and wrote a little dump utility to turn them into text. The result is a complete dump of the Setup hierarchy, including the Advanced menu, which also includes the offsets in the non-volatile storage corresponding to each setting. Insyde stores this configuration blob into an EFI variable named <code>Setup</code>. <a href="/uploads/insydehacks/setup.txt">Here&#8217;s</a> my dump: the first part is the hierarchy, while at the end I added a rough auto-calculated mapping from configuration offsets to setting names (grep for <code>[0xOFFSET</code> in the top section for better context - the format is <code>[0xOFFSET&lt;FIELD_WIDTH&gt;]</code> for all references to the storage blob). You&#8217;ll find the tools I used <a href="/uploads/insydehacks">here</a>, if you&#8217;re interested, but they&#8217;re rough and need quite a bit of manual help too.</p>
<p>I wasn&#8217;t able to find out how to enable the hidden menus, other than that their form Subclass is 5 instead of 0 (but I haven&#8217;t found what, if anything, checks for this and whether its behavior can be altered). However, manually enabling VT support in the <code>Setup</code> variable is easy enough, now that we have the offset of the VT Enable byte.</p>
<h3>Enabling Intel VT</h3>
<p>The easiest way to enable the setting as far as I can see is to dump out the entire BIOS, patch the setting into the Setup variable (which is part of the data storage section &#8211; we aren&#8217;t modifying any actual BIOS code, as this is the equivalent of changing a CMOS setting on other BIOSes), and then flash the resulting image. These laptops use a weird flash-behind-EC hardware solution for which there is no open flasher, so instead we can just use the normal BIOS flashing tool. In short, we&#8217;ll flash the existing BIOS back on, but in the process also modify a Setup setting.</p>
<p><b>FAIR WARNING:</b> This might apply to other similar laptops, or it might not. It might work, it might do nothing, or it might brick your expensive laptop. Even if you own an Aspire 8930G, I take no responsiblity if your laptop dies, turns into an expensive brick, melts into a pool of slag, blows up, flicks you off, develops self-awareness, or becomes Skynet. You have been warned. I have only tested this on an Aspire 8930G with BIOS Version 1.10. If you want to try this on another system or BIOS you should make sure you understand EXACTLY what is going on and are prepared to spot any problems or fix things yourself.</p>
<p>First, dump the exiting BIOS out. It resides at the top of the 32-bit address space, and is 2MB in size. You can use dd to dump it out of /dev/mem:</p>
<pre>$ dd if=/dev/mem of=original_bios.fd bs=1024 count=2048 skip=4192256</pre>
<p>It is a <i>very</i> good idea to back up this BIOS somewhere safe outside the laptop. Note that it not only contains your existing BIOS code, but also all your settings and manufacturer data (serial number, software license if you run an OEM version of Vista, etc).</p>
<p>Next, run <a href="/uploads/insydehacks/vtenable.py">vtenable.py</a>. This will attempt to locate the <b>Setup</b> EFI variable on the non-volatile storage section and patch the VT byte to one.</p>
<pre>$ python vtenable.py original_bios.fd vt_bios.fd</pre>
<p>You can edit the source code to make other changes to the variable, but make sure you know what you&#8217;re doing. It&#8217;s worth reiterating that <b>this does not patch your BIOS code</b>. It only makes a setting change, just as if you&#8217;d turned on the VT option in the BIOS had it been there. In fact, there are two variables: <code>Setup</code> and <code>Custom</code>, and <code>Setup</code> is the one that changes are committed to when you use the setup utility. Restoring defaults should turn VT back off (untested). It also appears that <code>Custom</code> is probably what the setup defaults are, so changing that should semi-permanently enable VT.</p>
<p>I highly recommend performing a sanity diff between the original and modified images using vbindiff:</p>
<pre>$ vbindiff original_bios.fd vt_bios.fd</pre>
<p>Only two or three bytes should change: one or two adjacent bytes for the checksum (they should be decremented by one when you look at them as a 16-bit unsigned integer), and the VT enable byte should change from <code>00</code> to <code>01</code>. Right after the checksum bytes you should be able to see the <code>Setup</code> name in UTF-16 (something like <code>S.e.t.u.p.</code>).</p>
<p>Finally, flash <code>vt_bios.fd</code> using the vendor-supplied flash utility. I use the DOS version (<code>FLASHIT.EXE</code>) with FreeDOS and a grub menu option so I don&#8217;t need to mess around with external media. Grab a base image <a href="/uploads/insydehacks/freedos_flashit.img.bz2">here</a>, then you can use <a href="http://mtools.linux.lu/">mtools</a> to copy the bios into it:</p>
<pre>$ bunzip2 freedos_flashit.img.bz2
$ mcopy -i freedos_flashit.img vt_bios.fd ::/vt_bios.fd</pre>
<p>To boot it using GRUB, get <a href="http://syslinux.zytor.com/wiki/index.php/MEMDISK">MEMDISK</a>, part of <a href="http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project">SYSLINUX</a>, and put something like this in your grub.conf:</p>
<pre>title=BIOS Update
root (hd0,0)
kernel (hd0,0)/boot/memdisk
initrd (hd0,0)/boot/freedos_flashit.img</pre>
<p>Of course, copy memdisk and the boot image to your boot partition, and change <code>(hd0,0)</code> to your boot (or root) partition everywhere and remove the <code>/boot</code> part if you have a dedicated boot partition.</p>
<p>Once you&#8217;re in FreeDOS, just type <code>FLASHIT vt&lt;tab&gt;</code> and be happy that FreeDOS supports tab-completion <img src='http://marcansoft.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Caveat: by doing this, you&#8217;re flashing the entire BIOS image. The flash tool makes no attempt to flash only the parts that changed, and the &#8220;flash only variables&#8221; commandline option seems to have no effect. You&#8217;re effectively reflashing your entire BIOS back on, so the usual BIOS flashing caveats apply: don&#8217;t turn the power off, etc. This could be accomplished a lot more cleanly if we had drivers for the flash chip / EC, since then we could use the normal EFI variable store procedure to atomically update the variable, which is completely safe.</p>
<p>You can use the <a href="http://www.linux-kvm.org/page/Enable_VT-X_on_Mac_Pro_(Early_2008)">MSR Magic</a> tool to check whether VT is indeed enabled on your CPU.</p>
<p><b>Update</b>: Several people are working on improved, more general tools to perform this hack across a broader range of InsydeH2O-based BIOSes. Read the comments and check them out, they&#8217;ve done some very good work.</p>
]]></content:encoded>
			<wfw:commentRss>http://marcansoft.com/blog/2009/06/enabling-intel-vt-on-the-aspire-8930g/feed/</wfw:commentRss>
		<slash:comments>387</slash:comments>
		</item>
		<item>
		<title>iPhone OS 3.0 music: totally incompatible</title>
		<link>http://marcansoft.com/blog/2009/06/iphone-os-30-music-totally-incompatible/</link>
		<comments>http://marcansoft.com/blog/2009/06/iphone-os-30-music-totally-incompatible/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 23:30:25 +0000</pubDate>
		<dc:creator>marcan</dc:creator>
				<category><![CDATA[iPhone on Linux]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://marcansoft.com/blog/?p=63</guid>
		<description><![CDATA[With the new OS version, Apple totally changed up the database format. Now it&#8217;s based on a whole bunch of SQLite files and there are also a few files in a format similar to the old proprietary one. There are more than likely still hashes in the critical files, and there&#8217;s also a suspicious pair [...]]]></description>
			<content:encoded><![CDATA[<p>With the new OS version, Apple totally changed up the database format. Now it&#8217;s based on a whole bunch of SQLite files and there are also a few files in a format similar to the old proprietary one. There are more than likely still hashes in the critical files, and there&#8217;s also a suspicious pair of files that appear to be entirely encrypted. The SQLite format is open and certainly better than the old one, but someone still needs to interface a media player to it.</p>
<p>The upshot of this is that a whole new support library will need to be written or large changes in libgpod need to happen to support the new SQLite format. The DBVersion hack also isn&#8217;t going to work &#8211; either someone needs to reverse engineer the complete hashing algorithm (and maybe that encrypted file stuff), or the MusicLibrary binary on the phone needs to be patched. So, if you&#8217;re currently syncing music with free software, you&#8217;ll want to hold off on upgrading to 3.0.</p>
<p>Patching the check out of MusicLibrary looks trivial enough, so although it&#8217;s not as easy as the DBVersion hack, it isn&#8217;t a real showstopper. The hash algorithm looks the same as the old one, or at least quite similar (and just as badly obfuscated). Those encrypted files do scare me a bit though.</p>
]]></content:encoded>
			<wfw:commentRss>http://marcansoft.com/blog/2009/06/iphone-os-30-music-totally-incompatible/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>More SPMP goodness: now with pseudo-3D</title>
		<link>http://marcansoft.com/blog/2009/06/more-spmp-goodness-now-with-pseudo-3d/</link>
		<comments>http://marcansoft.com/blog/2009/06/more-spmp-goodness-now-with-pseudo-3d/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 01:06:28 +0000</pubDate>
		<dc:creator>marcan</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[reveng]]></category>
		<category><![CDATA[spmp]]></category>
		<category><![CDATA[sunplus]]></category>

		<guid isPermaLink="false">http://marcansoft.com/blog/?p=52</guid>
		<description><![CDATA[After a few days of reading very, very weird disassembled code and poking registers, the odd 2D hardware finally works (for the most part). It can draw lines, so I threw in a software 3D transform. Here&#8217;s the Stanford Bunny in a glorious 448 vertices and 1416 lines of jaggy wireframe awesomeness. The chip has [...]]]></description>
			<content:encoded><![CDATA[<p>After a few days of reading very, very weird disassembled code and poking registers, the odd 2D hardware finally works (for the most part). It can draw lines, so I threw in a software 3D transform. Here&#8217;s the <a href="http://en.wikipedia.org/wiki/Stanford_Bunny">Stanford Bunny</a> in a glorious 448 vertices and 1416 lines of jaggy wireframe awesomeness.</p>
<p><object type="application/x-shockwave-flash" style="width:425px; height:350px;" data="http://www.youtube.com/v/3tg7KSSUl8Q&#038;hl=es&#038;fs=1&#038;"><param name="movie" value="http://www.youtube.com/v/3tg7KSSUl8Q&#038;hl=es&#038;fs=1&#038;" /><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>
<span id="more-52"></span><br />
The chip has hardware line styling (stippling), and you can see 4 different settings (solid, &#8220;10&#8243; dashed, &#8220;100&#8243; dashed, &#8220;1000&#8243; dashed) in sequence. At the higher setting it starts to look more like a point cloud with many more points than it has real vertices.</p>
<p>Also of note: I&#8217;m working inside a framework that drives operation of the SPMP from the PC. While the entire bunny transformation and rendering is happening inside the SPMP, the PC sends it the rotation matrix and tells it to go each frame (and also when to switch stippling and whatnot). So it&#8217;s slower than it would be in pure standalone hardware, because there&#8217;s still at least two serial port ping-pong commands each frame (one memory download for the matrix and one command to tell it to render the bunny with it).</p>
<p>You can grab the (ugly as hell) code in the <a href="http://git.marcansoft.com/?p=spmp.git;a=summary">Git repo</a>.</p>
<p>Fun stuff: the projection is orthographic, so there&#8217;s no depth information rendered. This makes the rotation ambiguous. Do you see it rotating clockwise or anticlockwise (looking at it from above)? Can you make your brain switch between them?</p>
]]></content:encoded>
			<wfw:commentRss>http://marcansoft.com/blog/2009/06/more-spmp-goodness-now-with-pseudo-3d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sunplus SPMP305x media player hacking</title>
		<link>http://marcansoft.com/blog/2009/06/sunplus-spmp305x-media-player-hacking/</link>
		<comments>http://marcansoft.com/blog/2009/06/sunplus-spmp305x-media-player-hacking/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 03:23:59 +0000</pubDate>
		<dc:creator>marcan</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[reveng]]></category>
		<category><![CDATA[spmp]]></category>
		<category><![CDATA[sunplus]]></category>

		<guid isPermaLink="false">http://marcansoft.com/blog/2009/06/sunplus-spmp305x-media-player-hacking/</guid>
		<description><![CDATA[I&#8217;ve joined a bunch of friends in a quest to reverse engineer and write custom software for Sunplus SPMP305x chips. These chips are inside all sorts of chinese media players, particularly the fairly powerful kind with a camera, video playback, etc. The chip is based around an ARM926EJ-S core, but the peripherals around it are [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve joined a bunch of friends in a quest to reverse engineer and write custom software for Sunplus SPMP305x chips. These chips are inside <a href="http://spmp305x.spritesserver.nl/wiki/index.php/List_of_units">all sorts of chinese media players</a>, particularly the fairly powerful kind with a camera, video playback, etc. The chip is based around an ARM926EJ-S core, but the peripherals around it are completely custom &#8211; check out the <a href="http://www.sunplusmm.com/products/dsc/spmp.asp">marketing blurb</a>. Most current work is on reverse engineering the hardware interface so we can completely replace the default firmware.</p>
<p>If you&#8217;re interested and you have one of these or don&#8217;t mind spending <a href="http://www.dealextreme.com/details.dx/sku.21968">$33</a> to get an interesting ARM machine, check out the <a href="http://spmp305x.spritesserver.nl/wiki/index.php">wiki</a>, <a href="http://code.google.com/p/libspmp3050/">Google Code project</a> for the Prex port and other stuff, and my <a href="http://git.marcansoft.com/?p=spmp.git;a=summary">Git repository</a> with a port of MINI and a bunch of client utilities for reverse engineering and testing the hardware stuff. Most importantly, however, come visit us at #spmpdev on the EFNet network! Most of the work and chitchat happens in the IRC channel.</p>
<p><img src="http://marcansoft.com/uploads/spmp/spmp_lcd.jpg" alt="sunplus test image" /></p>
]]></content:encoded>
			<wfw:commentRss>http://marcansoft.com/blog/2009/06/sunplus-spmp305x-media-player-hacking/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Acer Aspire 8930G Linux audio support</title>
		<link>http://marcansoft.com/blog/2009/06/acer-aspire-8930g-linux-audio-support/</link>
		<comments>http://marcansoft.com/blog/2009/06/acer-aspire-8930g-linux-audio-support/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 05:30:28 +0000</pubDate>
		<dc:creator>marcan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[acer]]></category>
		<category><![CDATA[alsa]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[reveng]]></category>

		<guid isPermaLink="false">http://marcansoft.com/blog/?p=40</guid>
		<description><![CDATA[I&#8217;ll eventually write a longer post about how different bits and pieces of this laptop&#8217;s hardware fare under Linux. For now, I&#8217;ve managed to strike one of the more annoying issues: proper audio. Scroll down if you&#8217;re impatient and want the code; read on if you want the full story. This laptop is peculiar because [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll eventually write a longer post about how different bits and pieces of this laptop&#8217;s hardware fare under Linux. For now, I&#8217;ve managed to strike one of the more annoying issues: proper audio. Scroll down if you&#8217;re impatient and want the code; read on if you want the full story.</p>
<p>This laptop is peculiar because it has built-in &#8220;5.1&#8243; audio. Yes, it does really have 6 speakers, though you&#8217;d be hard pressed to get much spatial separation out of them (and they aren&#8217;t even placed around symmetrically). However, the speakers do end up making a very decent multiway audio system, by laptop standards: the &#8220;rear&#8221; pair (which is actually between the keyboard and the screen; the mind boggles) is good with the high end, the &#8220;front&#8221; and center speakers (front edge of the laptop) are your average mediocre speakers that can handle mid-end, and the &#8220;Tuba&#8221; not-so-&#8221;sub&#8221; woofer fills in enough low-end to equal a decent overall speaker, although of course with zero stereo/spatial separation since there&#8217;s only one of it (actual subwoofers can pull off mono because the human ear can&#8217;t really hear spatial position at <b>low</b> frequencies, but the Tuba is more like the only non-sucky speaker in the entire laptop).</p>
<p>What this boils down to is that you <b>really</b> want good audio support for all 6 speakers if you want to take advantage of the audio capabilities at all. Most importantly, stereo needs to be upmixed and a good portion of the normal audio needs to be routed to the Tuba. ALSA&#8217;s asound.conf makes this easy, assuming the actual hardware works fine. Of course, that&#8217;s not the case.<br />
<span id="more-40"></span><br />
This thing uses (of course) Intel HDA audio with a Realtek ALC889 codec. This codec is fairly new and support is of course still a bit sketchy. There are two parts to getting things to work: the software needs to know how to talk to the ALC889 codec, and it also needs to know how to configure it to work with the laptop&#8217;s hardware design (i.e. how the chip&#8217;s outputs connect to the actual speakers and jacks, which varies). After reading up on HDA audio codec specs and looking for examples, the latter part wasn&#8217;t very hard. There&#8217;s even a tool called <a href="http://git.alsa-project.org/?p=alsa.git;a=tree;f=hda-analyzer">hda-analyzer</a> which lets you tweak most HDA configuration on the fly with a nifty GUI. I also rendered a <a href="http://marcansoft.com/transf/codec.png">graph</a> (warning: large image) of the codec&#8217;s internal audio routing.</p>
<p>Unfortunately, after verifying that I had mapped all of the connections properly and could get individual output through any one of the speakers and audio jacks, I hit a showstopper. The codec has 5 stereo DACs (10 channels total, nominally 7.1 plus an extra stereo connection) but only the first two DACs worked, which gave me 4.0 audio. They rest just appeared to be completely dead. I knew the problem was with the DACs because I could remap the audio outputs to use one of the first two DACs and that worked, and I could tell the first two DACs to play other channels from the input stream and that worked fine too. Audio was getting to the chip, and audio could get out from the chip, but somewhere during the digital-to-analog conversion for DACs 3-5 it was just disappearing. I searched the Realtek datasheet and ALC specs for info on how to turn DACs off or on but found no such thing. Of course, a standard wouldn&#8217;t be complete without a mechanism for vendor-specified proprietary extensions (and those standards that don&#8217;t have them are abused anyway). HDA has these things called coefficient registers, which is just a dumb name for vendor proprietary registers. ALSA already has some code to tweak these on other Realtek codecs, though nothing related to turning DACs on or off. At this point this was clearly Realtek&#8217;s fault for not documenting how to turn on DACs that are <b>turned off by default</b>. So I e-mailed them describing the issue in clear terms, and, in response, got treated like a clueless end-user. They kept sending me patched/modified versions of the realtek support for ALSA with useless changes like support for new laptops and the like and no actual changes to fix the DAC issue. Of course, none of it was helpful, and I gave up on playing along after a couple weeks of wasted time.</p>
<p>Eventually this annoyed me enough that I just desperately tried flipping every bit in every coefficient register. After about 45 minutes of mind-numbing tones (I made a little multichannel test tone using a pentatonic scale which looped a couple thousand times until I was done) I didn&#8217;t find the magic bit to turn on the DACs, but I found <b>two</b> registers able to kill the already-working DACs, guessed a bit, and found out that you need to clear <b>both</b> of them to enable the broken DACs. Success.</p>
<p>Long story short, this, along with proper support for the laptop&#8217;s hardware and such, should be in the next version of ALSA. If you&#8217;re impatient, grab <a href="http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff_plain;h=7082fef37ca21ba0b52a7ae2cae9aa3b5bcc888c;hp=bf939f4cb618f9b10b673f22005196b89c6cc108">this patch</a> and apply it. The one thing that&#8217;s missing is internal mic support (it&#8217;s in there but I don&#8217;t think it works) &#8211; I tried a few things and came up dry, but I don&#8217;t really plan on using it anyway. You&#8217;ll also want an asound.conf to do the upmixing: <a href="http://marcansoft.com/transf/asound.conf">this</a> is what I use. Just place it in /etc (back up / merge your distro&#8217;s version, if any, before you overwrite it!).</p>
<p>Lastly, if you have another Acer laptop with similar audio capabilities, the code will probably work for you but it won&#8217;t autodetect the laptop. You&#8217;ll want to use the option &#8220;model=acer-aspire-8930g&#8221; when loading the snd-hda-intel module to force it. For example, it&#8217;s very likely that it will work with the 8920G. If it works, send the output of &#8220;lspci -v&#8221; or &#8220;sudo lspci -v&#8221; to <a href="mailto:hector@marcansoft.com">me</a> or an ALSA developer so it can be added to the list.</p>
<p><b>Update</b>: I submitted another patch to fix input issues. This gives you the full 3 capture devices, one of which can capture the internal front microphone (the others can&#8217;t; that&#8217;s a chip limitation). The microphone is stereo but due to the weird sum/difference format I&#8217;ve hacked it to just output mono to the device. The stereo is useless anyway, since the mics are too close together. Grab the patch <a href="http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff_plain;h=6f387d0412952ba0a3ae0578b7a98ff622c39215">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://marcansoft.com/blog/2009/06/acer-aspire-8930g-linux-audio-support/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Quickpasting</title>
		<link>http://marcansoft.com/blog/2009/04/quickpasting/</link>
		<comments>http://marcansoft.com/blog/2009/04/quickpasting/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 15:18:33 +0000</pubDate>
		<dc:creator>marcan</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[pastebin]]></category>
		<category><![CDATA[pastie]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://marcansoft.com/blog/2009/04/quickpasting/</guid>
		<description><![CDATA[If you&#8217;ve ever worked with other people on some piece of code or program, particularly over IRC or IM or some other form of real-time or fast text communication, chances are you&#8217;ve used one of the many &#8220;paste&#8221; sites available (my personal favorite is pastie). These sites offer a convenient way of sending small to [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever worked with other people on some piece of code or program, particularly over IRC or IM or some other form of real-time or fast text communication, chances are you&#8217;ve used one of the many &#8220;paste&#8221; sites available (my personal favorite is <a href="http://pastie.org">pastie</a>). These sites offer a convenient way of sending small to medium chunks of text to other people quickly, by simply copyng and pasting the text into a web form. This is a lot better than the old way of having to send an e-mail attachment, spam an IRC channel, or upload the text to some web host, but as I used pastie more and more often I started to realize that it could be made even faster.<br />
<span id="more-36"></span><br />
So I wrote a simple Python script that lets you quickly upload some text or a set of files to Pastie. It can do stdin or a bunch of files, and it also tries to figure out what syntax highlighting to pick from the file extension. You can grab it <a href="http://pastie.org/459763">here</a>. Rename it to &#8216;pastie&#8217;, make it executable, and place it somewhere in your $PATH. There is built-in help available (just call pastie &#8211;help), but here are some simple examples:</p>
<pre># this pasties the output of do_something as a public pastie
$ do_something | pastie -p
# this pasties the specified files, using a header for each
# and the correct syntax highlighting setting
$ pastie foo.c bar.py baz.sh
# pastie stdin with author "marcan" as a python script
$ pastie -t python -n marcan</pre>
<p>You can also set the DEFAULT_NAME variable at the top of the file to a quoted string to use a certain author name by default for all your pasties.<br />
There&#8217;s an extra undocumented feature useful for editor integration: if you pass in a filename to the -t option, it&#8217;ll try to figure out the parser from the extension and use that for syntax highlighting (but it&#8217;ll take input from stdin unless you use file arguments). This is useful for making an editor plug-in or action that can pastie the current selection from a document and still keep the right syntax highlighting:</p>
<pre>echo "%current_selection" | pastie -t "%current_file" | xargs firefox</pre>
<p>A very neat trick is to make a global shortcut to pastie the current clipboard contents. If you&#8217;re using KDE with X11, for example, you could bind ctrl+shift+c to the following command:</p>
<pre>xsel -o | pastie | xsel -i &#038;&#038; play ~/your_favorite_bell.wav</pre>
<p>This will pastie the current X11 selection, then write back the URL as the selection, and play a ding of your choice. This means you can select any text, hit ctrl+shit+c, and then middle-click on an IRC or IM session to paste the URL to the text that you just selected. If your ISP&#8217;s nameservers are slow like mine are, add pastie.org to your /etc/hosts for a speed boost.</p>
<p>Happy pasting!</p>
]]></content:encoded>
			<wfw:commentRss>http://marcansoft.com/blog/2009/04/quickpasting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HDCP Authentication Failure</title>
		<link>http://marcansoft.com/blog/2009/02/hdcp-authentication-failure/</link>
		<comments>http://marcansoft.com/blog/2009/02/hdcp-authentication-failure/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 14:44:01 +0000</pubDate>
		<dc:creator>marcan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[drm]]></category>
		<category><![CDATA[fail]]></category>

		<guid isPermaLink="false">http://marcansoft.com/blog/?p=34</guid>
		<description><![CDATA[And I wasn&#8217;t even watching protected content. This is (one of the many reasons) why DRM needs to die.]]></description>
			<content:encoded><![CDATA[<p><img src="/uploads/images/hdcp_fail.jpg" alt="pixel snow" /></p>
<p>And I wasn&#8217;t even watching protected content.</p>
<p>This is (one of the many reasons) why DRM needs to die.</p>
]]></content:encoded>
			<wfw:commentRss>http://marcansoft.com/blog/2009/02/hdcp-authentication-failure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
