<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I programmatically get the hardware address for a SCSI device? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166026#M903500</link>
    <description>Hi Philip,&lt;BR /&gt;&lt;BR /&gt;Those functions are defined in an internal lib&lt;BR /&gt;libIO.a which is not delivered.&lt;BR /&gt;&lt;BR /&gt;really the only supportable way to do it is still to use lssf&lt;BR /&gt;&lt;BR /&gt;In ioparms.h there is a &lt;BR /&gt;#ifdef _KERNEL&lt;BR /&gt;around the function proto. Which means those functions there a prototyped for kernel functions.</description>
    <pubDate>Sat, 17 Jan 2004 17:23:06 GMT</pubDate>
    <dc:creator>Laurent Menase</dc:creator>
    <dc:date>2004-01-17T17:23:06Z</dc:date>
    <item>
      <title>How do I programmatically get the hardware address for a SCSI device?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166017#M903491</link>
      <description>I have a C++ program that obtains information about all the SCSI devices installed on a given 11.x server. However, I need to obtain the physical hardware address for a given device using C/C++. Now, I am not referring to using CSTM or ioscan, I am looking for a method of getting the physical hardware address ( i.e. 10/0/14/0.0.0 ) from the device name ( i.e. /dev/rdsk/c0t0d0 ) using C/C++.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance to all that reply.&lt;BR /&gt;&lt;BR /&gt;Philip A. Reyniers</description>
      <pubDate>Thu, 15 Jan 2004 22:30:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166017#M903491</guid>
      <dc:creator>Philip A. Reyniers</dc:creator>
      <dc:date>2004-01-15T22:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I programmatically get the hardware address for a SCSI device?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166018#M903492</link>
      <description>Philip,&lt;BR /&gt; &lt;BR /&gt;tools like ioscan use the config driver (/dev/config) to obtain that kind of information. I'm afraid this API is not disclosed for general use.&lt;BR /&gt; &lt;BR /&gt;Sorry...&lt;BR /&gt;Dietmar.&lt;BR /&gt; &lt;BR /&gt;PS.: Maybe you should open a support call to get confirmation for this.</description>
      <pubDate>Fri, 16 Jan 2004 03:44:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166018#M903492</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2004-01-16T03:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I programmatically get the hardware address for a SCSI device?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166019#M903493</link>
      <description>Hi Philip,&lt;BR /&gt;&lt;BR /&gt;The best way to do it is a&lt;BR /&gt;&lt;BR /&gt;#define BUFSZ 1024&lt;BR /&gt;int p[2];&lt;BR /&gt;char command[256];&lt;BR /&gt;char buf[BUFSZ];&lt;BR /&gt;int res;&lt;BR /&gt;FILE *f;&lt;BR /&gt;sprintf(command,"/usr/sbin/lssf %s 2&amp;gt;/dev/null",devfile);&lt;BR /&gt;f=popen(command,"r");&lt;BR /&gt;if (!f)&lt;BR /&gt;{&lt;BR /&gt;  perror("popen");&lt;BR /&gt;}&lt;BR /&gt;  if(fgets(buf,BUFSZ,f)!=0) &lt;BR /&gt;  {&lt;BR /&gt;     char *p,*q;&lt;BR /&gt;     p=strstr(buf,"address");&lt;BR /&gt;     if(p) p=strchr(p,' ');&lt;BR /&gt;     if(p) q=strchr(++p,' ');&lt;BR /&gt;     if(q) *q=0;&lt;BR /&gt;      &lt;BR /&gt;    printf("%s\n",p);&lt;BR /&gt;  } else &lt;BR /&gt;  {&lt;BR /&gt;     buf[0]=0;&lt;BR /&gt;     if(ferror(f)) perror("fread");&lt;BR /&gt;     else printf("nosuchdev?\n");&lt;BR /&gt;     return -1&lt;BR /&gt;  }&lt;BR /&gt;   pclose(f);&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Jan 2004 06:46:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166019#M903493</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2004-01-16T06:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I programmatically get the hardware address for a SCSI device?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166020#M903494</link>
      <description>Attached is something that might help</description>
      <pubDate>Fri, 16 Jan 2004 07:00:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166020#M903494</guid>
      <dc:creator>Steve Shoecraft</dc:creator>
      <dc:date>2004-01-16T07:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I programmatically get the hardware address for a SCSI device?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166021#M903495</link>
      <description>Steve,&lt;BR /&gt;&lt;BR /&gt;Looking at souce you listed, I see that ioparmams.h has the following structure listed as such:&lt;BR /&gt;&lt;BR /&gt;****************CODE LISTING****************&lt;BR /&gt;typedef struct ioconfig {&lt;BR /&gt;    char      name[MAX_NAME_LEN];&lt;BR /&gt;    char      class[MAX_NAME_LEN];&lt;BR /&gt;    hw_path_t hw_path;&lt;BR /&gt;    int       instance;&lt;BR /&gt;} ioconfig_t;&lt;BR /&gt;***********STOP CODE LISTING****************&lt;BR /&gt;&lt;BR /&gt;However, class is trated as a C++ keyword and thus will not compile.  So, if I modify the source to the following:&lt;BR /&gt;&lt;BR /&gt;****************CODE LISTING****************&lt;BR /&gt;typedef struct ioconfig {&lt;BR /&gt;    char      name[MAX_NAME_LEN];&lt;BR /&gt;    char      dclass[MAX_NAME_LEN];&lt;BR /&gt;    hw_path_t hw_path;&lt;BR /&gt;    int       instance;&lt;BR /&gt;} ioconfig_t;&lt;BR /&gt;***********STOP CODE LISTING****************&lt;BR /&gt;&lt;BR /&gt;The following compiles but cores when trying to create the union ioconfig_record rec:&lt;BR /&gt;&lt;BR /&gt;****************CODE LISTING****************&lt;BR /&gt;#include &lt;CSTDLIB&gt;&lt;BR /&gt;#include &lt;IOSTREAM.H&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;STRING.H&gt;&lt;BR /&gt;#include "ioparams.h"&lt;BR /&gt;&lt;BR /&gt;int main( void ) {&lt;BR /&gt;  FILE *fp;&lt;BR /&gt;  union ioconfig_record rec;&lt;BR /&gt;  unsigned long magic;&lt;BR /&gt;  struct hw_path last_path;&lt;BR /&gt;  char hw_path[14], *p;&lt;BR /&gt;  int bytes, x;&lt;BR /&gt;&lt;BR /&gt;  cout &amp;lt;&amp;lt; "DEBUG" &amp;lt;&amp;lt; endl;&lt;BR /&gt;&lt;BR /&gt;  fp = fopen(IOCONFIG_FILE,"rb");&lt;BR /&gt;  if ( !fp ) {&lt;BR /&gt;    perror( "fopen" );&lt;BR /&gt;    exit(0);&lt;BR /&gt;  }&lt;BR /&gt;  fclose(fp);&lt;BR /&gt;}&lt;BR /&gt;***********STOP CODE LISTING****************&lt;BR /&gt;&lt;BR /&gt;Can you or anyone else provide some additional insight?&lt;BR /&gt;&lt;BR /&gt;As always, Thanks In Advance.&lt;BR /&gt;&lt;BR /&gt;Phil&lt;/STRING.H&gt;&lt;/SYS&gt;&lt;/STDIO.H&gt;&lt;/IOSTREAM.H&gt;&lt;/CSTDLIB&gt;</description>
      <pubDate>Fri, 16 Jan 2004 10:11:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166021#M903495</guid>
      <dc:creator>Philip A. Reyniers</dc:creator>
      <dc:date>2004-01-16T10:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I programmatically get the hardware address for a SCSI device?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166022#M903496</link>
      <description>try using lssf&lt;BR /&gt;&lt;BR /&gt;lssf /dev/dsk/c6t4d0&lt;BR /&gt;sdisk card instance 6 SCSI target 4 SCSI LUN 0 section 0 at address 0/8/0/0.1.27.0.0.4.0 /dev/dsk/c6t4d0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Jan 2004 11:02:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166022#M903496</guid>
      <dc:creator>Martha Mueller</dc:creator>
      <dc:date>2004-01-16T11:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I programmatically get the hardware address for a SCSI device?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166023#M903497</link>
      <description>Phil,&lt;BR /&gt; &lt;BR /&gt;I hope you've seen the comment in ioparams.h... :)&lt;BR /&gt; &lt;BR /&gt;NOTE:&lt;BR /&gt;This header file contains information specific to the internals of the HP-UX implementation.  The contents of this header file are subject to change without notice.  Such changes may affect source code, object code, or binary compatibility between releases of HP-UX.  Code which uses the symbols contained within this header file is inherently non-portable (even between HP-UX implementations).&lt;BR /&gt; &lt;BR /&gt;Best regards...&lt;BR /&gt;Dietmar.</description>
      <pubDate>Fri, 16 Jan 2004 11:29:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166023#M903497</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2004-01-16T11:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I programmatically get the hardware address for a SCSI device?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166024#M903498</link>
      <description>Phil,&lt;BR /&gt;&lt;BR /&gt;Just enclose your include for ioparms as an extern "C".  This seems to work fine:&lt;BR /&gt;&lt;BR /&gt;#ifdef __cplusplus&lt;BR /&gt;#define class ioclass&lt;BR /&gt;extern "C" {&lt;BR /&gt;#endif&lt;BR /&gt;#include "/usr/conf/io/ioparams.h"&lt;BR /&gt;#ifdef __cplusplus&lt;BR /&gt;};&lt;BR /&gt;#endif&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Jan 2004 20:35:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166024#M903498</guid>
      <dc:creator>Steve Shoecraft</dc:creator>
      <dc:date>2004-01-16T20:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I programmatically get the hardware address for a SCSI device?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166025#M903499</link>
      <description>Steve and other available members,&lt;BR /&gt;&lt;BR /&gt;I would like to start out by thanking you and the others that have replied to this question.  All have provided solid direction and great snips of code.&lt;BR /&gt;&lt;BR /&gt;There is a lot of information to gleem from these examples.  However, unless I am not seeing the entire picture, it only appears to traverse the very top-level of hardware addresses.  With this said, I think I have just few more questions on the subject that I hope that you might be able to shed some light on.&lt;BR /&gt;&lt;BR /&gt;The ioparams.h include file procides some external (extern) functions:&lt;BR /&gt;&lt;BR /&gt;*****************CODE SNIP******************&lt;BR /&gt;void *io_search __(( void *token, int type, int qual, ...));&lt;BR /&gt;&lt;BR /&gt;void *io_search_array __(( void *token, int type, int qual, char *key[], void *dat[] ));&lt;BR /&gt;&lt;BR /&gt;int io_query __(( void *token, int type, char *key, void *ptr ));&lt;BR /&gt;&lt;BR /&gt;int io_get_key_info __(( int type, char *key, char *type_name, int *size ));&lt;BR /&gt;&lt;BR /&gt;************STOP CODE SNIP******************&lt;BR /&gt;&lt;BR /&gt;Do you know how these functions are used and can you provide an example?&lt;BR /&gt;&lt;BR /&gt;I have included the external functions into my source but have not figured out how they should be called.&lt;BR /&gt;&lt;BR /&gt;Thanks In Advance For Any All Assistance,&lt;BR /&gt;&lt;BR /&gt;Phil</description>
      <pubDate>Sat, 17 Jan 2004 11:52:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166025#M903499</guid>
      <dc:creator>Philip A. Reyniers</dc:creator>
      <dc:date>2004-01-17T11:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I programmatically get the hardware address for a SCSI device?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166026#M903500</link>
      <description>Hi Philip,&lt;BR /&gt;&lt;BR /&gt;Those functions are defined in an internal lib&lt;BR /&gt;libIO.a which is not delivered.&lt;BR /&gt;&lt;BR /&gt;really the only supportable way to do it is still to use lssf&lt;BR /&gt;&lt;BR /&gt;In ioparms.h there is a &lt;BR /&gt;#ifdef _KERNEL&lt;BR /&gt;around the function proto. Which means those functions there a prototyped for kernel functions.</description>
      <pubDate>Sat, 17 Jan 2004 17:23:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-do-i-programmatically-get-the-hardware-address-for-a-scsi/m-p/3166026#M903500</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2004-01-17T17:23:06Z</dc:date>
    </item>
  </channel>
</rss>

