linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [sparc] Weird ioctl() bug in 2.2.19 (fwd)
@ 2001-10-31 10:41 Alex Buell
  2001-10-31 17:29 ` David S. Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Buell @ 2001-10-31 10:41 UTC (permalink / raw)
  To: Mailing List - Linux Kernel

Right now I'm looking into why SNDCTL_DSP_SETFMT is failing on 2.2.19
sparc. I've been trying to get ESD to work on my SS20 box so I can play
music.

The situation is that the ioctl() is failing with -EINVAL for a perfectly
valid argument.

Here's the strace output from running ESD (snipped for brevity)

open("/dev/dsp", O_WRONLY)              = 3
ioctl(3, 0x6004500a, 0xefffe944)        = 0
write(1, "DEBUG: 60045005\n", 16DEBUG: 60045005)       = 16
write(1, "DEBUG: 00000010\n", 16DEBUG: 00000010)       = 16
ioctl(3, 0x60045005, 0xefffe944)        = -1 EINVAL (Invalid argument)

The debug statements I put in ESD shows the right argument with the right
value is being passed by the ioctl() call. 0x00000010 is AFTM_S16_BE, by
the way.

I've had a look at audio.c in /drivers/sbus/audio (lines 1046 to 1144),
and everything looks correct, down to the parameters, so why is it
returning -EINVAL?

Weird. Any ideas?

-- 
Top posters will be automatically killfiled.

http://www.tahallah.demon.co.uk


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [sparc] Weird ioctl() bug in 2.2.19 (fwd)
  2001-10-31 10:41 [sparc] Weird ioctl() bug in 2.2.19 (fwd) Alex Buell
@ 2001-10-31 17:29 ` David S. Miller
  2001-10-31 18:28   ` Alex Buell
  2001-10-31 18:32   ` David S. Miller
  0 siblings, 2 replies; 11+ messages in thread
From: David S. Miller @ 2001-10-31 17:29 UTC (permalink / raw)
  To: alex.buell; +Cc: linux-kernel

   From: Alex Buell <alex.buell@tahallah.demon.co.uk>
   Date: Wed, 31 Oct 2001 10:41:29 +0000 (GMT)

   Weird. Any ideas?
   
step 1:

  cp src/linux/include/linux/soundcard.h /usr/include/linux/soundcard.h

step 2:

  recompile your apps

Franks a lot,
David S. Miller
davem@redhat.com


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [sparc] Weird ioctl() bug in 2.2.19 (fwd)
  2001-10-31 17:29 ` David S. Miller
@ 2001-10-31 18:28   ` Alex Buell
  2001-10-31 18:32   ` David S. Miller
  1 sibling, 0 replies; 11+ messages in thread
From: Alex Buell @ 2001-10-31 18:28 UTC (permalink / raw)
  To: David S. Miller; +Cc: Mailing List - Linux Kernel

On Wed, 31 Oct 2001, David S. Miller wrote:

>   cp src/linux/include/linux/soundcard.h /usr/include/linux/soundcard.h

Unfortunately, these files are identical, which is why it is so strange!

-- 
Come the revolution, humourless gits'll be first up against the wall.

http://www.tahallah.demon.co.uk


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [sparc] Weird ioctl() bug in 2.2.19 (fwd)
  2001-10-31 17:29 ` David S. Miller
  2001-10-31 18:28   ` Alex Buell
@ 2001-10-31 18:32   ` David S. Miller
  2001-10-31 20:00     ` Alex Buell
  2001-11-01  3:52     ` Paul Mackerras
  1 sibling, 2 replies; 11+ messages in thread
From: David S. Miller @ 2001-10-31 18:32 UTC (permalink / raw)
  To: alex.buell; +Cc: linux-kernel

   From: Alex Buell <alex.buell@tahallah.demon.co.uk>
   Date: Wed, 31 Oct 2001 18:28:28 +0000 (GMT)

   On Wed, 31 Oct 2001, David S. Miller wrote:
   
   >   cp src/linux/include/linux/soundcard.h /usr/include/linux/soundcard.h
   
   Unfortunately, these files are identical, which is why it is so strange!

I'm pretty sure the ioctl numbers are wrong, and that is what
is causing the problem.

Print out from your app the ioctl number it uses (you've done
this already) and have the kernel do similar.  If they are different
you know that at least I was on the right track.

It's easy to figure out some value in the kernel without even
rebooting, just add to like some source file:

int foo = IOCTL_VALUE_I_WANT;

Then do "make drivers/sbus/audio/whatever.s"
and look at the assembler file for the value it
ended up using :-)

