From: Stuart Brady <sdbrady@ntlworld.com>
To: parisc-linux@lists.parisc-linux.org
Subject: [parisc-linux] [PATCH] Harmony driver - Reject AFMT_S16_LE (Little Endian)
Date: Sun, 22 Feb 2004 09:20:57 +0000 [thread overview]
Message-ID: <20040222092057.GA2590@calypso> (raw)
Hello,
The OSS specification (http://www.opensound.com/pguide/oss.pdf -
page 33) states:
"It is very important to check that the value returned in the argument
after the [SNDCTL_DSP_SETFMT] ioctl call matches the requested format.
If the device doesn't support this particular format, it rejects the
call and returns another format that is supported by the hardware."
I would suggest the following change to the Harmony driver:
Index: harmony.c
===================================================================
RCS file: /var/cvs/linux-2.4/drivers/sound/harmony.c,v
retrieving revision 1.28
diff -u -r1.28 harmony.c
--- harmony.c 22 Jun 2002 09:05:59 -0000 1.28
+++ harmony.c 22 Feb 2004 05:35:46 -0000
@@ -641,14 +641,14 @@
switch (ival) {
case AFMT_MU_LAW: new_format = HARMONY_DF_8BIT_ULAW; break;
case AFMT_A_LAW: new_format = HARMONY_DF_8BIT_ALAW; break;
- case AFMT_S16_LE: /* fall through, but not really supported */
- case AFMT_S16_BE: new_format = HARMONY_DF_16BIT_LINEAR;
- ival = AFMT_S16_BE;
- break;
+ case AFMT_S16_BE: new_format = HARMONY_DF_16BIT_LINEAR; break;
default: {
DPRINTK(KERN_WARNING PFX
"unsupported sound format 0x%04x requested.\n",
ival);
+ ival = AFMT_S16_BE;
+ if (put_user(ival, (int *) arg))
+ return -EFAULT;
return -EINVAL;
}
}
Since mu-law and a-law aren't the most popular of formats, I think
AFMT_S16_BE (signed, 16-bit, big endian) is the best thing to return.
Some drivers don't seem to return a supported format in arg - I'm not
sure why. At the very least, I think -EINVAL should be returned, and the
format should not be set. (Unless of course, the driver actually _does_
the conversion - okay if I implement this?)
This change may break some apps. The soundcard.h fix might make a
significant difference. Anything else was writing big endian data using
a little endian format.
One question: are there any audio devices for hppa that need drivers,
that have documentation? I see that audio on the J5k/C3k is unsupported,
but there are apparently no docs for it. Audio on the 705 and 710 doesn't
seem supported either. Again, no docs AFAICS.
--
Stuart Brady
next reply other threads:[~2004-02-22 9:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-22 9:20 Stuart Brady [this message]
2004-02-22 10:30 ` [parisc-linux] [PATCH] Harmony driver - Reject AFMT_S16_LE (Little Endian) Stuart Brady
2004-02-22 16:25 ` [parisc-linux] ad1889 driver/docs for c3k/j5k audio Grant Grundler
2004-05-29 0:06 ` [parisc-linux] " Stuart Brady
2004-05-29 0:25 ` Randolph Chung
2004-02-23 3:56 ` [parisc-linux] [PATCH] Harmony driver - Reject AFMT_S16_LE & Implement SNDCTL_DSP_CHANNELS Stuart Brady
2004-05-11 5:24 ` Grant Grundler
2004-05-11 13:07 ` Matthew Wilcox
2004-05-11 14:39 ` [parisc-linux] [PATCH] Harmony driver - Reject AFMT_S16_LE &Implement SNDCTL_DSP_CHANNELS Paul
2004-05-23 23:42 ` [parisc-linux] [PATCH] Harmony driver - Reject AFMT_S16_LE & Implement SNDCTL_DSP_CHANNELS Stuart Brady
2004-05-24 17:30 ` Ruediger Scholz
[not found] ` <20040524081200.3d14256b.varenet@esiee.fr>
2004-05-25 20:43 ` [parisc-linux] [PATCH] Harmony - buffer underrun crash fix Stuart Brady
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040222092057.GA2590@calypso \
--to=sdbrady@ntlworld.com \
--cc=parisc-linux@lists.parisc-linux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox