From 3cfed301d91ebf773ace89a02fea6db817426221 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 12 Aug 2006 16:01:40 +0000 Subject: print the device capabilities after opening the device git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1220 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/oss-util.c | 55 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-) (limited to 'src/modules') diff --git a/src/modules/oss-util.c b/src/modules/oss-util.c index feb1aadf..177322be 100644 --- a/src/modules/oss-util.c +++ b/src/modules/oss-util.c @@ -42,8 +42,13 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) { int fd = -1; + int caps; + assert(device && mode && (*mode == O_RDWR || *mode == O_RDONLY || *mode == O_WRONLY)); + if(!pcaps) + pcaps = ∩︀ + if (*mode == O_RDWR) { if ((fd = open(device, O_RDWR|O_NDELAY)) >= 0) { int dcaps, *tcaps; @@ -79,12 +84,52 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) { success: - if (pcaps) { - if (ioctl(fd, SNDCTL_DSP_GETCAPS, pcaps) < 0) { - pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s", pa_cstrerror(errno)); - goto fail; - } + *pcaps = 0; + + if (ioctl(fd, SNDCTL_DSP_GETCAPS, pcaps) < 0) { + pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s", pa_cstrerror(errno)); + goto fail; } + + pa_log_debug(__FILE__": capabilities:%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + *pcaps & DSP_CAP_BATCH ? " BATCH" : "", + *pcaps & DSP_CAP_BIND ? " BIND" : "", + *pcaps & DSP_CAP_COPROC ? " COPROC" : "", + *pcaps & DSP_CAP_DUPLEX ? " DUPLEX" : "", +#ifdef DSP_CAP_FREERATE + *pcaps & DSP_CAP_FREERATE ? " FREERATE" : "", +#else + "", +#endif +#ifdef DSP_CAP_INPUT + *pcaps & DSP_CAP_INPUT ? " INPUT" : "", +#else + "", +#endif + *pcaps & DSP_CAP_MMAP ? " MMAP" : "", +#ifdef DSP_CAP_MODEM + *pcaps & DSP_CAP_MODEM ? " MODEM" : "", +#else + "", +#endif + *pcaps & DSP_CAP_MULTI ? " MULTI" : "", +#ifdef DSP_CAP_OUTPUT + *pcaps & DSP_CAP_OUTPUT ? " OUTPUT" : "", +#else + "", +#endif + *pcaps & DSP_CAP_REALTIME ? " REALTIME" : "", +#ifdef DSP_CAP_SHADOW + *pcaps & DSP_CAP_SHADOW ? " SHADOW" : "", +#else + "", +#endif +#ifdef DSP_CAP_VIRTUAL + *pcaps & DSP_CAP_VIRTUAL ? " VIRTUAL" : "", +#else + "", +#endif + *pcaps & DSP_CAP_TRIGGER ? " TRIGGER" : ""); pa_fd_set_cloexec(fd, 1); -- cgit