Franks a lot,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [sparc] Weird ioctl() bug in 2.2.19 (fwd)
  2001-10-31 18:32   ` David S. Miller
@ 2001-10-31 20:00     ` Alex Buell
  2001-11-01  3:52     ` Paul Mackerras
  1 sibling, 0 replies; 11+ messages in thread
From: Alex Buell @ 2001-10-31 20:00 UTC (permalink / raw)
  To: David S. Miller; +Cc: alex.buell, linux-kernel

On Wed, 31 Oct 2001, David S. Miller wrote:

> I'm pretty sure the ioctl numbers are wrong, and that is what is
> causing the problem.

No, the ioctl numbers are correct, it's ESD that's fscked.

    /* set the sound driver audio format for playback */
#if defined(__powerpc__)
    value = test = ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16 )
        ? /* 16 bit */ AFMT_S16_NE : /* 8 bit */ AFMT_U8;
#else /* #if !defined(__powerpc__) */
    value = test = ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16 )
        ? /* 16 bit */ AFMT_S16_LE : /* 8 bit */ AFMT_U8;
#endif /* #if !defined(__powerpc__) */

<sarcasm>
This is such a lovely piece of code!
<sarcasm>

Anyway, I can fix it now by adding the appropriate AFMT_S16_BE statement
guarded by a #ifdef but this sucks. Thanks to Peter Jones who spotted this
one.

-- 
Come the revolution, humourless gits'll be first up against the wall.

http://www.tahallah.demon.co.uk


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [sparc] Weird ioctl() bug in 2.2.19 (fwd)
  2001-10-31 18:32   ` David S. Miller
  2001-10-31 20:00     ` Alex Buell
@ 2001-11-01  3:52     ` Paul Mackerras
  2001-11-01 13:19       ` Alex Buell
  1 sibling, 1 reply; 11+ messages in thread
From: Paul Mackerras @ 2001-11-01  3:52 UTC (permalink / raw)
  To: alex.buell; +Cc: David S. Miller, linux-kernel

Alex Buell writes:

> No, the ioctl numbers are correct, it's ESD that's fscked.
> 
>     /* set the sound driver audio format for playback */
> #if defined(__powerpc__)
>     value = test = ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16 )
>         ? /* 16 bit */ AFMT_S16_NE : /* 8 bit */ AFMT_U8;
> #else /* #if !defined(__powerpc__) */
>     value = test = ( (esd_audio_format & ESD_MASK_BITS) == ESD_BITS16 )
>         ? /* 16 bit */ AFMT_S16_LE : /* 8 bit */ AFMT_U8;
> #endif /* #if !defined(__powerpc__) */
> 
> <sarcasm>
> This is such a lovely piece of code!
> <sarcasm>

Indeed...

> Anyway, I can fix it now by adding the appropriate AFMT_S16_BE statement
> guarded by a #ifdef but this sucks. Thanks to Peter Jones who spotted this
> one.

Why can't you just use AFMT_S16_NE on all platforms?  That is supposed
to be equal to AFMT_S16_BE on big-endian platforms and to AFMT_S16_LE
on little-endian platforms.  NE == native endian.

Paul.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [sparc] Weird ioctl() bug in 2.2.19 (fwd)
  2001-11-01  3:52     ` Paul Mackerras
@ 2001-11-01 13:19       ` Alex Buell
  2001-11-01 16:00         ` Peter Jones
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Buell @ 2001-11-01 13:19 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Mailing List - Linux Kernel

On Thu, 1 Nov 2001, Paul Mackerras wrote:

> > Anyway, I can fix it now by adding the appropriate AFMT_S16_BE statement
> > guarded by a #ifdef but this sucks. Thanks to Peter Jones who spotted this
> > one.
>
> Why can't you just use AFMT_S16_NE on all platforms?  That is supposed
> to be equal to AFMT_S16_BE on big-endian platforms and to AFMT_S16_LE
> on little-endian platforms.  NE == native endian.

Ah, is that what it does. OK, I'll carefully suggest to the authors of ESD
(preferably with a blunt trauma instrument) using AFMT_S16_NE. Thanks.

-- 
Come the revolution, humourless gits'll be first up against the wall.

http://www.tahallah.demon.co.uk


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [sparc] Weird ioctl() bug in 2.2.19 (fwd)
  2001-11-01 13:19       ` Alex Buell
@ 2001-11-01 16:00         ` Peter Jones
  2001-11-01 16:21           ` Alex Buell
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Jones @ 2001-11-01 16:00 UTC (permalink / raw)
  To: Alex Buell; +Cc: Paul Mackerras, Mailing List - Linux Kernel

On Thu, 1 Nov 2001, Alex Buell wrote:

> On Thu, 1 Nov 2001, Paul Mackerras wrote:
> 
> > > Anyway, I can fix it now by adding the appropriate AFMT_S16_BE statement
> > > guarded by a #ifdef but this sucks. Thanks to Peter Jones who spotted this
> > > one.
> >
> > Why can't you just use AFMT_S16_NE on all platforms?  That is supposed
> > to be equal to AFMT_S16_BE on big-endian platforms and to AFMT_S16_LE
> > on little-endian platforms.  NE == native endian.
> 
> Ah, is that what it does. OK, I'll carefully suggest to the authors of ESD
> (preferably with a blunt trauma instrument) using AFMT_S16_NE. Thanks.

It should probably be mentioned that you're using a really old version of 
ESD, and that they've at least made it so that you'll get the right one 
for any BE machine.  NE is still the better answer though -- now their 
configure script figures out BE/LE, and it'll build wrong if you're 
crosscompiling.

-- 
        Peter

"Don't everyone thank me at once!"
		-- Solo


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [sparc] Weird ioctl() bug in 2.2.19 (fwd)
  2001-11-01 16:00         ` Peter Jones
