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:  [EMAIL PROTECTED]
Nonlinear Systems Ltd.                  Phone: +44 181 442 9037




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to