[patch] little-endian dmasound silently fails
Brad Midgley
brad at turbolinux.com
Sat Feb 5 14:55:22 EST 2000
> How does it write "little-endian data"? Does the program take care of CPU
> being big-endian in some way? If not, I'd think it's the program's fault.
the api provides for a way for clients to set the driver to accept
little-endian data. worse than simply not implementing it, dmasound also
makes it *appear* that it implements it.
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/soundcard.h>
void die(char *m) {
printf("%s\n", m);
exit(1);
}
int main(int argc, char *argv[]) {
int fd, bytesex;
fd = open("/dev/dsp", O_WRONLY);
if(fd < 0) die("couldn't open /dev/dsp");
bytesex = AFMT_S16_LE;
if(ioctl(fd, SNDCTL_DSP_SETFMT, &bytesex))
die("little-endian sound isn't implemented in this driver\n");
printf("supposedly the sound driver supports little-endian data. :(\n");
return 0;
}
Brad
brad at turbolinux.com | http://www.turbolinux.com/~brad/
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev
mailing list