[SOLVED] Creative X-FI Titanium (ctxfi) on Ubuntu 11.10

Creative X-FI Titanium ctxfi ubuntu

The Creative line of cards can be a handful at times, so that’s why we (by we I mean other Linux developers) developed Alsa and open source drivers. Contrary to popular belief, you do not need the official drivers from Creative. All you need is a little bit of time and command-line work. For this, you’ll need access to a terminal and root privileges (because you’ll be installing some stuff). Best of all, I got digital out working as well with AC3 Digital surround sound! With these exact instructions, I got my Creative X-FI Titanium working on Ubuntu 11.10 with the 3.0.0-14-generic kernel (x64/AMD64). It outputs via the digital optical cable, so I’m running in “Digital Surround 5.1 (IEC958/AC3) Output”, pretty awesome aye? You can have this working too, all you need is a little elbow grease. So let’s get started.

UPDATE: the apt-get line right below had a mistake in it where I accidently left in ‘build-dep’. Build-dep is NOT a package you install … it’s something APT does to help build things. Sorry for those of you who were led astray by that! The proper code is below. :) Enjoy! There are several prerequisites before doing anything. We need to download some packages which will help build everything. sudo apt-get install linux-source libasound2-plugins libavcodec-dev libavformat-dev After that installs, we need to handle building a patched (fixed) Linux Kernel module for the Creative card (the driver is called ctxfi though inside your linux installation it’s called snd_ctxfi). Don’t worry though, you won’t be compiling a whole new kernel, just the ctxfi module. Let’s start by making a folder we can work in and then getting the source code into it so we can edit it.
mkdir ctxfi-module
cd ctxfi-module
cp /usr/src/linux-source-3.0.0.tar.bz2 .
tar xfj linux-source-3.0.0.tar.bz2

Now the important stuff: patching the module so that it’ll work just right! You can download (ie: copy and paste) the patch directly from the official Kernel GIT repository (that’s the place cool hackers put up all the great code and fixes!) right here: GIT Kernel Patch OR just download the patch file I made for you (my file is exactly the same as the link above except it’s in a file all ready and waiting to be used by you) by clicking: right here to download the file (.patch file). Right click and choose “Save As” to download it Time to apply the patch. First though, we need to change something that the CURRENT kernel files are missing. So let’s edit and fix that first:

gksu gedit /usr/src/linux-headers-uname -r/include/linux/pci_ids.h Side note: You can also use vim or whatever. Also, if you want to stick to the command line always, just use ‘sudo’ instead of gksu. Inside the file that we just opened (pci_ids.h), scroll down to line 1308 There you’ll find something that looks like:

define PCI_SUBDEVICE_ID_CREATIVE_SB08801 0x0041

define PCI_SUBDEVICE_ID_CREATIVE_SB08802 0x0042

define PCI_SUBDEVICE_ID_CREATIVE_SB08803 0x0043

define PCI_SUBDEVICE_ID_CREATIVE_HENDRIX 0x6000

Under the like that has "0x0043" in the right column place this line which will tell Linux about our sound-card:

define PCI_SUBDEVICE_ID_CREATIVE_SB1270 0x0062

Save and close this file. Now onto some meaty patching and compiling! Let's get into the correct directory so that we build the modules properly. Assuming you're in the directory were we copies and extracted the linux-source code to:
cd linux-source-3.0.0/
Now for the all important patch and compile. First we copy the patch into the current directory (my default download directory is Downloads, so change it to wherever you downloaded the patch), apply it and only then do we compile:
cp ~/Downloads/ctxfi_kernel_3.0.0-14.patch ./
patch -p1 < ctxfi_kernel_3.0.0-14.patch
cd sound/pci/ctxfi/
make -C /usr/src/linux-headers-
uname -rM=pwdmodules
sudo make -C /usr/src/linux-headers-
uname -rM=pwdmodules_install
After compiling and doing the initial install, it's time to finalize, cleanup and install the new driver module permanently.
sudo depmod -a
sudo rmmod snd_ctxfi
sudo insmod /lib/modules/
uname -r/extra/snd-ctxfi.ko
sudo update-initramfs -u
A quick explanation of the code. First we reload the modules in general. Then remove the old useless snd_ctxfi module. Load in our newly built module and then by using update-initramfs -u we install it permanently into the (current) kernel. But wait! The fight isn't over yet! We need full surround sound AND digital goodness! Let's tackle surround first, open asound.conf:
gksu gedit /etc/asound.conf
You most likely don't have that file, that's ok. By opening it that way and then saving it, it'll be created. Now add the following code into asound.conf:
pcm.a52 {
@args [CARD]
@args.CARD {
type string
}
type rate
slave {
pcm {
type a52
bitrate 448
channels 6
card $CARD
}
rate 48000 #required somehow, otherwise nothing happens in PulseAudio
}
}
Alright, now it's time to get the digital and proper surround goodness. For this we'll use the A52 Alsa module which isn't build by default, we have we to do that ourselves:
cd ~/Downloads
apt-get source libasound2-plugins
cd alsa-plugins-*
./configure
make
cd a52/.libs
Some things changed since the previous versions of Ubuntu Linux, especially for ALSA and the CTXFI module so we have to first create the proper directory to put the plugin into. Only then can we copy it to the right place.
sudo mkdir /usr/lib/alsa-lib
sudo cp libasound_module_pcm_a52.la libasound_module_pcm_a52.so /usr/lib/alsa-lib/
sudo cp libasound_module_pcm_a52.so /usr/lib/
uname -i-linux-gnu/alsa-lib/
Time for the big finale! Let's reload alsa and pulseaudio!
sudo alsa reload
killall pulseaudio
After everything reloads (it takes a little while so be patient), try this and see if you the creative card:
aplay -l
If everything went correct you'll see things like this:
card 0: XFi [Creative X-Fi], device 1: ctxfi [Surround]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
What does that all mean? Well, it means we got sound! Open up your sound control panel thingy (select Sound Settings from the menu), click on the hardware tab and you should see: “X-Fi Titanium series [EMU20k2]” listed in there. Under ‘Profile’ (on the same tab) select the type of sound output you want. If you’re not using the digital cable (optical or coax) then select Analog sound options. You’ll have many choices, so pick the one that’s right for your setup. For me, the right choice is: “Digital Surround 5.1 (IEC958/AC3) Output + Analog Stereo Input”. Now open up Pandora, Amarok or whatever’s your fancy and enjoy your awesome Creative X-Fi Titanium card!

If this worked for you, let me know in the comments! If it didn’t let me know as well and I’ll see what I can do to help Sources:

http://www.piotrkrzyzek.com/creative-x-fi-titanium-5-1-digital-surround-on-ubuntu/ http://www.intervigil.net/sound-blaster-x-fi-titanium-hd-on-ubuntu-1110 https://wiki.ubuntu.com/KernelCustomBuild https://help.ubuntu.com/community/DigitalAC-3Pulseaudio