Monday, 24 September 2007

Line6 PodXT Linux Driver 0.7.2 is incompatible with kernel >= 2.6.22

I have updated my Ubuntu Feisty to Gutsy some weeks ago because of a problem booting up from raid. Upgrade solved the issue but brought some others. One of the most serious to me was that the Linux Line6 PodXt driver
could not be compiled anymore. The error I got was:

make default

make -C /lib/modules/2.6.22-12-generic/build
SUBDIRS=/home/user1/workspace/line6usb-0.7.2 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.22-12-generic'
CC [M] /home/user1/workspace/line6usb-0.7.2/pcm.o
/home/user1/workspace/line6usb-0.7.2/pcm.c: In function
‘snd_pod_trigger’:
/home/user1/workspace/line6usb-0.7.2/pcm.c:40: warning: implicit
declaration of function ‘snd_pcm_group_for_each’
/home/user1/workspace/line6usb-0.7.2/pcm.c:40: error: expected ‘;’
before ‘{’ token
/home/user1/workspace/line6usb-0.7.2/pcm.c:33: warning: unused variable
‘err’
/home/user1/workspace/line6usb-0.7.2/pcm.c:32: warning: unused variable
‘s’
make[2]: *** [/home/user1/workspace/line6usb-0.7.2/pcm.o] Error 1
make[1]: Leaving directory `/usr/src/linux-headers-2.6.22-12-generic'
make[1]: *** [_module_/home/user1/workspace/line6usb-0.7.2] Error 2
make: *** [default] Error 2

So I investigated this a bit and found that some macro calls were obsoleted which is why pcm.c can not be compiled on 2.6.22 - actually neither on 2.6.21 and 2.6.20 is the latest working.
Fortunately this was very easy to correct this error. OK first I had to check kernel changelog and also Linux Cross Reference helped me a lot.
So here is the required modification in pcm.c of the driver to be able to compile the source again.

/* trigger callback */
int snd_pod_trigger(struct snd_pcm_substream *substream, int cmd)
{
struct snd_pod_pcm *chip = snd_pcm_substream_chip(substream);
struct list_head *pos;
struct snd_pcm_substream *s;
int err;
unsigned long flags;

printk(KERN_INFO "*** Entering snd_pod_trigger\n");
spin_lock_irqsave(&chip->lock_trigger, flags);
clear_bit(BIT_PREPARED, &chip->flags);

//snd_pcm_group_for_each(pos, substream) {
list_for_each(pos,&substream->group->substreams) {
//s = snd_pcm_group_substream_entry(pos);
s = list_entry(pos,struct snd_pcm_substream,link_list);

switch(s->stream) {
case SNDRV_PCM_STREAM_PLAYBACK:

Just change the lines so old ones are commented out and below are the new ones:

//snd_pcm_group_for_each(pos, substream) {
list_for_each(pos,&substream->group->substreams) {
//s = snd_pcm_group_substream_entry(pos);
s = list_entry(pos,struct snd_pcm_substream,link_list);


As soon as I have a bit more free time I will make a patch - a diff - to apply.

This error was reported via sourceforge and I am pretty sure we can see a corrected version soon officially from Marcus Grabner. But till then you can do it on your own easily.

P.S. : I would like to say thanks to Marcus Grabner for the driver.

[Update] The patch can be downloaded from here or from here. First save it into your home directory. Download the driver also into your home than execute the following commands (I suppose that line6usb-0.7.2.tar.bz2 and line6usb-0.7.2_patch.diff are saved into your home) :
$ cd ~
$ bzip2 -dc line6usb-0.7.2.tar.bz2 | tar xfv -
$ cd ~/line
6usb-0.7.2
$ patch -p1 <~/line6usb-0.7.2_patch.diff That is all. Hope it works.