Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Nov 1999 19:34:04 +0000 (GMT)
From:      Doug Rabson <dfr@nlsystems.com>
To:        "Daniel C. Sobral" <dcs@newsguy.com>
Cc:        current@freebsd.org
Subject:   Re: Adding soundcards to newpcm
Message-ID:  <Pine.BSF.4.10.9911161933000.318-100000@salmon.nlsystems.com>
In-Reply-To: <38319302.BCB574D8@newsguy.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 17 Nov 1999, Daniel C. Sobral wrote:

> Well, I finally decided to try to get my sound card working again.
> It is not detected as a PNP device, but rather as a motherboard
> resource using PNPBIOS. It is supposed to be an ESS1869 and, indeed,
> I use ESS drivers on Windows. But Compaq obviously decided to lay
> it's fingerprints on the poor thing. Here is the (relavant parts of)
> dmesg:
> 
> So, the question is... how do I get the logical identifier for it?
> pnpinfo doesn't show anything.

Use this program. It translates to/from EISAIDs.

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

int
main(int argc, char** argv)
{
    u_int32_t id;

    if (argc != 2)
	exit(1);

    if (!strncmp(argv[1], "0x", 2)) {
	    id = strtol(argv[1] + 2, NULL, 16);

#define B0(n)	(((n) >> 0) & 0xff)
#define B1(n)	(((n) >> 8) & 0xff)
#define B2(n)	(((n) >> 16) & 0xff)
#define B3(n)	(((n) >> 24) & 0xff)

	    printf("%c%c%c%02x%02x\n",
		   ((B0(id) & 0x7c) >> 2) + 64,
		   (((B0(id) & 0x03) << 3) | ((B1(id) & 0xe0) >> 5)) + 64,
		   (B1(id) & 0x1f) + 64, B2(id), B3(id));
    } else {
#define PNP_HEXTONUM(c)	((c) >= 'a'		\
			 ? (c) - 'a' + 10	\
			 : ((c) >= 'A'		\
			    ? (c) - 'A' + 10	\
			    : (c) - '0'))

#define PNP_EISAID(s)				\
	((((s[0] - '@') & 0x1f) << 2)		\
	 | (((s[1] - '@') & 0x18) >> 3)		\
	 | (((s[1] - '@') & 0x07) << 13)	\
	 | (((s[2] - '@') & 0x1f) << 8)		\
	 | (PNP_HEXTONUM(s[4]) << 16)		\
	 | (PNP_HEXTONUM(s[3]) << 20)		\
	 | (PNP_HEXTONUM(s[6]) << 24)		\
	 | (PNP_HEXTONUM(s[5]) << 28))

	    printf("0x%08x\n", PNP_EISAID(argv[1]));
    }

    return 0;
}


--
Doug Rabson				Mail:  dfr@nlsystems.com
Nonlinear Systems Ltd.			Phone: +44 181 442 9037




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9911161933000.318-100000>