Gmane
From: Christian Werner <chw <at> ch-werner.de>
Subject: Re: Re: [Familiar] h55xx headphone jack not usable
Newsgroups: gmane.comp.handhelds.linux.h5400, gmane.comp.handhelds.linux.familiar
Date: 2005-01-31 17:49:04 GMT (4 years, 21 weeks, 6 days, 19 hours and 19 minutes ago)
Michael Kropfberger wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Monday 31 January 2005 17:20, Jamey Hicks wrote:
> 
> > I cannot verify that the patch does what it intends by reading it, but
> > it looks OK so I applied it to CVS.  We'll need to build and upload new
> > kernel packages.
> 
> I wanted to use the precompiled module which was handed around, but I couldnt
> find out how to effectively switch the output to the headphones... just
> connecting a headphone didnt help...

#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/soundcard.h>

main()
{
    int fd, ret;

    fd = open("/dev/sound/dsp", O_RDWR);
    if (fd < 0) {
        perror("open");
        ret = fd;
    } else {
        ioctl(fd, SOUND_MIXER_WRITE_RECSRC, SOUND_MASK_LINE);
        if (ret < 0) perror("ioctl");
    }
    exit(ret < 0 ? 1 : 0);
}

Hope that works and helps,
Christian