Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jul 1997 15:44:55 -0400
From:      "Louis A. Mamakos" <louie@TransSys.COM>
To:        Amancio Hasty <hasty@rah.star-gate.com>
Cc:        multimedia@FreeBSD.ORG
Subject:   Re: ftp://rah.star-gate.com/pub/guspnp12.tar.gz 
Message-ID:  <199707261944.PAA00779@whizzo.TransSys.COM>
In-Reply-To: Your message of "Wed, 23 Jul 1997 19:40:57 PDT." <199707240240.TAA08628@rah.star-gate.com> 
References:  <199707240240.TAA08628@rah.star-gate.com> 

next in thread | previous in thread | raw e-mail | index | archive | help

I think that I may be on to why the 'mixer' command has stopped working.

When installing the new sound drivers, I've been replacing the soundcard.h
file with the on included in the sound driver distribution.  What I noticed
is that programs which worked before I recompiled them would stop working
after they were built.  Firing up gdb on old and new binaries, I see
that the ioctl() system call is being passed different commands.  Looking
at header files, I see:

#define	IOCPARM_MASK	0x7f		/* parameters must be < 128 bytes */
#define	IOC_VOID	0x00000000	/* no parameters */
#define	IOC_OUT		0x20000000	/* copy out parameters */
#define	IOC_IN		0x40000000	/* copy in parameters */
#define	IOC_INOUT	(IOC_IN|IOC_OUT)
/* the 0x20000000 is so we can distinguish new ioctl's from old */
#define	_IO(x,y)	((int)(IOC_VOID|(x<<8)|y))
#define	_IOR(x,y,t)	((int)(IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))
#define	_IOW(x,y,t)	((int)(IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))
/* this should be _IORW, but stdio got there first */
#define	_IOWR(x,y,t)	((int)(IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y))

in the soundcard.h file, but looking at /usr/include/sys/ioccom.h:


#define	IOCPARM_MASK	0x1fff		/* parameter length, at most 13 bits */
#define	IOCPARM_LEN(x)	(((x) >> 16) & IOCPARM_MASK)
#define	IOCBASECMD(x)	((x) & ~(IOCPARM_MASK << 16))
#define	IOCGROUP(x)	(((x) >> 8) & 0xff)

#define	IOCPARM_MAX	PAGE_SIZE		/* max size of ioctl, mult. of PAGE_SIZE */
#define	IOC_VOID	0x20000000	/* no parameters */
#define	IOC_OUT		0x40000000	/* copy out parameters */
#define	IOC_IN		0x80000000	/* copy in parameters */
#define	IOC_INOUT	(IOC_IN|IOC_OUT)
#define	IOC_DIRMASK	0xe0000000	/* mask for IN/OUT/VOID */

#define	_IOC(inout,group,num,len) \
	(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
#define	_IO(g,n)	_IOC(IOC_VOID,	(g), (n), 0)
#define	_IOR(g,n,t)	_IOC(IOC_OUT,	(g), (n), sizeof(t))
#define	_IOW(g,n,t)	_IOC(IOC_IN,	(g), (n), sizeof(t))
/* this should be _IORW, but stdio got there first */
#define	_IOWR(g,n,t)	_IOC(IOC_INOUT,	(g), (n), sizeof(t))

Notice how IOC_OUT, IOC_IN, IOC_VOID are different between the two.

I think that soundcard.h should just #include <sys/ioccom.h> if _IOR
isn't defined, rather than doing its own thing like this.  I'm going
to try rebuilding stuff with this change and see what happens.

louie






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707261944.PAA00779>