home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / ddx / ibm / skyway / skyProbe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-16  |  2.5 KB  |  86 lines

  1. /*
  2.  * $XConsortium: skyProbe.c,v 1.2 91/07/16 13:15:46 jap Exp $
  3.  *
  4.  * Copyright IBM Corporation 1987,1988,1989,1990,1991
  5.  *
  6.  * All Rights Reserved
  7.  *
  8.  * License to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted,
  10.  * provided that the above copyright notice appear in all copies and that
  11.  * both that copyright notice and this permission notice appear in
  12.  * supporting documentation, and that the name of IBM not be
  13.  * used in advertising or publicity pertaining to distribution of the
  14.  * software without specific, written prior permission.
  15.  *
  16.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND 
  18.  * NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL
  19.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  20.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23.  * SOFTWARE.
  24.  *
  25. */
  26.  
  27. /*
  28.  *  skyProbe.c - probe for display
  29.  *               copied from ibm/GAI/gaiOsd.c
  30.  */
  31.  
  32. #include "OSio.h"
  33.  
  34. #include <sys/hft.h>
  35. #include "hftUtils.h"
  36. #include "ibmTrace.h"
  37.  
  38. extern unsigned hftQueryCurrentDevice();
  39. extern void ibmInfoMsg() ;
  40. extern int hftQFD;
  41.  
  42. /* adapter number */
  43.  
  44. /* put this in          */
  45. /* #include "X_msg.h"        */
  46. /*      aixErrMsg(M_MSG_9); */
  47.  
  48. int
  49. skyProbe(atype, anumber)
  50.     /* adapter type (like HFT_SKYWAY_ID) */
  51.     unsigned  atype;
  52.     /* adapter number */
  53.     int  anumber;
  54. {
  55.     unsigned int  devid;
  56.     int  fd;
  57.  
  58.     TRACE(("skyProbe(atype=0x%x, anumber=%d)\n", atype, anumber)) ;
  59.  
  60. /**** added so that console can be used in debugging ****/
  61.     AIXDefaultDisplay= HFT_SKYWAY_ID;
  62.     TRACE(("AIXDefaultDisplay is %x\n",AIXDefaultDisplay)) ;
  63. /********************************************************/
  64.  
  65.     if ( (devid=hftHasAnAttachedNumber(atype,anumber)) ) {
  66.     ibmInfoMsg("Found an IBM Graphics Adapter \n");
  67.  
  68.     TRACE(("found Adp 0x%x number %d\n",devid, (devid & HFT_DEVNUM_MASK)));
  69.  
  70.     if( (fd=hftOpenOnDevice(devid)) < 0 ){
  71.         ibmInfoMsg("Couldn't open a HFTVT on an IBM Graphics Adapter\n");
  72.         return -1;
  73.     }
  74.     hftSetQFDOrNoHotkey(fd);
  75.     if( hftQFD == fd ){
  76.         AIXDefaultDisplay= devid;
  77.         TRACE(("AIXDefaultDisplay is %x\n",AIXDefaultDisplay)) ;
  78.     }
  79.     return fd;
  80.     }
  81.     else  {
  82.     ibmInfoMsg("Didn't find an IBM Graphics Adapter\n");
  83.     return -1;
  84.     }
  85. }
  86.