[comp.sys.dec] Hardware ID

bmc@sun1.MAYO.EDU (Bruce Cameron) (09/27/89)

This is a relatively simple question, but being new to DEC equipment I am
having trouble finding the answer. Is there a unique hardware ID for a
DECstation 3100 ? How do I access it? 

Please note that unique = non-software setable and that can be used to 
distinguish one 3100 from another. Thanks in advance. Please email replies
to:  bmc@bru.mayo.edu if the above address bounces.

--Bruce
----------------------------------------------------
Bruce M. Cameron                    bmc@bru.mayo.edu
Medical Sciences 1-14               (507) 284-3288
Mayo Foundation                     WD9CKW
Rochester, MN 55905
----------------------------------------------------

---------------------------------------------------------------------------------
The preceeding message has been brought to you by English(tm).
    --English(tm), the language of choice in much of the
      English speaking portions of the world.

alan@shodha.dec.com ( Alan's Home for Wayward Notes File.) (09/28/89)

In article <1671@nic.MR.NET>, bmc@sun1.MAYO.EDU (Bruce Cameron) writes:
>Is there a unique hardware ID for a DECstation 3100 ? 

	No.

>How do I access it? 

	But, if you really, REALLY want something close, you can use
	the Ethernet hardware address.  I've been led to believe that
	if you have a socket and use the right ioctl(2)'s you can get
	the hardware address.

	The address chip is socketed so it can be moved to a different
	CPU board if there is need to.

> 
> --Bruce
> ----------------------------------------------------
> Bruce M. Cameron                    bmc@bru.mayo.edu
-- 
Alan Rollow				alan@nabeth.enet.dec.com

gabriel@ldpmax.DEC.COM (Joe Gabriel) (09/29/89)

Here is a program that prints out my ethernet address on my DECstation 3100 running ULTRIX 3.1:


#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <net/if.h>

extern int errno;

main(ac, av)
    int ac;
    char *av [];
{
    int s;
    char *line = "------------------------------------";
    char device [IFNAMSIZ+1];

    /* structure used to query de and qe for physical addresses

        struct ifdevea {
            char    ifr_name[IFNAMSIZ];
            char    default_pa[6];
            char    current_pa[6];
        };
    */
    struct ifdevea hw_addr;

    s = socket (AF_INET, SOCK_DGRAM, 0);

    if (s < 0)  {
        perror ("socket:");
        exit (3);
    }

    if (ac > 1 && strlen (av [1]) <= IFNAMSIZ)
        strcpy (&hw_addr.ifr_name [0], av [1]);
    else    strcpy (&hw_addr.ifr_name [0], "se0");

    if (ioctl(s, SIOCRPHYSADDR, (caddr_t) &hw_addr) < 0) {
        perror ("ioctl: SIOCRPHYSADDR");
        close(s);
        exit (1);
    }

    printf ("\n%s\n", line);
    printf ("addresses for %s :\n", &hw_addr.ifr_name [0]);
    printf ("%s\n", line);
    print_addr ("hardware-address", &hw_addr.default_pa [0]);
    print_addr ("current-address ", &hw_addr.current_pa [0]);
    printf ("%s\n", line);
    close(s);
}

print_addr (what, ether_addr)
    char *what, *ether_addr;
    {
    printf ("%s = %02x-%02x-%02x-%02x-%02x-%02x\n", what,
                ether_addr [0] & 0xff,
                ether_addr [1] & 0xff,
                ether_addr [2] & 0xff,
                ether_addr [3] & 0xff,
                ether_addr [4] & 0xff,
                ether_addr [5] & 0xff);
    }






+*********************************************************+
|                             |                           |
| Joe Gabriel                 |  Digital Equipment Corp.  |
| Laboratory Data Prodcuts    |  Technical Consulting     |
| Four Results Way            |  Marlboro, MA 01752-9122  |
| gabriel@ldpmax.enet.dec.com |    (508) 467-5055         |
|                             |                           |
|                  % ls -l disclaimer                     |
|  Jan 01 00:00 disclaimer -> standard/one/we/always/see  |
|                                                         |
+*********************************************************+

bmc@sun1.MAYO.EDU (Bruce Cameron) (10/04/89)

I would like to thank all who helped me out with my 3100 hardware ID problem.
I received many thoughtful and helpful suggestions, code and code fragments.
The general opinion was that I should use the ethernet address for the machine
as the ID.

--Bruce

---------------------------------------------------------------------------------
The preceeding message has been brought to you by English(tm).
    --English(tm), the language of choice in much of the
      English speaking portions of the world.

steved@longs.LANCE.ColoState.Edu (Steve Dempsey) (10/04/89)

In article <477@ryn.esg.dec.com>, gabriel@ldpmax.DEC.COM (Joe Gabriel) writes:

> Here is a program that prints out my ethernet address on my DECstation
> 3100 running ULTRIX 3.1:

[program deleted]

This also works under Ultrix 3.0 & 3.1 on VS2000 using se device, and
on MVII, 3600, and 3200 using DELQA as qe device.  Thanks, Joe!


> | Joe Gabriel                 |  Digital Equipment Corp.  |
> | Laboratory Data Prodcuts    |  Technical Consulting     |
> | gabriel@ldpmax.enet.dec.com |    (508) 467-5055         |


        Steve Dempsey,  Center for Computer Assisted Engineering
  Colorado State University, Fort Collins, CO  80523    +1 303 491 0630
INET: steved@longs.LANCE.ColoState.Edu, dempsey@handel.CS.ColoState.Edu
UUCP: boulder!ccncsu!longs.LANCE.ColoState.Edu!steved, ...!ncar!handel!dempsey