Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!sdd.hp.com!hplabs!hpda!hpcuhb!hpcllla!hpclisp!hpclkms!ken From: ken@hpclkms.cup.hp.com (Ken Sumrall) Newsgroups: comp.sys.hp Subject: Re: read ID-MODULE series# Message-ID: <1340158@hpclkms.cup.hp.com> Date: 5 Feb 91 02:39:13 GMT References: <3104@unccvax.uncc.edu> Organization: Hewlett-Packard Calif. Language Lab Lines: 79 > Does anyone know how to read the series number of >a ID-MOUDLE (a HP-HIL device) by using C under Hp-UX 7.03. > I don't remember where I got this, but I typed it in from some manual. Here is some code to read the id module number. ============================================================================ #include #define BUF_SIZ 15 #define MAX_DEV '7' unsigned char dev_name[]={"/dev/hil1"}; main() { extern int errno; int index, hil_fd, product_no, serial_no, serial_hi, serial_lo; unsigned char hil_info[BUF_SIZ], product_let, country; while (dev_name[8] <= MAX_DEV) { printf("\n"); if ((hil_fd = open(dev_name,0)) > 0) { printf("%s -",dev_name); if(ioctl(hil_fd,HILID,hil_info)<0) printf("ioctl error %d\n",errno); else { for (index=0;index> 7) << 16; product_let = hil_info[3] & 0x7f; serial_no = hil_info[4] | hil_info[5] << 8 | hil_info[6] << 16 | (hil_info[7] & 0x3f) << 24; serial_hi = serial_no/100000; serial_lo = serial_no - serial_hi * 100000; country = hil_info[8] & 0x7f; printf(" product number = %u%c",product_no,product_let); printf(" serial number = %u%c%.5u\n",serial_hi,country,serial_lo); } } } close(hil_fd); } else printf("%s - open error: %d\n",dev_name, errno); ++ (dev_name[8]); } } ============================================================================= >Thank you. > Your welcome. >Wen-Shinag Chin > *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* * Ken Sumrall * * Internet: ken%hpda@hplabs.hp.com | UUCP: ...!hplabs!hpda!ken * * "I'd stomp desert dope heads for some gas in my moped!" - Bill the Cat * * "What a stupid world" -Calvin (speaking to Hobbes) * *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*