@ 2001-11-01 16:21           ` Alex Buell
  2001-11-01 16:27             ` Peter Jones
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Buell @ 2001-11-01 16:21 UTC (permalink / raw)
  To: Peter Jones; +Cc: Alex Buell, Paul Mackerras, Mailing List - Linux Kernel

On Thu, 1 Nov 2001, Peter Jones wrote:

> > Ah, is that what it does. OK, I'll carefully suggest to the authors of ESD
> > (preferably with a blunt trauma instrument) using AFMT_S16_NE. Thanks.

> It should probably be mentioned that you're using a really old version
> of ESD, and that they've at least made it so that you'll get the right
> one for any BE machine.  NE is still the better answer though -- now
> their configure script figures out BE/LE, and it'll build wrong if
> you're crosscompiling.

But this version I'm using is esound-2.2.8, which came from www.gnome.org!
I suppose I'll have to grab it from their CVS server.

-- 
Come the revolution, humourless gits'll be first up against the wall.

http://www.tahallah.demon.co.uk


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [sparc] Weird ioctl() bug in 2.2.19 (fwd)
  2001-11-01 16:21           ` Alex Buell
@ 2001-11-01 16:27             ` Peter Jones
  2001-11-01 19:28               ` Alex Buell
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Jones @ 2001-11-01 16:27 UTC (permalink / raw)
  To: Alex Buell; +Cc: Paul Mackerras, Mailing List - Linux Kernel

On Thu, 1 Nov 2001, Alex Buell wrote:

> On Thu, 1 Nov 2001, Peter Jones wrote:
> 
> > > Ah, is that what it does. OK, I'll carefully suggest to the authors of ESD
> > > (preferably with a blunt trauma instrument) using AFMT_S16_NE. Thanks.
> 
> > It should probably be mentioned that you're using a really old version
> > of ESD, and that they've at least made it so that you'll get the right
> > one for any BE machine.  NE is still the better answer though -- now
> > their configure script figures out BE/LE, and it'll build wrong if
> > you're crosscompiling.
> 
> But this version I'm using is esound-2.2.8, which came from www.gnome.org!
> I suppose I'll have to grab it from their CVS server.

Oh, I'm sorry.  You said "2.8" last time and I assumed you meant 0.2.8.  
How interesting...

In any event, the answer is "use _NE", I think.

-- 
        Peter

"We all enter this world in the same way: naked; screaming; soaked in
blood.  But if you live your life right, that kind of thing doesn't have
to stop there."
		-- Dana Gould


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [sparc] Weird ioctl() bug in 2.2.19 (fwd)
  2001-11-01 16:27             ` Peter Jones
@ 2001-11-01 19:28               ` Alex Buell
  0 siblings, 0 replies; 11+ messages in thread
From: Alex Buell @ 2001-11-01 19:28 UTC (permalink / raw)
  To: Peter Jones; +Cc: Mailing List - Linux Kernel

On Thu, 1 Nov 2001, Peter Jones wrote:

> Oh, I'm sorry.  You said "2.8" last time and I assumed you meant
> 0.2.8.  How interesting...

No, you're right, it's 0.2.8. Slip of the fingers..

> In any event, the answer is "use _NE", I think.

Yep. Thanks.

-- 
Come the revolution, humourless gits'll be first up against the wall.

http://www.tahallah.demon.co.uk


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2001-11-01 19:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-31 10:41 [sparc] Weird ioctl() bug in 2.2.19 (fwd) Alex Buell
2001-10-31 17:29 ` David S. Miller
2001-10-31 18:28   ` Alex Buell
2001-10-31 18:32   ` David S. Miller
2001-10-31 20:00     ` Alex Buell
2001-11-01  3:52     ` Paul Mackerras
2001-11-01 13:19       ` Alex Buell
2001-11-01 16:00         ` Peter Jones
2001-11-01 16:21           ` Alex Buell
2001-11-01 16:27             ` Peter Jones
2001-11-01 19:28               ` Alex Buell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).