[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#253568: marked as done (soundcard.h: AFMT_S16_NE is little endian on HPPA, should be big endian)



Your message dated Thu, 07 Jul 2005 13:49:16 +0900
with message-id <81u0j75igj.wl@omega.webmasters.gr.jp>
and subject line Closing bugs that was tagged as fixed-in-experimental
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 10 Jun 2004 03:58:42 +0000
>From sdbrady@ntlworld.com Wed Jun 09 20:58:42 2004
Return-path: <sdbrady@ntlworld.com>
Received: from mta07-svc.ntlworld.com [62.253.162.47] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1BYGiA-0001Qz-00; Wed, 09 Jun 2004 20:58:42 -0700
Received: from 1986u10.arrow ([81.105.244.35]) by mta07-svc.ntlworld.com
          (InterMail vM.4.01.03.37 201-229-121-137-20020806) with ESMTP
          id <20040610035823.UQUP5696.mta07-svc.ntlworld.com@1986u10.arrow>;
          Thu, 10 Jun 2004 04:58:23 +0100
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Stuart Brady <sdbrady@ntlworld.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: soundcard.h: AFMT_S16_NE is little endian on HPPA, should be big endian
Bcc: Stuart Brady <sdbrady@ntlworld.com>
X-Mailer: reportbug 2.60
Date: Wed, 09 Jun 2004 07:42:26 +0100
Message-Id: <20040610035823.UQUP5696.mta07-svc.ntlworld.com@1986u10.arrow>
Delivered-To: submit@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-7.3 required=4.0 tests=BAYES_00,DATE_IN_PAST_12_24,
	HAS_PACKAGE autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 

Package: linux-kernel-headers
Version: 2.5.999-test7-bk-15
Severity: normal
Tags: patch

On HPPA, <sys/soundcard.h> defines AFMT_S16_NE (the "native"-endian
sound format) as AFMT_S16_LE (little-endian), but it should be defined
as AFMT_S16_BE (big-endian).  Due to the removal of a workaround for
this in HPPA's "harmony" driver, many packages that use AFMT_S16_NE will
no longer work under HPPA (using recent parisc-linux.org kernels).

To demonstrate this:

#include <stdio.h>
#include <sys/soundcard.h>

int main()
{
        printf("AFMT_S16_NE: %i\n"
	       "AFMT_S16_BE: %i\n"
	       "AFMT_S16_LE: %i\n", AFMT_S16_NE, AFMT_S16_BE, AFMT_S16_LE);
	return 0;
}

On big-endian machines (such as HPPA), this should print:

AFMT_S16_NE: 32
AFMT_S16_BE: 32
AFMT_S16_LE: 16

On little-endian machines (x86), this should print:

AFMT_S16_NE: 16
AFMT_S16_BE: 32
AFMT_S16_LE: 16

Currently, the "little-endian" output is printed on HPPA.  PowerPC may
also be affected if the -ansi flag is used, but I cannot test this.

Here is a possible patch:

--- /usr/include/linux/soundcard.h.orig	2004-06-08 19:24:47.000000000 +0100
+++ /usr/include/linux/soundcard.h	2004-06-08 19:35:25.000000000 +0100
@@ -39,6 +39,13 @@
 /* In Linux we need to be prepared for cross compiling */
 #include <linux/ioctl.h>
 
+/* Endian macros. Note that they have a different meaning in the kernel. */
+#ifdef __KERNEL__
+#  include <asm/byteorder.h>
+#else
+#  include <endian.h>
+#endif
+
 /*
  *	Supported card ID numbers (Should be somewhere else?)
  */
@@ -179,13 +186,26 @@
  * Some big endian/little endian handling macros
  */
 
-#if defined(_AIX) || defined(AIX) || defined(sparc) || defined(__sparc__) || defined(HPPA) || defined(PPC) || defined(__mc68000__)
-/* Big endian machines */
-#  define _PATCHKEY(id) (0xfd00|id)
-#  define AFMT_S16_NE AFMT_S16_BE
-#else
-#  define _PATCHKEY(id) ((id<<8)|0xfd)
-#  define AFMT_S16_NE AFMT_S16_LE
+#if defined(__KERNEL__)
+#  if defined(__BIG_ENDIAN)
+#    define AFMT_S16_NE AFMT_S16_BE
+#    define _PATCHKEY(id) (0xfd00|id)
+#  elif defined(__LITTLE_ENDIAN)
+#    define AFMT_S16_NE AFMT_S16_LE
+#    define _PATCHKEY(id) ((id<<8)|0x00fd)
+#  else
+#    error failed to determine byte order
+#  endif
+#else
+#  if __BYTE_ORDER == __BIG_ENDIAN
+#    define AFMT_S16_NE AFMT_S16_BE
+#    define _PATCHKEY(id) (0xfd00|id)
+#  elif __BYTE_ORDER == __LITTLE_ENDIAN
+#    define AFMT_S16_NE AFMT_S16_LE
+#    define _PATCHKEY(id) ((id<<8)|0xfd)
+#  else
+#    error failed to determine byte order
+#  endif
 #endif
 
 /*

I'm not sure about the #error bits.

The quick fix would be to add __hppa__ and __powerpc__ to the list of
big-endian platforms, but then there are others missing from the list.

--- /usr/include/linux/soundcard.h.orig	2004-06-08 19:11:00.000000000 +0100
+++ /usr/include/linux/soundcard.h	2004-06-08 19:18:34.000000000 +0100
@@ -179,7 +179,7 @@
  * Some big endian/little endian handling macros
  */
 
-#if defined(_AIX) || defined(AIX) || defined(sparc) || defined(__sparc__) || defined(HPPA) || defined(PPC) || defined(__mc68000__)
+#if defined(_AIX) || defined(AIX) || defined(sparc) || defined(__sparc__) || defined(HPPA) || defined(__hppa__) || defined(PPC) || defined(__powerpc__) || defined(__mc68000__)
 /* Big endian machines */
 #  define _PATCHKEY(id) (0xfd00|id)
 #  define AFMT_S16_NE AFMT_S16_BE

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: hppa (parisc)
Kernel: Linux 2.4.26-pa4-0
Locale: LANG=C, LC_CTYPE=C (ignored: LC_ALL set to en_GB)

-- no debconf information

---------------------------------------
Received: (at 253568-done) by bugs.debian.org; 7 Jul 2005 04:49:23 +0000
>From gotom@debian.or.jp Wed Jul 06 21:49:23 2005
Return-path: <gotom@debian.or.jp>
Received: from omega.webmasters.gr.jp (webmasters.gr.jp) [218.44.239.78] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1DqOK7-0006NN-00; Wed, 06 Jul 2005 21:49:19 -0700
Received: from omega.webmasters.gr.jp (localhost [127.0.0.1])
	by webmasters.gr.jp (Postfix) with ESMTP
	id 5F0A1DEB3C; Thu,  7 Jul 2005 13:49:16 +0900 (JST)
Date: Thu, 07 Jul 2005 13:49:16 +0900
Message-ID: <81u0j75igj.wl@omega.webmasters.gr.jp>
From: GOTO Masanori <gotom@debian.org>
To: 266115-done@bugs.debian.org, 253568-done@bugs.debian.org,
	263348-done@bugs.debian.org, 301073-done@bugs.debian.org,
	302478-done@bugs.debian.org, 271355-done@bugs.debian.org,
	290212-done@bugs.debian.org, 268078-done@bugs.debian.org,
	283597-done@bugs.debian.org
Cc: GOTO Masanori <gotom@debian.org>
Subject: Closing bugs that was tagged as fixed-in-experimental
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
 FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: 253568-done@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-3.0 required=4.0 tests=BAYES_00 autolearn=no 
	version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

I duploaded linux-kernel-headers 2.6.12.0-1 into unstable, so that
I've closed bugs now as follows:

  266115, 253568, 263348, 301073, 302478, 271355, 290212, 268078, 283597

These bugs were already fixed, they were tagged as
fixed-in-experimental.  If you still have any problems, please report
your problem and reopen it again.

Regards,
-- gotom



Reply to: