You can subscribe to this list here.
2004 |
Jan
(1) |
Feb
(1) |
Mar
(45) |
Apr
(2) |
May
(9) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Andr? L. A. <st...@us...> - 2004-03-24 22:33:04
|
Update of /cvsroot/uts/uts/src/cam/camfits.st7 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14643/src/cam/camfits.st7 Added Files: .cvsignore Log Message: ... --- NEW FILE: .cvsignore --- *.lo *.la .deps .libs Makefile Makefile.in aclocal.m4 autom4te.cache confdefs.h config.cache config.guess config.h config.h.in config.log config.status config.sub configure install-sh libtool ltconfig ltmain.sh missing mkinstalldirs stamp-h stamp-h1 stamp-h.in |
From: Andr? L. A. <st...@us...> - 2004-03-24 22:31:45
|
Update of /cvsroot/uts/uts/src/cam In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14358/src/cam Modified Files: Makefile.am Log Message: Trying to understand autoconf... Index: Makefile.am =================================================================== RCS file: /cvsroot/uts/uts/src/cam/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile.am 29 Jan 2004 03:02:34 -0000 1.1.1.1 --- Makefile.am 24 Mar 2004 22:21:03 -0000 1.2 *************** *** 1 **** ! SUBDIRS = etc camd camfits.fake camfits.st4 \ No newline at end of file --- 1 ---- ! SUBDIRS = etc camd camfits.fake camfits.st4 camfits.st7 |
From: Andr? L. A. <st...@us...> - 2004-03-24 22:31:45
|
Update of /cvsroot/uts/uts/src/cam/camfits.st7 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14358/src/cam/camfits.st7 Removed Files: Makefile.in Log Message: Trying to understand autoconf... --- Makefile.in DELETED --- |
From: Andr? L. A. <st...@us...> - 2004-03-18 19:40:00
|
Update of /cvsroot/uts/uts/src/cam/camfits.st7 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17642 Added Files: csbigcam.cpp csbigcam.h main.cpp Log Message: --- NEW FILE: csbigcam.h --- /* csbigcam.h - Contains the interface to the csbigcam camera class 1. This software (c)2004 Santa Barbara Instrument Group. 2. This free software is provided as an example of how to communicate with SBIG cameras. It is provided AS-IS without any guarantees by SBIG of suitability for a particular purpose and without any guarantee to be bug-free. If you use it you agree to these terms and agree to do so at your own risk. 3. Any distribution of this source code to include these terms. */ #ifndef _CSBIGCAM_ #define _CSBIGCAM_ #ifndef _PARDRV_ #include "sbigudrv.h" #endif #ifndef _CSBIGIMG_ #include "csbigimg.h" #endif #include <string> using namespace std; typedef enum {RELAY_XPLUS, RELAY_XMINUS, RELAY_YPLUS, RELAY_YMINUS } CAMERA_RELAY; typedef enum {SBDF_LIGHT_ONLY, SBDF_DARK_ONLY, SBDF_DARK_ALSO } SBIG_DARK_FRAME; class CSBIGCam { private: PAR_ERROR m_eLastError; PAR_COMMAND m_eLastCommand; short m_nDrvHandle; CAMERA_TYPE m_eCameraType; CCD_REQUEST m_eActiveCCD; double m_dExposureTime; unsigned short m_uReadoutMode; ABG_STATE7 m_eABGState; public: // Constructors/Destructors CSBIGCam(); CSBIGCam(OpenDeviceParams odp); CSBIGCam(SBIG_DEVICE_TYPE dev); ~CSBIGCam(); void Init(); // Error Reporting Routines PAR_ERROR GetError(); string GetErrorString(); string GetErrorString(PAR_ERROR err); PAR_COMMAND GetCommand(); // Accessor Functions double GetExposureTime(void) { return m_dExposureTime; } void SetExposureTime(double exp) { m_dExposureTime = exp; } CCD_REQUEST GetActiveCCD(void) { return m_eActiveCCD; } void SetActiveCCD(CCD_REQUEST ccd) { m_eActiveCCD = ccd; } unsigned short GetReadoutMode(void) { return m_uReadoutMode; } void SetReadoutMode(unsigned short rm) { m_uReadoutMode = rm; } CAMERA_TYPE GetCameraType(void) { return m_eCameraType; } ABG_STATE7 GetABGState(void) { return m_eABGState; } void SetABGState(ABG_STATE7 abgState) { m_eABGState = abgState; } // Driver/Device Routines PAR_ERROR OpenDriver(); PAR_ERROR CloseDriver(); PAR_ERROR OpenDevice(OpenDeviceParams odp); PAR_ERROR CloseDevice(); PAR_ERROR GetDriverInfo(DRIVER_REQUEST request, GetDriverInfoResults0 &gdir); // High-Level Exposure Related Commands PAR_ERROR GrabImage(CSBIGImg *pImg, SBIG_DARK_FRAME dark); // Low-Level Exposure Related Commands PAR_ERROR StartExposure(SHUTTER_COMMAND shutterState); PAR_ERROR EndExposure(void); PAR_ERROR IsExposureComplete(MY_LOGICAL &complete); PAR_ERROR StartReadout(StartReadoutParams srp); PAR_ERROR EndReadout(void); PAR_ERROR ReadoutLine(ReadoutLineParams rlp, MY_LOGICAL darkSubtract, unsigned short *dest); PAR_ERROR DumpLines(unsigned short noLines); //Temperature Related Commands PAR_ERROR GetCCDTemperature(double &ccdTemp); PAR_ERROR SetTemperatureRegulation(MY_LOGICAL enable, double setpoint); PAR_ERROR QueryTemperatureStatus(MY_LOGICAL &enabled, double &ccdTemp, double &setpointTemp, double &percentTE); // Control Related Commands PAR_ERROR ActivateRelay(CAMERA_RELAY relay, double time); PAR_ERROR AOTipTilt(AOTipTiltParams attp); PAR_ERROR CFWCommand(CFWParams cfwp, CFWResults &cfwr); // General Purpose Commands PAR_ERROR EstablishLink(void); string GetCameraTypeString(void); // Utility functions MY_LOGICAL CheckLink(void); unsigned short DegreesCToAD(double degC, MY_LOGICAL ccd = TRUE); double ADToDegreesC(unsigned short ad, MY_LOGICAL ccd = TRUE); // Allows access directly to driver PAR_ERROR SBIGUnivDrvCommand(short command, void *Params, void *Results); }; #endif /* #ifndef _CSBIGCAM_ */ --- NEW FILE: main.cpp --- /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <getopt.h> #include "fitsio.h" #include "csbigcam.h" using namespace std; #define PROGRAM_NAME "SBIG CCD camera controller" #define URL "http://www.astro.ufsc.br/~andre/" #ifndef VERSION #define VERSION "0.0001" #endif // filled by get_args() char *exec_name; // Name of executable file static char *conffname; // configuration file static char *imagefname; // image file static double exptime; // seconds static int interval; // seconds static int nexp; // number of exposures static unsigned short binning; static SBIG_DEVICE_TYPE device;// camera device static CCD_REQUEST ccd; // imaging=0, tracking=1 static ABG_STATE7 abg; // abg state static unsigned short filter; // color filter. static unsigned short top, left, width, height; // image window static void print_title(void); static void print_help(void); static void print_version(void); static void print_usage(void); static void get_args(int argc, char **argv); /*-------------------------------------------------------------------------*/ int main(int argc, char **argv) { CSBIGCam *cam; unsigned short *data; // get command line arguments get_args(argc, argv); // list arguments for debugging printf("Exptime: %'.2f\n", exptime); printf("Interval: %d\n", interval); printf("Nexp : %d\n", nexp); printf("Binning: %d\n", binning); printf("Filter : %d\n", filter); printf("Device : %d\n", device); printf("CCD : %d\n", ccd); printf("ABG : %d\n", abg); printf("top: %d\n", top); printf("height: %d\n", height); printf("left: %d\n", left); printf("width: %d\n", width); printf("Image: %s\n", imagefname); printf("Config: %s\n", conffname); // allocate image buffer data = (unsigned short*)calloc(width*height, sizeof(unsigned short)); if (data == NULL) { printf("Error malloc\'ing! o_O\n"); exit(1); } // start talking to camera cam = new CSBIGCam(device); printf("Establishing link... "); fflush(stdout); cam->EstablishLink(); printf("OK.\nCamera type: %s\n", (cam->GetCameraTypeString()).c_str()); // set up camera cam->SetActiveCCD(ccd); cam->SetExposureTime(exptime); cam->SetReadoutMode(binning); cam->SetABGState(abg); // set filter if (filter != 0) { CFWResults cfwr; CFWParams cfwp = {CFWSEL_CFW8, CFWC_GOTO, filter, 0,0,NULL,0,NULL}; printf("Moving filter wheel to position %d... ", filter); fflush(stdout); cam->CFWCommand(cfwp, cfwr); //wait GOTO command finish do { usleep(500000); // .5 sec cfwp.cfwCommand = CFWC_QUERY; cam->CFWCommand(cfwp, cfwr); //printf("status: %d\n", cfwr.cfwStatus); } while (cfwr.cfwStatus == CFWS_BUSY); printf("Done.\n"); } // start taking images int i; printf("Taking %d images of %'.2f sec., with %d sec. interval.\n", nexp, exptime, interval); for (i = 1; i <= nexp; i++){ int fitstatus; long int naxes[2]; fitsfile *fptr; // initialize file and header naxes[0] = width; naxes[1] = height; fits_create_file(&fptr, imagefname, &fitstatus); fits_create_img(fptr, SHORT_IMG, 2, naxes, &fitstatus); fits_write_date(fptr, &fitstatus); // expose printf("\nImage #%d: %'.2f seconds exposure... ", i, exptime); fflush(stdout); cam->StartExposure(SC_OPEN_SHUTTER); // wait exposure done MY_LOGICAL expcomplete; if (exptime < 0.5) usleep((unsigned long)exptime*1000000UL + 50000UL); else sleep((unsigned int)(exptime+1.0)); cam->IsExposureComplete(expcomplete); if (!expcomplete) do { // check every 0.2 sec usleep(200000UL); cam->IsExposureComplete(expcomplete); } while (!expcomplete); cam->EndExposure(); printf("Done.\n"); // exposure complete, download data StartReadoutParams srp; ReadoutLineParams rlp; srp.ccd = ccd; srp.readoutMode = binning; srp.top = top; srp.left = left; srp.height = height; srp.width = width; rlp.ccd = ccd; rlp.readoutMode = binning; rlp.pixelStart = left; rlp.pixelLength = width; printf("Downloading image of size %dx%d... ", width, height); fflush(stdout); cam->StartReadout(srp); unsigned short *dest = data; int j; for (j = 0; j < height; j++) { dest = data + j*width; cam->ReadoutLine(rlp, FALSE, dest); } cam->EndReadout(); printf("Done.\n"); // save file fits_write_img(fptr, TUSHORT, 1, (naxes[0] * naxes[1]), data, &fitstatus); //fits_write_2d_usht(fptr, 0, naxes[0], // naxes[0], naxes[1], data, &fitstatus); // fill the header fits_update_key(fptr, TDOUBLE, "EXPTIME", &exptime, "Exposure Time (secs.)", &fitstatus); fits_close_file(fptr, &fitstatus); // sleep until next image if (i == nexp) break; if (interval == 0) continue; printf("Sleeping %d seconds until next image... ", interval); fflush(stdout); sleep(interval); printf("Done.\n"); } // imaging loop printf("\nImaging complete.\n"); // all done, clean up the mess free(data); delete cam; exit(0); } /*-------------------------------------------------------------------------*/ static void print_title(void) { printf("%s - version: %s\n", PROGRAM_NAME, VERSION); } /*-------------------------------------------------------------------------*/ static void print_help(void) { print_title(); print_usage(); printf("Command line options:\n\n" " -h / --help\n" " This help screen.\n\n" " -v / --version\n" " Display version and copyright information.\n\n" " -C / --config-file CONFFILE\n" " Read options from CONFFILE.\n\n" " -d / --device DEVICE\n" " Use camera connected to DEVICE.\n\n" " -c / --CCD N\n" " Use imaging (0) or tracking (1) ccd.\n" " Default: imaging.\n\n" " -a / --ABG ABG_STATE\n" " Antiblooming gate state during integration.\n" " 0: Low (default).\n" " 1: Clocked low.\n" " 2: Clocked medium.\n" " 3: Clocked high.\n\n" " -f / --filter N\n" " Use Nth filter. N = 1 to 5\n" " N = 0 (default) keeps the current filter.\n\n" " -t / --exptime TIME\n" " Exposure time, in seconds.\n" " Exposure times can be from 0.01 to 9999\n" " seconds, in 0.01 sec. steps.\n" " Default: 0 seconds.\n\n" " -n / --nexp N\n" " Number of images to take.\n" " Default: 1 image.\n\n" " -i / --interval TIME\n" " Time interval between images, in seconds.\n" " Default: 0 seconds.\n\n" " -w / --window X1:X2,Y1:Y2\n" " Image window to be downloaded (zero-based).\n" " Default: 0:765,0:510.\n\n" " -b / --binning N\n" " Type of binning.\n" " 0: No binning (default)\n" " 1: 2x2\n" " 2: 3x3\n\n" " -o / --output IMAGEFILE\n" " Save image to IMAGEFILE.\n\n" ); printf("\nFor more information visit the home page:\n" "%s\n\n", URL); exit(0); } /*-------------------------------------------------------------------------*/ static void print_version(void) { print_title(); printf("Copyright (C) 2004 Andre Luiz de Amorim\n"); printf("%s comes with NO WARRANTY,\n" "to the extent permitted by law.\n", PROGRAM_NAME); printf("You may redistribute copies of %s\n" "under the terms of the GNU General Public License.\n" "For more information about these matters,\n" "see the files named COPYING.\n", PROGRAM_NAME); exit(0); } /*-------------------------------------------------------------------------*/ static void print_usage(void) { printf("SYNTAX:\n" " %s -t exptime -n nexp -d device -o imagefile\n\n" " %s {-h|--help}\n\n", exec_name, exec_name); } /*-------------------------------------------------------------------------*/ static void get_args(int argc, char **argv) { int next_opt; const char *short_options = "hvC:d:c:a:f:t:n:i:w:b:o:"; const struct option long_options [] = { { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'v' }, { "config-file", 1, NULL, 'C' }, { "device", 1, NULL, 'd' }, { "CCD", 1, NULL, 'c' }, { "ABG", 1, NULL, 'a' }, { "filter", 1, NULL, 'f' }, { "exptime", 1, NULL, 't' }, { "nexp", 1, NULL, 'n' }, { "interval", 1, NULL, 'i' }, { "window", 1, NULL, 'w' }, { "binning", 1, NULL, 'b' }, { "output", 1, NULL, 'o' }, { NULL, 0, NULL, 0 } }; // default values exec_name = argv[0]; conffname = NULL; imagefname = NULL; filter = 0; device = DEV_USB; ccd = CCD_IMAGING; abg = ABG_LOW7; exptime = 0; nexp = 1; interval = 0; binning = 0; // no binning top = 0; left = 0; width = 765; height = 510; do { next_opt = getopt_long(argc, argv, short_options, long_options, NULL); switch (next_opt) { case 'h': print_help(); break; case 'v': print_version(); break; case 'C': /* config file */ conffname = optarg; break; case 'd': /* device */ break; case 'c': /* ccd */ sscanf(optarg, "%hu", &ccd); break; case 'a': /* abg state */ sscanf(optarg, "%hu", &abg); break; case 'f': /* filter */ sscanf(optarg, "%hu", &filter); break; case 't': /* exposure time */ sscanf(optarg, "%lf", &exptime); break; case 'n': /* number of images */ sscanf(optarg, "%d", &nexp); break; case 'i': /* time interval between images */ sscanf(optarg, "%d", &interval); break; case 'w': /* set image window */ sscanf(optarg, "%hu:%hu,%hu:%hu", &left, &width, &top, &height); // optarg comes as X1:X2,Y1:Y2, fix width and height width -= left; height -= top; break; case 'b': /* set readout mode */ sscanf(optarg, "%hu", &binning); break; case 'o': /* image file name */ imagefname = optarg; break; case '?': /* Invalid option */ print_usage(); exit(1); break; case -1: /* end of options */ break; default: printf("strange...\n"); exit(1); break; } } while (next_opt != -1); } /*-------------------------------------------------------------------------*/ --- NEW FILE: csbigcam.cpp --- /* csbigcam.cpp - Contains the code for the sbigcam class 1. This software (c)2004 Santa Barbara Instrument Group. 2. This free software is provided as an example of how to communicate with SBIG cameras. It is provided AS-IS without any guarantees by SBIG of suitability for a particular purpose and without any guarantee to be bug-free. If you use it you agree to these terms and agree to do so at your own risk. 3. Any distribution of this source code to include these terms. Revision History Date Modification ========================================================= 1/26/04 Initial release */ #include "sbigudrv.h" #include "csbigcam.h" #include "csbigimg.h" #include <string> #include <math.h> using namespace std; #ifndef INVALID_HANDLE_VALUE #define INVALID_HANDLE_VALUE -1 #endif /* Temperature Conversion Constants Defined in the SBIG Universal Driver Documentation */ #define T0 25.0 #define R0 3.0 #define DT_CCD 25.0 #define DT_AMB 45.0 #define RR_CCD 2.57 #define RR_AMB 7.791 #define RB_CCD 10.0 #define RB_AMB 3.0 #define MAX_AD 4096 /* hex2double: Convert the passed hex value to double. The hex value is assumed to be in the format: XXXXXX.XX */ static double hex2double(unsigned long ul) { double res, mult; int i; res = 0.0; mult = 1.0; for (i=0; i<8; i++) { res += mult * (double)(ul & 0x0F); ul >>= 4; mult *= 10.0; } return res / 100.0; } /* Init: Initialize the base variables. */ void CSBIGCam::Init() { m_eLastError = CE_NO_ERROR; m_eLastCommand = CC_NULL; m_nDrvHandle = INVALID_HANDLE_VALUE; m_eCameraType = NO_CAMERA; m_eActiveCCD = CCD_IMAGING; m_dExposureTime = 1.0; m_uReadoutMode = 0; m_eABGState = ABG_CLK_MED7; } /* GetCameraTypeString: Return a string describing the model camera that has been linked to. */ //typedef enum { ST7_CAMERA=4, ST8_CAMERA, ST5C_CAMERA, TCE_CONTROLLER, // ST237_CAMERA, STK_CAMERA, ST9_CAMERA, STV_CAMERA, ST10_CAMERA, // ST1K_CAMERA, ST2K_CAMERA, STL_CAMERA, STF_CAMERA, NEXT_CAMERA, NO_CAMERA=0xFFFF } CAMERA_TYPE; static const char *CAM_NAMES[] = { "Type 0", "Type 1", "Type 2", "Type 3", "ST-7", "ST-8", "ST-5C", "TCE", "ST-237", "ST-K", "ST-9", "STV", "ST-10", "ST-1K", "ST-2K", "ST-L", "ST-F" }; string CSBIGCam::GetCameraTypeString(void) { string s; GetCCDInfoParams gcip; GetCCDInfoResults0 gcir; char *p1, *p2; if ( m_eCameraType < (CAMERA_TYPE)(sizeof(CAM_NAMES)/sizeof(const char *)) ) { // default name s = CAM_NAMES[m_eCameraType]; // see if ST-237A and if so indicate it in the name if ( m_eCameraType == ST237_CAMERA ) { gcip.request = CCD_INFO_IMAGING; if ( SBIGUnivDrvCommand(CC_GET_CCD_INFO, &gcip, &gcir) == CE_NO_ERROR ) if ( gcir.readoutInfo[0].gain >= 0x100 ) s += "A"; } // include the ST-L sub-models if ( m_eCameraType == STL_CAMERA ) { gcip.request = CCD_INFO_IMAGING; if ( SBIGUnivDrvCommand(CC_GET_CCD_INFO, &gcip, &gcir) == CE_NO_ERROR ) { // driver reports name as "SBIG ST-L-XXX..." p1 = gcir.name + 5; if ( (p2 = strchr(p1,' ')) != NULL ) { *p2 = 0; s = p1; } } } } else if ( m_eCameraType == NO_CAMERA ) s = "No Camera"; else s = "Unknown"; return s; } /* CSBIGCam: Stamdard constructor. Initialize appropriate member variables. */ CSBIGCam::CSBIGCam() { Init(); } /* CSBIGCam: Alternate constructor. Init the vars, Open the driver and then try to open the passed device. If you want to use the Ethernet connection this is the best constructor. If you're using the LPT or USB connections the alternate constructor below may make more sense. */ CSBIGCam::CSBIGCam(OpenDeviceParams odp) { Init(); if ( OpenDriver() == CE_NO_ERROR ) m_eLastError = OpenDevice(odp); } /* CSBIGCam: Alternate constructor. Init the vars, Open the driver and then try to open the passed device. This won't work the Ethernet port because no IP address is specified. Use the constructor above where you can pass the OpenDeviceParams struct. */ CSBIGCam::CSBIGCam(SBIG_DEVICE_TYPE dev) { OpenDeviceParams odp; Init(); if ( dev == DEV_ETH ) m_eLastError = CE_BAD_PARAMETER; else { odp.deviceType = dev; if ( OpenDriver() == CE_NO_ERROR ) m_eLastError = OpenDevice(odp); } } /* ~CSBIGCam: Standard destructor. Close the device then the driver. */ CSBIGCam::~CSBIGCam() { CloseDevice(); CloseDriver(); } /* GetError: Return the error generated in the previous driver call. */ PAR_ERROR CSBIGCam::GetError() { return m_eLastError; } /* GetCommand: Return the command last passed to the driver. */ PAR_COMMAND CSBIGCam::GetCommand() { return m_eLastCommand; } /* SBIGUnivDrvCommand: Bottleneck function for all calls to the driver that logs the command and error. First it activates our handle and then it calls the driver. Activating the handle first allows having multiple instances of this class dealing with multiple cameras on different communications port. Also allows direct access to the SBIG Universal Driver after the driver has been opened. */ PAR_ERROR CSBIGCam::SBIGUnivDrvCommand(short command, void *Params, void *Results) { SetDriverHandleParams sdhp; // make sure we have a valid handle to the driver m_eLastCommand = (PAR_COMMAND)command; if ( m_nDrvHandle == INVALID_HANDLE_VALUE ) m_eLastError = CE_DRIVER_NOT_OPEN; else { // handle is valid so install it in the driver sdhp.handle = m_nDrvHandle; if ( (m_eLastError = (PAR_ERROR)::SBIGUnivDrvCommand(CC_SET_DRIVER_HANDLE, &sdhp, NULL)) == CE_NO_ERROR ) // call the desired command m_eLastError = (PAR_ERROR)::SBIGUnivDrvCommand(command, Params, Results); } return m_eLastError; } /* OpenDriver: Open the driver. Must be made before any other calls and should be called only once per instance of the camera class. Based on the results of the open call to the driver this can open a new handle to the driver. The alternate constructors do this for you when you specify the communications port to use. */ PAR_ERROR CSBIGCam::OpenDriver() { short res; GetDriverHandleResults gdhr; SetDriverHandleParams sdhp; // call the driver directly so doesn't install our handle res = ::SBIGUnivDrvCommand(m_eLastCommand = CC_OPEN_DRIVER, NULL, NULL); if ( res == CE_DRIVER_NOT_CLOSED ) { /* the driver is open already which we interpret as having been opened by another instance of the class so get the driver to allocate a new handle and then record it */ sdhp.handle = INVALID_HANDLE_VALUE; res = ::SBIGUnivDrvCommand(CC_SET_DRIVER_HANDLE, &sdhp, NULL); if ( res == CE_NO_ERROR ) { res = ::SBIGUnivDrvCommand(CC_OPEN_DRIVER, NULL, NULL); if ( res == CE_NO_ERROR ) { res = ::SBIGUnivDrvCommand(CC_GET_DRIVER_HANDLE, NULL, &gdhr); if ( res == CE_NO_ERROR ) m_nDrvHandle = gdhr.handle; } } } else if ( res == CE_NO_ERROR ) { /* the driver was not open so record the driver handle so we can support multiple instances of this class talking to multiple cameras */ res = ::SBIGUnivDrvCommand(CC_GET_DRIVER_HANDLE, NULL, &gdhr); if ( res == CE_NO_ERROR ) m_nDrvHandle = gdhr.handle; } return m_eLastError = (PAR_ERROR)res; } /* CloseDriver: Should be called for every call to OpenDriver. Standard destructor does this for you as well. Closing the Drriver multiple times won't hurt but will return an error. The destructor will do this for you if you don't do it explicitly. */ PAR_ERROR CSBIGCam::CloseDriver() { PAR_ERROR res; res = SBIGUnivDrvCommand(CC_CLOSE_DRIVER, NULL, NULL); if ( res == CE_NO_ERROR ) m_nDrvHandle = INVALID_HANDLE_VALUE; return res; } /* OpenDevice: Call once to open a particular port (USB, LPT, Ethernet, etc). Must be balanced with a call to CloseDevice. Note that the alternate constructors will make this call for you so you don't have to do it explicitly. */ PAR_ERROR CSBIGCam::OpenDevice(OpenDeviceParams odp) { return SBIGUnivDrvCommand(CC_OPEN_DEVICE, &odp, NULL); } /* CloseDevice: Closes which ever device was opened by OpenDriver. The destructor does this for you so you don't have to call it explicitly. */ PAR_ERROR CSBIGCam::CloseDevice() { return SBIGUnivDrvCommand(CC_CLOSE_DEVICE, NULL, NULL); } /* GetErrorString: Return a string object describing the passed error code. */ string CSBIGCam::GetErrorString(PAR_ERROR err) { GetErrorStringParams gesp; GetErrorStringResults gesr; string s; gesp.errorNo = err; SBIGUnivDrvCommand(CC_GET_ERROR_STRING, &gesp, &gesr); s = gesr.errorString; return s; } /* GetDriverInfo: Get the requested driver info for the passed request. This call only works with the DRIVER_STANDARD and DRIVER_EXTENDED requests as you pass it a result reference that only works with those 2 requests. For other requests simply call the SBIGUnivDrvCommand class function. */ PAR_ERROR CSBIGCam::GetDriverInfo(DRIVER_REQUEST request, GetDriverInfoResults0 &gdir) { GetDriverInfoParams gdip; gdip.request = request; m_eLastCommand = CC_GET_DRIVER_INFO; if ( request > DRIVER_EXTENDED ) return m_eLastError = CE_BAD_PARAMETER; else return SBIGUnivDrvCommand(CC_GET_DRIVER_INFO, &gdip, &gdir); } /* GrabImage: Grab an image into the passed image of the passed type. This does the whole processing for you: Starts and Ends the Exposure then Readsout the data. */ PAR_ERROR CSBIGCam::GrabImage(CSBIGImg *pImg, SBIG_DARK_FRAME dark) { int height, width; GetCCDInfoResults0 gcir; GetCCDInfoParams gcip; double ccdTemp; unsigned short vertNBinning; unsigned short rm; string s; unsigned short es; MY_LOGICAL expComp; PAR_ERROR err; StartReadoutParams srp; int i; ReadoutLineParams rlp; // Get the image dimensions vertNBinning = m_uReadoutMode >> 8; if ( vertNBinning == 0 ) vertNBinning = 1; rm = m_uReadoutMode & 0xFF; gcip.request = (m_eActiveCCD == CCD_IMAGING ? CCD_INFO_IMAGING : CCD_INFO_TRACKING); if ( SBIGUnivDrvCommand(CC_GET_CCD_INFO, &gcip, &gcir) != CE_NO_ERROR ) return m_eLastError; if ( rm >= gcir.readoutModes ) return CE_BAD_PARAMETER; width = gcir.readoutInfo[rm].width; height = gcir.readoutInfo[rm].height / vertNBinning; // try to allocate the image buffer if ( !pImg->AllocateImageBuffer(height, width) ) return CE_MEMORY_ERROR; // initialize some image header params if ( GetCCDTemperature(ccdTemp) != CE_NO_ERROR ) return m_eLastError; pImg->SetCCDTemperature(ccdTemp); pImg->SetEachExposure(m_dExposureTime); pImg->SetEGain(hex2double(gcir.readoutInfo[rm].gain)); pImg->SetPixelHeight(hex2double(gcir.readoutInfo[rm].pixelHeight) * vertNBinning / 1000.0); pImg->SetPixelWidth(hex2double(gcir.readoutInfo[rm].pixelWidth) / 1000.0); es = ES_DCS_ENABLED | ES_DCR_DISABLED | ES_AUTOBIAS_ENABLED; if ( m_eCameraType == ST5C_CAMERA ) es |= (ES_ABG_CLOCKED | ES_ABG_RATE_MED); else if ( m_eCameraType == ST237_CAMERA ) es |= (ES_ABG_CLOCKED | ES_ABG_RATE_FIXED); else if ( m_eActiveCCD == CCD_TRACKING ) es |= (ES_ABG_CLOCKED | ES_ABG_RATE_MED); else es |= ES_ABG_LOW; pImg->SetExposureState(es); pImg->SetExposureTime(m_dExposureTime); pImg->SetNumberExposures(1); pImg->SetReadoutMode(m_uReadoutMode); s = GetCameraTypeString(); if ( m_eCameraType == ST5C_CAMERA || ( m_eCameraType == ST237_CAMERA && s.find("ST-237A", 0) == string::npos) ) pImg->SetSaturationLevel(4095); else pImg->SetSaturationLevel(65535); s = gcir.name; pImg->SetCameraModel(s); // end any exposure in case one in progress EndExposure(); if ( m_eLastError != CE_NO_ERROR && m_eLastError != CE_NO_EXPOSURE_IN_PROGRESS ) return m_eLastError; // start the exposure if ( StartExposure(dark == SBDF_LIGHT_ONLY ? SC_OPEN_SHUTTER : SC_CLOSE_SHUTTER) != CE_NO_ERROR ) return m_eLastError; pImg->SetImageStartTime(time(NULL)); // wait for exposure to complete do { } while ((err = IsExposureComplete(expComp)) == CE_NO_ERROR && !expComp ); EndExposure(); if ( err != CE_NO_ERROR ) return err; if ( m_eLastError != CE_NO_ERROR ) return m_eLastError; // readout the CCD srp.ccd = m_eActiveCCD; srp.left = srp.top = 0; srp.height = height; srp.width = width; srp.readoutMode = m_uReadoutMode; if ( (err = StartReadout(srp)) == CE_NO_ERROR ) { rlp.ccd = m_eActiveCCD; rlp.pixelStart = 0; rlp.pixelLength = width; rlp.readoutMode = m_uReadoutMode; for (i=0; i<height && err==CE_NO_ERROR; i++ ) err = ReadoutLine(rlp, FALSE, pImg->GetImagePointer() + (long)i * width); } EndReadout(); if ( err != CE_NO_ERROR ) return err; if ( m_eLastError != CE_NO_ERROR ) return err; // we're done unless we wanted a dark also image if ( dark != SBDF_DARK_ALSO ) return CE_NO_ERROR; // start the light exposure if ( StartExposure(SC_OPEN_SHUTTER) != CE_NO_ERROR ) return m_eLastError; pImg->SetImageStartTime(time(NULL)); // wait for exposure to complete do { } while ((err = IsExposureComplete(expComp)) == CE_NO_ERROR && !expComp ); EndExposure(); if ( err != CE_NO_ERROR ) return err; if ( m_eLastError != CE_NO_ERROR ) return m_eLastError; // readout the CCD srp.ccd = m_eActiveCCD; srp.left = srp.top = 0; srp.height = height; srp.width = width; srp.readoutMode = m_uReadoutMode; if ( (err = StartReadout(srp)) == CE_NO_ERROR ) { rlp.ccd = m_eActiveCCD; rlp.pixelStart = 0; rlp.pixelLength = width; rlp.readoutMode = m_uReadoutMode; for (i=0; i<height && err==CE_NO_ERROR; i++ ) err = ReadoutLine(rlp, TRUE, pImg->GetImagePointer() + (long)i * width); } EndReadout(); if ( err != CE_NO_ERROR ) return err; if ( m_eLastError != CE_NO_ERROR ) return err; // record dark subtraction in history if ( m_eCameraType == ST5C_CAMERA || m_eCameraType == ST237_CAMERA ) pImg->SetHistory("f"); else pImg->SetHistory("R"); return CE_NO_ERROR; } /* StartExposure: Start an exposure in the camera. Should be matched with an EndExposure call. */ PAR_ERROR CSBIGCam::StartExposure(SHUTTER_COMMAND shutterState) { StartExposureParams sep; sep.ccd = m_eActiveCCD; sep.exposureTime = (unsigned long)(m_dExposureTime * 100.0 + 0.5); if ( sep.exposureTime < 1 ) sep.exposureTime = 1; sep.abgState = m_eABGState; sep.openShutter = shutterState; if ( CheckLink() ) return SBIGUnivDrvCommand(CC_START_EXPOSURE, &sep, NULL); else return m_eLastError; } /* EndExposure: End or abort an exposure in the camera. Should be matched to a StartExposure but no damage is done by calling it by itself if you don't know if an exposure was started for example. */ PAR_ERROR CSBIGCam::EndExposure(void) { EndExposureParams eep; eep.ccd = m_eActiveCCD; if ( CheckLink() ) return SBIGUnivDrvCommand(CC_END_EXPOSURE, &eep, NULL); else return m_eLastError; } /* IsExposueComplete: Query the camera to see if the exposure in progress is complete. This returns TRUE if the CCD is idle (an exposure was never started) or if the CCD exposure is complete. */ PAR_ERROR CSBIGCam::IsExposureComplete(MY_LOGICAL &complete) { QueryCommandStatusParams qcsp; QueryCommandStatusResults qcsr; complete = FALSE; if ( CheckLink() ) { qcsp.command = CC_START_EXPOSURE; if ( SBIGUnivDrvCommand(CC_QUERY_COMMAND_STATUS, &qcsp, &qcsr) == CE_NO_ERROR ) { if ( m_eActiveCCD == CCD_IMAGING ) complete = (qcsr.status & 0x03) != 0x02; else complete = (qcsr.status & 0x0C) != 0x08; } } return m_eLastError; } /* StartReadout: Start the readout process. This should be called after EndExposure and should be matched with an EndExposure call. */ PAR_ERROR CSBIGCam::StartReadout(StartReadoutParams srp) { if ( CheckLink() ) return SBIGUnivDrvCommand(CC_START_READOUT, &srp, NULL); else return m_eLastError; } /* EndReadout: End a readout started with StartReadout. Don't forget to make this call to prepare the CCD for idling. */ PAR_ERROR CSBIGCam::EndReadout(void) { EndReadoutParams erp; erp.ccd = m_eActiveCCD; if ( CheckLink() ) return SBIGUnivDrvCommand(CC_END_READOUT, &erp, NULL); else return m_eLastError; } /* ReadoutLine: Readout a line of data from the camera, optionally performing a dark subtraction, placing the data at dest. */ PAR_ERROR CSBIGCam::ReadoutLine(ReadoutLineParams rlp, MY_LOGICAL darkSubtract, unsigned short *dest) { if ( CheckLink() ) { if ( darkSubtract ) return SBIGUnivDrvCommand(CC_READ_SUBTRACT_LINE, &rlp, dest); else return SBIGUnivDrvCommand(CC_READOUT_LINE, &rlp, dest); } else return m_eLastError; } /* DumpLines: Discard data from one or more lines in the camera. */ PAR_ERROR CSBIGCam::DumpLines(unsigned short noLines) { DumpLinesParams dlp; dlp.ccd = m_eActiveCCD; dlp.lineLength = noLines; dlp.readoutMode = m_uReadoutMode; if ( CheckLink() ) return SBIGUnivDrvCommand(CC_DUMP_LINES, &dlp, NULL); else return m_eLastError; } /* SetTemperatureRegulation: Enable or disable the temperatre controll at the passed setpoint which is the absolute (not delta) temperature in degrees C. */ PAR_ERROR CSBIGCam::SetTemperatureRegulation(MY_LOGICAL enable, double setpoint) { SetTemperatureRegulationParams strp; if ( CheckLink() ) { strp.regulation = enable ? REGULATION_ON : REGULATION_OFF; strp.ccdSetpoint = DegreesCToAD(setpoint, TRUE); return SBIGUnivDrvCommand(CC_SET_TEMPERATURE_REGULATION, &strp, NULL); } else return m_eLastError; } /* QueryTemperatureStatus: Get whether the cooling is enabled, the CCD temp and setpoint in degrees C and the percent power applied to the TE cooler. */ PAR_ERROR CSBIGCam::QueryTemperatureStatus(MY_LOGICAL &enabled, double &ccdTemp, double &setpointTemp, double &percentTE) { QueryTemperatureStatusResults qtsr; if ( CheckLink() ) { if ( SBIGUnivDrvCommand(CC_QUERY_TEMPERATURE_STATUS, NULL, &qtsr) == CE_NO_ERROR ) { enabled = qtsr.enabled; ccdTemp = ADToDegreesC(qtsr.ccdThermistor, TRUE); setpointTemp = ADToDegreesC(qtsr.ccdSetpoint, TRUE); percentTE = qtsr.power/255.0; } } return m_eLastError; } /* GetCCDTemperature: Read and return the current CCD temperature. */ PAR_ERROR CSBIGCam::GetCCDTemperature(double &ccdTemp) { double setpointTemp, percentTE; MY_LOGICAL teEnabled; return QueryTemperatureStatus(teEnabled, ccdTemp, setpointTemp, percentTE); } /* ActivateRelay: Activate one of the four relays for the passed period of time. Cancel a relay by passing zero for the time. */ PAR_ERROR CSBIGCam::ActivateRelay(CAMERA_RELAY relay, double time) { ActivateRelayParams arp; unsigned short ut; if ( CheckLink() ) { arp.tXMinus = arp.tXPlus = arp.tYMinus = arp.tYPlus = 0; if ( time >= 655.35 ) ut = 65535; else ut = (unsigned short)(time/0.01); switch ( relay ){ case RELAY_XPLUS: arp.tXPlus = ut; break; case RELAY_XMINUS: arp.tXPlus = ut; break; case RELAY_YPLUS: arp.tXPlus = ut; break; case RELAY_YMINUS: arp.tXPlus = ut; break; } return SBIGUnivDrvCommand(CC_ACTIVATE_RELAY, &arp, NULL); } else return m_eLastError; } /* AOTipTilt: Send a tip/tilt command to the AO-7. */ PAR_ERROR CSBIGCam::AOTipTilt(AOTipTiltParams attp) { if ( CheckLink() ) return SBIGUnivDrvCommand(CC_AO_TIP_TILT, &attp, NULL); else return m_eLastError; } /* CFWCommand: Send a command to the Color Filter Wheel. */ PAR_ERROR CSBIGCam::CFWCommand(CFWParams cfwp, CFWResults &cfwr) { if ( CheckLink() ) return SBIGUnivDrvCommand(CC_CFW, &cfwp, &cfwr); else return m_eLastError; } /* EstablishLink: Once the driver and device are open call this to establish a communications link with the camera. May be called multiple times without problem. If there's no error and you want to find out what model of camera was found use the GetCameraType() function. */ PAR_ERROR CSBIGCam::EstablishLink(void) { PAR_ERROR res; EstablishLinkResults elr; EstablishLinkParams elp; res = SBIGUnivDrvCommand(CC_ESTABLISH_LINK, &elp, &elr); if ( res == CE_NO_ERROR ) m_eCameraType = (CAMERA_TYPE)elr.cameraType; return res; } /* GetErrorString: Returns a ANSI C++ standard string object describing the error code returned from the lass call to the driver. */ string CSBIGCam::GetErrorString() { return GetErrorString(m_eLastError); } /* CheckLink: If a link has been established to a camera return TRUE. Otherwise try to establish a link and if successful return TRUE. If fails return FALSE. */ MY_LOGICAL CSBIGCam::CheckLink(void) { if ( m_eCameraType != NO_CAMERA || EstablishLink() == CE_NO_ERROR ) return TRUE; else return FALSE; } /* DegreesCToAD: Convert temperatures in degrees C to camera AD setpoints. */ unsigned short CSBIGCam::DegreesCToAD(double degC, MY_LOGICAL ccd /* = TRUE */) { double r; unsigned short setpoint; if ( degC < -50.0 ) degC = -50.0; else if ( degC > 35.0 ) degC = 35.0; if ( ccd ) { r = R0 * exp(log(RR_CCD)*(T0 - degC)/DT_CCD); setpoint = (unsigned short)(MAX_AD/((RB_CCD/r) + 1.0) + 0.5); } else { r = R0 * exp(log(RR_AMB)*(T0 - degC)/DT_AMB); setpoint = (unsigned short)(MAX_AD/((RB_AMB/r) + 1.0) + 0.5); } return setpoint; } /* ADToDegreesC: Convert camera AD temperatures to degrees C */ double CSBIGCam::ADToDegreesC(unsigned short ad, MY_LOGICAL ccd /* = TRUE */) { double r, degC; if ( ad < 1 ) ad = 1; else if ( ad >= MAX_AD - 1 ) ad = MAX_AD - 1; if ( ccd ) { r = RB_CCD/(((double)MAX_AD/ad) - 1.0); degC = T0 - DT_CCD*(log(r/R0)/log(RR_CCD)); } else { r = RB_AMB/(((double)MAX_AD/ad) - 1.0); degC = T0 - DT_AMB*(log(r/R0)/log(RR_AMB)); } return degC; } |
From: Andr? L. A. <st...@us...> - 2004-03-18 19:37:23
|
Update of /cvsroot/uts/uts/src/cam/camfits.st7 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16976 Added Files: Makefile.am Makefile.in Log Message: Added Makefiles. Henrique: check them :-) --- NEW FILE: Makefile.in --- # Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../../.. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ CC = @CC@ DEPDIR = @DEPDIR@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ PACKAGE = @PACKAGE@ STRIP = @STRIP@ VERSION = @VERSION@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ bin_PROGRAMS = camfits.st7 camfits_st7_SOURCES = csbigcam.cpp main.cpp camfits_st7_LDADD = -lm -lcfitsio -lsbigudrv subdir = src/cam/camfits.st7 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = bin_PROGRAMS = camfits.st7$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) am_camfits_st7_OBJECTS = csbigcam.$(OBJEXT) main.$(OBJEXT) camfits_st7_OBJECTS = $(am_camfits_st7_OBJECTS) camfits_st7_DEPENDENCIES = camfits_st7_LDFLAGS = DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ccd.Po ./$(DEPDIR)/main.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ser.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ DIST_SOURCES = $(camfits_st7_SOURCES) DIST_COMMON = Makefile.am Makefile.in SOURCES = $(camfits_st7_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/cam/camfits.st7/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) camfits.st7$(EXEEXT): $(camfits_st7_OBJECTS) $(camfits_st7_DEPENDENCIES) @rm -f camfits.st7$(EXEEXT) $(LINK) $(camfits_st7_LDFLAGS) $(camfits_st7_OBJECTS) $(camfits_st7_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ccd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ser.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `cygpath -w $<` CCDEPMODE = @CCDEPMODE@ uninstall-info-am: ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = ../../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-binPROGRAMS install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic uninstall-am: uninstall-binPROGRAMS uninstall-info-am .PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic distclean distclean-compile distclean-depend \ distclean-generic distclean-tags distdir dvi dvi-am info \ info-am install install-am install-binPROGRAMS install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic tags uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: --- NEW FILE: Makefile.am --- bin_PROGRAMS = camfits.st7 camfits_st7_SOURCES = csbigcam.cpp main.cpp camfits_st7_LDADD = -lm -lcfitsio -lsbigudrv |
From: Andr? L. A. <st...@us...> - 2004-03-18 18:44:53
|
Update of /cvsroot/uts/uts/src/cam/camfits.st7 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3749/camfits.st7 Log Message: Directory /cvsroot/uts/uts/src/cam/camfits.st7 added to the repository |
From: Paulo H. S. de S. <ph...@us...> - 2004-03-18 16:15:38
|
Update of /cvsroot/uts/uts/src/tel/telgo.paramount In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3342/src/tel/telgo.paramount Modified Files: telgo telgo.paramount.py telgo.server.py Log Message: - better support for non connected telescope Index: telgo =================================================================== RCS file: /cvsroot/uts/uts/src/tel/telgo.paramount/telgo,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** telgo 4 Mar 2004 20:56:20 -0000 1.1 --- telgo 18 Mar 2004 16:06:00 -0000 1.2 *************** *** 22,30 **** """ % (__description__, __version__, __date__, ! sys.argv[0], sys.argv[0], sys.argv[0], sys.argv[0]) sys.exit(-1) # get target host and port from command line if ":" in sys.argv[2]: --- 22,34 ---- """ % (__description__, __version__, __date__, ! sys.argv[0], sys.argv[0], sys.argv[0], sys.argv[0], sys.argv[0]) sys.exit(-1) + + + + # get target host and port from command line if ":" in sys.argv[2]: *************** *** 59,63 **** # wait until telescope move ! wait = select.select([skt], [], [skt], 180) if len(wait[0]) or len(wait[2]): --- 63,67 ---- # wait until telescope move ! wait = select.select([skt], [], [skt], 60) if len(wait[0]) or len(wait[2]): Index: telgo.paramount.py =================================================================== RCS file: /cvsroot/uts/uts/src/tel/telgo.paramount/telgo.paramount.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** telgo.paramount.py 4 Mar 2004 20:56:20 -0000 1.1 --- telgo.paramount.py 18 Mar 2004 16:06:00 -0000 1.2 *************** *** 22,30 **** """ % (__description__, __version__, __date__, ! sys.argv[0], sys.argv[0], sys.argv[0], sys.argv[0]) sys.exit(-1) # get target host and port from command line if ":" in sys.argv[2]: --- 22,34 ---- """ % (__description__, __version__, __date__, ! sys.argv[0], sys.argv[0], sys.argv[0], sys.argv[0], sys.argv[0]) sys.exit(-1) + + + + # get target host and port from command line if ":" in sys.argv[2]: *************** *** 59,63 **** # wait until telescope move ! wait = select.select([skt], [], [skt], 180) if len(wait[0]) or len(wait[2]): --- 63,67 ---- # wait until telescope move ! wait = select.select([skt], [], [skt], 60) if len(wait[0]) or len(wait[2]): Index: telgo.server.py =================================================================== RCS file: /cvsroot/uts/uts/src/tel/telgo.paramount/telgo.server.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** telgo.server.py 4 Mar 2004 20:56:20 -0000 1.1 --- telgo.server.py 18 Mar 2004 16:06:00 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- #!/bin/python + # -*- coding: cp1252 -*- import sys import time *************** *** 8,12 **** sk = socket(AF_INET, SOCK_STREAM) ! sk.bind(('localhost', 10000)) sk.listen(5) --- 9,13 ---- sk = socket(AF_INET, SOCK_STREAM) ! sk.bind(('localhost', 80)) sk.listen(5) *************** *** 19,24 **** sys.exit(1) ! obj.Connected = True ! #obj.FindHome() targetRA = 0 --- 20,32 ---- sys.exit(1) ! try: ! obj.Connected = True ! # obj.FindHome() ! except AttributeError, e: ! print "Não foi possível conectar-se ao telescópio.\nVerifique se o telescópio está ligado e devidamente conectado " \ ! "ao computador" ! thesky.Quit() ! sys.exit(1) ! targetRA = 0 *************** *** 27,32 **** conn = addr = None try: ! while 1: conn, addr = sk.accept() print "Entrando... %s:%d" % addr --- 35,42 ---- conn = addr = None + fim = False + try: ! while not fim: conn, addr = sk.accept() print "Entrando... %s:%d" % addr *************** *** 60,63 **** --- 70,74 ---- obj.Connected = False thesky.Quit() + fim = True break *************** *** 66,70 **** conn.close() - except KeyboardInterrupt: print "Ctrl+C... saindo." --- 77,80 ---- *************** *** 108,111 **** --- 118,123 ---- sys.exit(1) + sys.exit(0) + |
From: <st...@us...> - 2004-03-12 00:28:47
|
Update of /cvsroot/uts/uts/src/cam/camd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32530/src/cam/camd Modified Files: cam_task.c Log Message: Image index was not bein set properly. Fixed. Index: cam_task.c =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/cam_task.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cam_task.c 9 Mar 2004 23:12:47 -0000 1.2 --- cam_task.c 12 Mar 2004 00:01:47 -0000 1.3 *************** *** 60,64 **** snprintf(cmdline, 255, cam->child_cmdline, cam->task->exptime, cam->task->nexp, ! cam->task->bfname, index); /* fork processess */ --- 60,64 ---- snprintf(cmdline, 255, cam->child_cmdline, cam->task->exptime, cam->task->nexp, ! cam->task->bfname, cam->task->index); /* fork processess */ |
From: <st...@us...> - 2004-03-11 22:50:48
|
Update of /cvsroot/uts/uts/src/cam/camd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11377/cam/camd Modified Files: instrument.c main.c runchild.c sec.c Log Message: Replaced fprintf(stderr, ...) with printf(...) to support output redirection. Index: instrument.c =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/instrument.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** instrument.c 29 Jan 2004 03:02:36 -0000 1.1.1.1 --- instrument.c 11 Mar 2004 22:22:54 -0000 1.2 *************** *** 51,55 **** inst->sec = secconnect(secname , "w", SEC_INSTCLNT_IDENT); if (inst->sec == NULL) { ! fprintf(stderr, "*** Could not connect to Secretary %s.\n", secname); free(inst->name); --- 51,55 ---- inst->sec = secconnect(secname , "w", SEC_INSTCLNT_IDENT); if (inst->sec == NULL) { ! printf("*** Could not connect to Secretary %s.\n", secname); free(inst->name); *************** *** 94,98 **** sec = secconnect(secname, "r", inst->name); if (sec == NULL) { ! fprintf(stderr, "*** Could not connect to Secretary %s.\n", secname); return (EOF); --- 94,98 ---- sec = secconnect(secname, "r", inst->name); if (sec == NULL) { ! printf("*** Could not connect to Secretary %s.\n", secname); return (EOF); Index: main.c =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/main.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** main.c 11 Mar 2004 20:42:06 -0000 1.4 --- main.c 11 Mar 2004 22:22:54 -0000 1.5 *************** *** 70,77 **** /* Open log file and redirect stdout, if required */ if (logfname != NULL) { ! fprintf(stderr, " -> Logging to file \"%s\".\n", logfname); stdout = freopen(logfname, "a", stdout); if (stdout == NULL) { ! fprintf(stderr, "*** Error opening file \"%s\".\n", logfname); exit(1); --- 70,77 ---- /* Open log file and redirect stdout, if required */ if (logfname != NULL) { ! printf(" -> Logging to file \"%s\".\n", logfname); stdout = freopen(logfname, "a", stdout); if (stdout == NULL) { ! printf("*** Error opening file \"%s\".\n", logfname); exit(1); *************** *** 90,94 **** if (detach) { /* Detach from terminal (daemon mode) */ ! fprintf(stderr, " -> Jumping into background...\n\n"); goto_bg(); /* close stdout if no logfile specified */ --- 90,94 ---- if (detach) { /* Detach from terminal (daemon mode) */ ! printf(" -> Jumping into background...\n\n"); goto_bg(); /* close stdout if no logfile specified */ Index: runchild.c =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/runchild.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** runchild.c 9 Mar 2004 23:12:47 -0000 1.2 --- runchild.c 11 Mar 2004 22:22:54 -0000 1.3 *************** *** 45,58 **** res = system(child_cmdline); ! fprintf(stderr, "Child process ended with status: %d\n", res); exit(EOF); /* this ends the child process, not the daemon */ } else if (chpid == -1) { ! fprintf(stderr, "Error, could not fork processes.\n"); } else { /* i am the parent */ ! fprintf(stderr, "Child process created, pid=%d.\n", chpid); } return(chpid); --- 45,58 ---- res = system(child_cmdline); ! printf("Child process ended with status: %d\n", res); exit(EOF); /* this ends the child process, not the daemon */ } else if (chpid == -1) { ! printf("Error, could not fork processes.\n"); } else { /* i am the parent */ ! printf("Child process created, pid=%d.\n", chpid); } return(chpid); Index: sec.c =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/sec.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** sec.c 29 Jan 2004 03:02:37 -0000 1.1.1.1 --- sec.c 11 Mar 2004 22:22:54 -0000 1.2 *************** *** 156,165 **** res = secreadb(sec->skt, buf); if (res < 0) { ! fprintf(stderr, "Read timeout or socket error\n\n"); secclose(sec); return (NULL); } if (res != RES_HELLO) { ! fprintf(stderr, "Expected \"%s\", but got \"%s\"\n", fresponses[RES_HELLO], fresponses[res]); secclose(sec); --- 156,165 ---- res = secreadb(sec->skt, buf); if (res < 0) { ! printf("Read timeout or socket error\n\n"); secclose(sec); return (NULL); } if (res != RES_HELLO) { ! printf("Expected \"%s\", but got \"%s\"\n", fresponses[RES_HELLO], fresponses[res]); secclose(sec); *************** *** 180,189 **** res = secreadb(sec->skt, buf); if (res < 0) { ! fprintf(stderr, "Read timeout or socket error\n\n"); secclose(sec); return (NULL); } if (res != RES_OK) { ! fprintf(stderr, "Unexpected response on IDENT: \"%s\"\n", fresponses[res]); secclose(sec); --- 180,189 ---- res = secreadb(sec->skt, buf); if (res < 0) { ! printf("Read timeout or socket error\n\n"); secclose(sec); return (NULL); } if (res != RES_OK) { ! printf("Unexpected response on IDENT: \"%s\"\n", fresponses[res]); secclose(sec); *************** *** 266,275 **** res = secreadb(sec->skt, buf); if (res < 0) { ! fprintf(stderr, "Read timeout or socket error\n\n"); Sclose(sec); return (EOF); } if (res != RES_OK) { ! fprintf(stderr, "Error setting status %d = %s\n", stat, content); } --- 266,275 ---- res = secreadb(sec->skt, buf); if (res < 0) { ! printf("Read timeout or socket error\n\n"); Sclose(sec); return (EOF); } if (res != RES_OK) { ! printf("Error setting status %d = %s\n", stat, content); } |
From: <st...@us...> - 2004-03-11 22:50:22
|
Update of /cvsroot/uts/uts/src/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11377/etc Modified Files: camd teld Log Message: Replaced fprintf(stderr, ...) with printf(...) to support output redirection. Index: camd =================================================================== RCS file: /cvsroot/uts/uts/src/etc/camd,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** camd 11 Mar 2004 21:40:43 -0000 1.2 --- camd 11 Mar 2004 22:22:55 -0000 1.3 *************** *** 26,30 **** if [ ! -f /var/lock/subsys/camd ]; then echo -n 'Starting camd daemon: ' ! daemon $UTS_BIN/camd RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/camd --- 26,30 ---- if [ ! -f /var/lock/subsys/camd ]; then echo -n 'Starting camd daemon: ' ! daemon $UTS_BIN/camd -d -o /var/log/uts/camd RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/camd Index: teld =================================================================== RCS file: /cvsroot/uts/uts/src/etc/teld,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** teld 11 Mar 2004 21:40:43 -0000 1.2 --- teld 11 Mar 2004 22:22:55 -0000 1.3 *************** *** 27,31 **** if [ ! -f /var/lock/subsys/teld ]; then echo -n 'Starting Telescope daemon: ' ! daemon $UTS_BIN/teld RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/teld --- 27,31 ---- if [ ! -f /var/lock/subsys/teld ]; then echo -n 'Starting Telescope daemon: ' ! daemon $UTS_BIN/teld -d -o /var/log/uts/teld RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/teld |
From: <st...@us...> - 2004-03-11 22:50:07
|
Update of /cvsroot/uts/uts/src/tel/teld In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11377/tel/teld Modified Files: instrument.c main.c runchild.c sec.c Log Message: Replaced fprintf(stderr, ...) with printf(...) to support output redirection. Index: instrument.c =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/instrument.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** instrument.c 29 Jan 2004 03:03:21 -0000 1.1.1.1 --- instrument.c 11 Mar 2004 22:22:55 -0000 1.2 *************** *** 52,56 **** inst->sec = secconnect(secname , "w", SEC_INSTCLNT_IDENT); if (inst->sec == NULL) { ! fprintf(stderr, "*** Could not connect to Secretary %s.\n", secname); free(inst->name); --- 52,56 ---- inst->sec = secconnect(secname , "w", SEC_INSTCLNT_IDENT); if (inst->sec == NULL) { ! printf("*** Could not connect to Secretary %s.\n", secname); free(inst->name); *************** *** 95,99 **** sec = secconnect(secname, "r", inst->name); if (sec == NULL) { ! fprintf(stderr, "*** Could not connect to Secretary %s.\n", secname); return (EOF); --- 95,99 ---- sec = secconnect(secname, "r", inst->name); if (sec == NULL) { ! printf("*** Could not connect to Secretary %s.\n", secname); return (EOF); Index: main.c =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/main.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** main.c 11 Mar 2004 20:42:07 -0000 1.4 --- main.c 11 Mar 2004 22:23:10 -0000 1.5 *************** *** 70,77 **** /* Open log file and redirect stdout, if required */ if (logfname != NULL) { ! fprintf(stderr, " -> Logging to file \"%s\".\n", logfname); stdout = freopen(logfname, "a", stdout); if (stdout == NULL) { ! fprintf(stderr, "*** Error opening file \"%s\".\n", logfname); exit(1); --- 70,77 ---- /* Open log file and redirect stdout, if required */ if (logfname != NULL) { ! printf(" -> Logging to file \"%s\".\n", logfname); stdout = freopen(logfname, "a", stdout); if (stdout == NULL) { ! printf("*** Error opening file \"%s\".\n", logfname); exit(1); *************** *** 90,94 **** if (detach) { /* Detach from terminal (daemon mode) */ ! fprintf(stderr, " -> Jumping into background...\n\n"); goto_bg(); /* close stdout if no logfile specified */ --- 90,94 ---- if (detach) { /* Detach from terminal (daemon mode) */ ! printf(" -> Jumping into background...\n\n"); goto_bg(); /* close stdout if no logfile specified */ Index: runchild.c =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/runchild.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** runchild.c 9 Mar 2004 22:50:03 -0000 1.2 --- runchild.c 11 Mar 2004 22:23:10 -0000 1.3 *************** *** 45,58 **** res = system(child_cmdline); ! fprintf(stderr, "Child process ended with status: %d\n", res); exit(EOF); /* this ends the child process, not the daemon */ } else if (chpid == -1) { ! fprintf(stderr, "Error, could not fork processes.\n"); } else { /* i am the parent */ ! fprintf(stderr, "Child process created, pid=%d.\n", chpid); } return(chpid); --- 45,58 ---- res = system(child_cmdline); ! printf("Child process ended with status: %d\n", res); exit(EOF); /* this ends the child process, not the daemon */ } else if (chpid == -1) { ! printf("Error, could not fork processes.\n"); } else { /* i am the parent */ ! printf("Child process created, pid=%d.\n", chpid); } return(chpid); Index: sec.c =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/sec.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** sec.c 29 Jan 2004 03:03:21 -0000 1.1.1.1 --- sec.c 11 Mar 2004 22:23:10 -0000 1.2 *************** *** 161,170 **** res = secreadb(sec->skt, buf); if (res < 0) { ! fprintf(stderr, "Read timeout or socket error\n\n"); secclose(sec); return (NULL); } if (res != RES_HELLO) { ! fprintf(stderr, "Expected \"%s\", but got \"%s\"\n", fresponses[RES_HELLO], fresponses[res]); secclose(sec); --- 161,170 ---- res = secreadb(sec->skt, buf); if (res < 0) { ! printf("Read timeout or socket error\n\n"); secclose(sec); return (NULL); } if (res != RES_HELLO) { ! printf("Expected \"%s\", but got \"%s\"\n", fresponses[RES_HELLO], fresponses[res]); secclose(sec); *************** *** 185,194 **** res = secreadb(sec->skt, buf); if (res < 0) { ! fprintf(stderr, "Read timeout or socket error\n\n"); secclose(sec); return (NULL); } if (res != RES_OK) { ! fprintf(stderr, "Unexpected response on IDENT: \"%s\"\n", fresponses[res]); secclose(sec); --- 185,194 ---- res = secreadb(sec->skt, buf); if (res < 0) { ! printf("Read timeout or socket error\n\n"); secclose(sec); return (NULL); } if (res != RES_OK) { ! printf("Unexpected response on IDENT: \"%s\"\n", fresponses[res]); secclose(sec); *************** *** 271,280 **** res = secreadb(sec->skt, buf); if (res < 0) { ! fprintf(stderr, "Read timeout or socket error\n\n"); Sclose(sec); return (EOF); } if (res != RES_OK) { ! fprintf(stderr, "Error setting status %d = %s\n", stat, content); } --- 271,280 ---- res = secreadb(sec->skt, buf); if (res < 0) { ! printf("Read timeout or socket error\n\n"); Sclose(sec); return (EOF); } if (res != RES_OK) { ! printf("Error setting status %d = %s\n", stat, content); } |
From: <st...@us...> - 2004-03-11 22:07:39
|
Update of /cvsroot/uts/uts/src/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3627 Modified Files: camd teld uts_defaults Log Message: Cosmetic fixes in startup scripts. Index: camd =================================================================== RCS file: /cvsroot/uts/uts/src/etc/camd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** camd 5 Mar 2004 18:34:13 -0000 1.1 --- camd 11 Mar 2004 21:40:43 -0000 1.2 *************** *** 26,30 **** if [ ! -f /var/lock/subsys/camd ]; then echo -n 'Starting camd daemon: ' ! $UTS_BIN/camd & RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/camd --- 26,30 ---- if [ ! -f /var/lock/subsys/camd ]; then echo -n 'Starting camd daemon: ' ! daemon $UTS_BIN/camd RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/camd Index: teld =================================================================== RCS file: /cvsroot/uts/uts/src/etc/teld,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** teld 5 Mar 2004 18:34:13 -0000 1.1 --- teld 11 Mar 2004 21:40:43 -0000 1.2 *************** *** 27,31 **** if [ ! -f /var/lock/subsys/teld ]; then echo -n 'Starting Telescope daemon: ' ! $UTS_BIN/teld & RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/teld --- 27,31 ---- if [ ! -f /var/lock/subsys/teld ]; then echo -n 'Starting Telescope daemon: ' ! daemon $UTS_BIN/teld RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/teld Index: uts_defaults =================================================================== RCS file: /cvsroot/uts/uts/src/etc/uts_defaults,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** uts_defaults 4 Mar 2004 20:15:46 -0000 1.1 --- uts_defaults 11 Mar 2004 21:40:43 -0000 1.2 *************** *** 1,7 **** ! UTS_DIR=/home/indus/observatorio/uts UTS_BIN=$UTS_DIR/bin UTS_ETC=$UTS_DIR/etc ! ! ! export UTS_DIR \ No newline at end of file --- 1,7 ---- ! UTS_DIR=/data1/indus/andre/uts UTS_BIN=$UTS_DIR/bin UTS_ETC=$UTS_DIR/etc ! export UTS_DIR ! export PATH="$PATH:$UTS_BIN" ! export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$UTS_DIR/lib" |
From: <st...@us...> - 2004-03-11 21:09:01
|
Update of /cvsroot/uts/uts/src/tel/teld In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23704/tel/teld Modified Files: main.c Log Message: Added command line options to teld and camd. Index: main.c =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.c 9 Mar 2004 22:50:03 -0000 1.3 --- main.c 11 Mar 2004 20:42:07 -0000 1.4 *************** *** 19,22 **** --- 19,23 ---- #include <string.h> #include <signal.h> + #include <getopt.h> #include <setjmp.h> #include "skterror.h" *************** *** 29,49 **** static void goto_bg(void); int main(int argc, char ** argv) { tel_info *tel; - char *uts_dir; char tmpbuf[256]; FILE *conffile; ! printf("\nTelescope daemon ver. 0.01sec - secretary version.\n\n"); ! uts_dir = getenv("UTS_DIR"); ! snprintf(tmpbuf, 255, "%s/etc/teld.conf", uts_dir); ! conffile = fopen(tmpbuf, "r"); if (conffile == NULL) { printf("Config file not found.\n"); --- 30,84 ---- + #define PROGRAM_NAME "Telescope controlling daemon." + #define URL "http://www.astro.ufsc.br/~andre/" + #ifndef VERSION + #define VERSION "Beta" + #endif + + #define ROOT_DIR_ENV_VAR "UTS_DIR" + #define DEF_ROOT_DIR "/usr/local/uts" + #define DEF_CONF_FILE_NAME "/etc/teld.conf" + + + /*** Global variables filled by get_args() ***/ + char *exec_name; /* Name of executable file */ + static char *conffname; /* configuration file */ + static char *logfname; /* log file */ + static int detach = FALSE; /* should the program detach from terminal? */ + + + static void print_title(void); + static void print_help(void); + static void print_version(void); + static void print_usage(void); + static void get_args(int argc, char **argv); static void goto_bg(void); + /*-------------------------------------------------------------------------*/ + int main(int argc, char ** argv) { tel_info *tel; char tmpbuf[256]; FILE *conffile; + /* Parse arguments */ + get_args(argc, argv); ! /* Open log file and redirect stdout, if required */ ! if (logfname != NULL) { ! fprintf(stderr, " -> Logging to file \"%s\".\n", logfname); ! stdout = freopen(logfname, "a", stdout); ! if (stdout == NULL) { ! fprintf(stderr, "*** Error opening file \"%s\".\n", ! logfname); ! exit(1); ! } ! } ! /* Load camfits command line */ ! conffile = fopen(conffname, "r"); if (conffile == NULL) { printf("Config file not found.\n"); *************** *** 51,57 **** } fgets(tmpbuf, 255, conffile); ! printf("Jumping into background\n"); ! goto_bg(); signal(SIGPIPE, pipe_error); /* error handling */ --- 86,98 ---- } fgets(tmpbuf, 255, conffile); + fclose(conffile); ! if (detach) { ! /* Detach from terminal (daemon mode) */ ! fprintf(stderr, " -> Jumping into background...\n\n"); ! goto_bg(); ! /* close stdout if no logfile specified */ ! if (logfname == NULL) fclose(stdout); ! } signal(SIGPIPE, pipe_error); /* error handling */ *************** *** 68,73 **** ! static void goto_bg(void) { int daemon = 0; --- 109,257 ---- + /*-------------------------------------------------------------------------*/ ! static void print_title(void) ! { ! printf("%s - version: %s\n", PROGRAM_NAME, VERSION); ! } ! ! /*-------------------------------------------------------------------------*/ ! ! static void print_help(void) ! { ! print_title(); ! printf("This program requires Socket PortMaster (Spm) and\n"); ! printf("Socket Secretary (sec) running.\n\n\n"); ! print_usage(); ! printf("\nIf no config file is specified, this program will search " ! "under the environment\n" ! "variable %s:\n\n" ! " ${%s}%s\n\n", ROOT_DIR_ENV_VAR, ROOT_DIR_ENV_VAR, ! DEF_CONF_FILE_NAME); ! printf("If this file does not exists, this program will try " ! "the following file:\n\n" ! " %s%s\n\n\n", DEF_ROOT_DIR, DEF_CONF_FILE_NAME); ! printf("Command line options:\n\n" ! " -h / --help\n" ! " This help screen.\n\n" ! ! " -v / --version\n" ! " Display version and copyright " ! " information.\n\n" ! ! " -d / --detach\n" ! " Daemon mode.\n" ! " Put the program in background.\n\n" ! ! " -o <logfile> / --output <logfile>\n" ! " Redirect output to <logfile>,\n" ! " instead of showing it on the terminal.\n\n\n" ! ); ! ! printf("Visit the home page\n" ! "%s\n" ! "for more information.\n\n", URL); ! exit(0); ! } ! ! /*-------------------------------------------------------------------------*/ ! ! static void print_version(void) ! { ! print_title(); ! printf("Copyright (C) 2004 Andre Luiz de Amorim\n"); ! printf("%s comes with NO WARRANTY,\n" ! "to the extent permitted by law.\n", PROGRAM_NAME); ! printf("You may redistribute copies of %s\n" ! "under the terms of the GNU General Public License.\n" ! "For more information about these matters,\n" ! "see the files named COPYING.\n", PROGRAM_NAME); ! ! exit(0); ! } ! ! /*-------------------------------------------------------------------------*/ ! ! static void print_usage(void) ! { ! printf("SYNTAX:\n" ! " %s [-o <logfile>] [-d] [config_file]\n\n" ! " %s {-h|--help}\n\n", exec_name, exec_name); ! } ! ! /*-------------------------------------------------------------------------*/ ! ! static void get_args(int argc, char **argv) ! { ! int next_opt; ! const char *short_options = "hvdo:"; ! const struct option long_options [] = { ! { "help", 0, NULL, 'h' }, ! { "version", 0, NULL, 'v' }, ! { "detach", 0, NULL, 'd' }, ! { "output", 1, NULL, 'o' }, ! { NULL, 0, NULL, 0 } ! }; ! ! exec_name = argv[0]; ! conffname = NULL; ! logfname = NULL; ! do { ! next_opt = getopt_long(argc, argv, short_options, ! long_options, NULL); ! switch (next_opt) { ! case 'h': ! print_help(); ! break; ! ! case 'v': ! print_version(); ! break; ! ! case 'd': ! detach = TRUE; ! break; ! ! case 'o': ! /* log file name */ ! logfname = optarg; ! break; ! ! case '?': ! /* Invalid option */ ! print_usage(); ! exit(1); ! break; ! ! case -1: ! /* end of options */ ! break; ! ! default: ! abort(); ! break; ! } ! } while (next_opt != -1); ! ! if (optind < argc) ! /* config file is the first non-option argument */ ! conffname = argv[optind]; ! ! /* If config file is not specified, try to get it from environment */ ! if (conffname == NULL) { ! int n; ! char *root_dir = getenv(ROOT_DIR_ENV_VAR); ! if (root_dir == NULL) root_dir = DEF_ROOT_DIR; ! ! n = strlen(root_dir) + strlen(DEF_CONF_FILE_NAME) + 1; ! conffname = calloc(n, sizeof(char)); ! strncpy(conffname, root_dir, n); ! strncat(conffname, DEF_CONF_FILE_NAME, n); ! } ! } ! ! /*-------------------------------------------------------------------------*/ ! ! static void goto_bg(void) { int daemon = 0; *************** *** 82,83 **** --- 266,270 ---- } + /*-------------------------------------------------------------------------*/ + + |
From: <st...@us...> - 2004-03-11 21:09:01
|
Update of /cvsroot/uts/uts/src/sec In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23704/sec Modified Files: main.c Log Message: Added command line options to teld and camd. Index: main.c =================================================================== RCS file: /cvsroot/uts/uts/src/sec/main.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** main.c 29 Jan 2004 03:02:41 -0000 1.1.1.1 --- main.c 11 Mar 2004 20:42:06 -0000 1.2 *************** *** 41,47 **** #endif ! #define ROOT_DIR_ENV_VAR "GUTS_DIR" ! #define DEF_ROOT_DIR "/guts" ! #define DEF_CONF_FILE_NAME "/etc/comm.conf" --- 41,47 ---- #endif ! #define ROOT_DIR_ENV_VAR "UTS_DIR" ! #define DEF_ROOT_DIR "/usr/local/uts" ! #define DEF_CONF_FILE_NAME "/etc/sec.conf" *************** *** 50,54 **** static char *conffname; /* configuration file */ static char *logfname; /* log file */ ! static int detach = FALSE; /* the program should detach from terminal? */ --- 50,54 ---- static char *conffname; /* configuration file */ static char *logfname; /* log file */ ! static int detach = FALSE; /* should the program detach from terminal? */ *************** *** 154,158 **** " -v / --version\n" " Display version and copyright " ! "information.\n\n" " -d / --detach\n" --- 154,158 ---- " -v / --version\n" " Display version and copyright " ! " information.\n\n" " -d / --detach\n" |
From: <st...@us...> - 2004-03-11 21:09:01
|
Update of /cvsroot/uts/uts/src/cam/camd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23704/cam/camd Modified Files: main.c Log Message: Added command line options to teld and camd. Index: main.c =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/main.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.c 9 Mar 2004 23:12:47 -0000 1.3 --- main.c 11 Mar 2004 20:42:06 -0000 1.4 *************** *** 17,21 **** --- 17,23 ---- #include <stdio.h> #include <stdlib.h> + #include <string.h> #include <signal.h> + #include <getopt.h> #include <setjmp.h> #include "skterror.h" *************** *** 28,46 **** static void goto_bg(void); int main(int argc, char ** argv) { cam_info *cam; - char *uts_dir; char tmpbuf[256]; FILE *conffile; ! printf("\nCCD daemon ver. 0.3sec - secretary version.\n\n"); ! uts_dir = getenv("UTS_DIR"); ! snprintf(tmpbuf, 255, "%s/etc/camd.conf", uts_dir); ! conffile = fopen(tmpbuf, "r"); if (conffile == NULL) { printf("Config file not found.\n"); --- 30,84 ---- + #define PROGRAM_NAME "CCD camera controlling daemon." + #define URL "http://www.astro.ufsc.br/~andre/" + #ifndef VERSION + #define VERSION "Beta" + #endif + + #define ROOT_DIR_ENV_VAR "UTS_DIR" + #define DEF_ROOT_DIR "/usr/local/uts" + #define DEF_CONF_FILE_NAME "/etc/camd.conf" + + + /*** Global variables filled by get_args() ***/ + char *exec_name; /* Name of executable file */ + static char *conffname; /* configuration file */ + static char *logfname; /* log file */ + static int detach = FALSE; /* should the program detach from terminal? */ + + + static void print_title(void); + static void print_help(void); + static void print_version(void); + static void print_usage(void); + static void get_args(int argc, char **argv); static void goto_bg(void); + /*-------------------------------------------------------------------------*/ + + int main(int argc, char ** argv) { cam_info *cam; char tmpbuf[256]; FILE *conffile; ! /* Parse arguments */ ! get_args(argc, argv); ! /* Open log file and redirect stdout, if required */ ! if (logfname != NULL) { ! fprintf(stderr, " -> Logging to file \"%s\".\n", logfname); ! stdout = freopen(logfname, "a", stdout); ! if (stdout == NULL) { ! fprintf(stderr, "*** Error opening file \"%s\".\n", ! logfname); ! exit(1); ! } ! } ! ! /* Load camfits command line */ ! conffile = fopen(conffname, "r"); if (conffile == NULL) { printf("Config file not found.\n"); *************** *** 48,54 **** } fgets(tmpbuf, 255, conffile); ! printf("Jumping into background...\n"); ! goto_bg(); signal(SIGPIPE, pipe_error); /* error handling */ --- 86,98 ---- } fgets(tmpbuf, 255, conffile); + fclose(conffile); ! if (detach) { ! /* Detach from terminal (daemon mode) */ ! fprintf(stderr, " -> Jumping into background...\n\n"); ! goto_bg(); ! /* close stdout if no logfile specified */ ! if (logfname == NULL) fclose(stdout); ! } signal(SIGPIPE, pipe_error); /* error handling */ *************** *** 65,68 **** --- 109,256 ---- + /*-------------------------------------------------------------------------*/ + + static void print_title(void) + { + printf("%s - version: %s\n", PROGRAM_NAME, VERSION); + } + + /*-------------------------------------------------------------------------*/ + + static void print_help(void) + { + print_title(); + printf("This program requires Socket PortMaster (Spm) and\n"); + printf("Socket Secretary (sec) running.\n\n\n"); + print_usage(); + printf("\nIf no config file is specified, this program will search " + "under the environment\n" + "variable %s:\n\n" + " ${%s}%s\n\n", ROOT_DIR_ENV_VAR, ROOT_DIR_ENV_VAR, + DEF_CONF_FILE_NAME); + printf("If this file does not exists, this program will try " + "the following file:\n\n" + " %s%s\n\n\n", DEF_ROOT_DIR, DEF_CONF_FILE_NAME); + printf("Command line options:\n\n" + " -h / --help\n" + " This help screen.\n\n" + + " -v / --version\n" + " Display version and copyright " + " information.\n\n" + + " -d / --detach\n" + " Daemon mode.\n" + " Put the program in background.\n\n" + + " -o <logfile> / --output <logfile>\n" + " Redirect output to <logfile>,\n" + " instead of showing it on the terminal.\n\n\n" + ); + + printf("Visit the home page\n" + "%s\n" + "for more information.\n\n", URL); + exit(0); + } + + /*-------------------------------------------------------------------------*/ + + static void print_version(void) + { + print_title(); + printf("Copyright (C) 2004 Andre Luiz de Amorim\n"); + printf("%s comes with NO WARRANTY,\n" + "to the extent permitted by law.\n", PROGRAM_NAME); + printf("You may redistribute copies of %s\n" + "under the terms of the GNU General Public License.\n" + "For more information about these matters,\n" + "see the files named COPYING.\n", PROGRAM_NAME); + + exit(0); + } + + + /*-------------------------------------------------------------------------*/ + + static void print_usage(void) + { + printf("SYNTAX:\n" + " %s [-o <logfile>] [-d] [config_file]\n\n" + " %s {-h|--help}\n\n", exec_name, exec_name); + } + + /*-------------------------------------------------------------------------*/ + + static void get_args(int argc, char **argv) + { + int next_opt; + const char *short_options = "hvdo:"; + const struct option long_options [] = { + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'v' }, + { "detach", 0, NULL, 'd' }, + { "output", 1, NULL, 'o' }, + { NULL, 0, NULL, 0 } + }; + + exec_name = argv[0]; + conffname = NULL; + logfname = NULL; + do { + next_opt = getopt_long(argc, argv, short_options, + long_options, NULL); + switch (next_opt) { + case 'h': + print_help(); + break; + + case 'v': + print_version(); + break; + + case 'd': + detach = TRUE; + break; + + case 'o': + /* log file name */ + logfname = optarg; + break; + + case '?': + /* Invalid option */ + print_usage(); + exit(1); + break; + + case -1: + /* end of options */ + break; + + default: + abort(); + break; + } + } while (next_opt != -1); + + if (optind < argc) + /* config file is the first non-option argument */ + conffname = argv[optind]; + + /* If config file is not specified, try to get it from environment */ + if (conffname == NULL) { + int n; + char *root_dir = getenv(ROOT_DIR_ENV_VAR); + if (root_dir == NULL) root_dir = DEF_ROOT_DIR; + + n = strlen(root_dir) + strlen(DEF_CONF_FILE_NAME) + 1; + conffname = calloc(n, sizeof(char)); + strncpy(conffname, root_dir, n); + strncat(conffname, DEF_CONF_FILE_NAME, n); + } + } + + /*-------------------------------------------------------------------------*/ static void goto_bg(void) *************** *** 79,80 **** --- 267,270 ---- } + /*-------------------------------------------------------------------------*/ + |
From: <st...@us...> - 2004-03-09 23:38:13
|
Update of /cvsroot/uts/uts/src/cam/camd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1164 Modified Files: cam.h cam_task.c main.c runchild.c runchild.h Log Message: Made camd read camfits command line from $UTS_DIR/etc/camd.conf Index: cam.h =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/cam.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** cam.h 29 Jan 2004 03:02:34 -0000 1.1.1.1 --- cam.h 9 Mar 2004 23:12:47 -0000 1.2 *************** *** 62,65 **** --- 62,66 ---- inst_ginfo *ginfo; char *childfname; + char *child_cmdline; int chpid; char *device; Index: cam_task.c =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/cam_task.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** cam_task.c 29 Jan 2004 03:02:36 -0000 1.1.1.1 --- cam_task.c 9 Mar 2004 23:12:47 -0000 1.2 *************** *** 35,42 **** --- 35,44 ---- { int chpid; + char cmdline[256]; cam->imaging = TRUE; setstatus(cam->ginfo->sec, CAM_INSTNAME, finststatus[IST_BUSY]); + /* old stuff printf("-> Exec task: Spawning child process.\n"); if (chargs == NULL) chargs = alloc_chargs(8); *************** *** 52,58 **** printf("-> Taking %d %1.2f sec. exposure images...\n", cam->task->nexp, cam->task->exptime); /* fork processess */ ! chpid = spawn_child(cam->childfname, chargs); cam->start = FALSE; --- 54,67 ---- printf("-> Taking %d %1.2f sec. exposure images...\n", cam->task->nexp, cam->task->exptime); + */ + + + /* build command line */ + snprintf(cmdline, 255, cam->child_cmdline, + cam->task->exptime, cam->task->nexp, + cam->task->bfname, index); /* fork processess */ ! chpid = spawn_child(cmdline); cam->start = FALSE; Index: main.c =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.c 5 Mar 2004 19:24:27 -0000 1.2 --- main.c 9 Mar 2004 23:12:47 -0000 1.3 *************** *** 34,44 **** { cam_info *cam; printf("\nCCD daemon ver. 0.3sec - secretary version.\n\n"); ! /* useless, just to get rid of Efence message */ ! free(malloc(1)); ! printf("Jumping into background...n"); goto_bg(); --- 34,53 ---- { cam_info *cam; + char *uts_dir; + char tmpbuf[256]; + FILE *conffile; printf("\nCCD daemon ver. 0.3sec - secretary version.\n\n"); ! uts_dir = getenv("UTS_DIR"); ! snprintf(tmpbuf, 255, "%s/etc/camd.conf", uts_dir); ! conffile = fopen(tmpbuf, "r"); ! if (conffile == NULL) { ! printf("Config file not found.\n"); ! exit(1); ! } ! fgets(tmpbuf, 255, conffile); ! printf("Jumping into background...\n"); goto_bg(); *************** *** 47,50 **** --- 56,61 ---- cam = init_cam(fcamstat); if (cam == NULL) exit(-1); + cam->child_cmdline = calloc(strlen(tmpbuf)+1, sizeof(char)); + strcpy(cam->child_cmdline, tmpbuf); cam_loop(cam); Index: runchild.c =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/runchild.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** runchild.c 29 Jan 2004 03:02:36 -0000 1.1.1.1 --- runchild.c 9 Mar 2004 23:12:47 -0000 1.2 *************** *** 34,38 **** } ! int spawn_child(char *childfname, char **args) { int chpid, res; --- 34,38 ---- } ! int spawn_child(char *child_cmdline) { int chpid, res; *************** *** 42,50 **** if (chpid == 0) { /* I am the child, load the code */ ! res = execvp(childfname, args); ! /* this code should never be reached */ ! fprintf(stderr, "Error spawning child process: %s.\n", ! childfname); exit(EOF); /* this ends the child process, not the daemon */ } --- 42,49 ---- if (chpid == 0) { /* I am the child, load the code */ ! printf("%s\n", child_cmdline); ! res = system(child_cmdline); ! fprintf(stderr, "Child process ended with status: %d\n", res); exit(EOF); /* this ends the child process, not the daemon */ } Index: runchild.h =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/runchild.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** runchild.h 29 Jan 2004 03:02:36 -0000 1.1.1.1 --- runchild.h 9 Mar 2004 23:12:47 -0000 1.2 *************** *** 23,28 **** char **alloc_chargs(int nargs); ! int spawn_child(char *childfname, char **args); ! #endif /* RUNCHILD_H */ \ No newline at end of file --- 23,28 ---- char **alloc_chargs(int nargs); ! int spawn_child(char *child_cmdline); ! #endif /* RUNCHILD_H */ |
From: <st...@us...> - 2004-03-09 23:15:29
|
Update of /cvsroot/uts/uts/src/tel/teld In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28536/src/tel/teld Modified Files: main.c runchild.c runchild.h tel.h tel_task.c Log Message: Teld now reads $UTS_DIR/etc/teld.conf to see how to run telgo. Index: main.c =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.c 5 Mar 2004 19:24:27 -0000 1.2 --- main.c 9 Mar 2004 22:50:03 -0000 1.3 *************** *** 17,20 **** --- 17,21 ---- #include <stdio.h> #include <stdlib.h> + #include <string.h> #include <signal.h> #include <setjmp.h> *************** *** 35,43 **** { tel_info *tel; printf("\nTelescope daemon ver. 0.01sec - secretary version.\n\n"); ! /* useless, just to get rid of Efence message */ ! free(malloc(1)); printf("Jumping into background\n"); --- 36,54 ---- { tel_info *tel; + char *uts_dir; + char tmpbuf[256]; + FILE *conffile; + printf("\nTelescope daemon ver. 0.01sec - secretary version.\n\n"); ! uts_dir = getenv("UTS_DIR"); ! snprintf(tmpbuf, 255, "%s/etc/teld.conf", uts_dir); ! conffile = fopen(tmpbuf, "r"); ! if (conffile == NULL) { ! printf("Config file not found.\n"); ! exit(1); ! } ! fgets(tmpbuf, 255, conffile); printf("Jumping into background\n"); *************** *** 48,51 **** --- 59,64 ---- tel = init_tel(ftelstat); if (tel == NULL) exit(-1); + tel->child_cmdline = calloc(strlen(tmpbuf)+1, sizeof(char)); + strcpy(tel->child_cmdline, tmpbuf); tel_loop(tel); Index: runchild.c =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/runchild.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** runchild.c 29 Jan 2004 03:03:21 -0000 1.1.1.1 --- runchild.c 9 Mar 2004 22:50:03 -0000 1.2 *************** *** 34,38 **** } ! int spawn_child(char *childfname, char **args) { int chpid, res; --- 34,38 ---- } ! int spawn_child(char *child_cmdline) { int chpid, res; *************** *** 42,50 **** if (chpid == 0) { /* I am the child, load the code */ ! res = execvp(childfname, args); ! /* this code should never be reached */ ! fprintf(stderr, "Error spawning child process: %s.\n", ! childfname); exit(EOF); /* this ends the child process, not the daemon */ } --- 42,49 ---- if (chpid == 0) { /* I am the child, load the code */ ! printf("%s\n", child_cmdline); ! res = system(child_cmdline); ! fprintf(stderr, "Child process ended with status: %d\n", res); exit(EOF); /* this ends the child process, not the daemon */ } Index: runchild.h =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/runchild.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** runchild.h 29 Jan 2004 03:03:21 -0000 1.1.1.1 --- runchild.h 9 Mar 2004 22:50:03 -0000 1.2 *************** *** 23,28 **** char **alloc_chargs(int nargs); ! int spawn_child(char *childfname, char **args); ! #endif /* RUNCHILD_H */ \ No newline at end of file --- 23,28 ---- char **alloc_chargs(int nargs); ! int spawn_child(char *child_cmdline); ! #endif /* RUNCHILD_H */ Index: tel.h =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/tel.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** tel.h 29 Jan 2004 03:03:21 -0000 1.1.1.1 --- tel.h 9 Mar 2004 22:50:03 -0000 1.2 *************** *** 49,52 **** --- 49,53 ---- teltask_t *task; + char *child_cmdline; int chpid; char *childfname; Index: tel_task.c =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/tel_task.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** tel_task.c 29 Jan 2004 03:03:21 -0000 1.1.1.1 --- tel_task.c 9 Mar 2004 22:50:03 -0000 1.2 *************** *** 35,41 **** { int chpid; setstatus(tel->ginfo->sec, TEL_INSTNAME, finststatus[IST_BUSY]); ! printf("-> Exec task: Spawning child process.\n"); if (chargs == NULL) chargs = alloc_chargs(6); --- 35,42 ---- { int chpid; + char cmdline[256]; setstatus(tel->ginfo->sec, TEL_INSTNAME, finststatus[IST_BUSY]); ! /* old stuff printf("-> Exec task: Spawning child process.\n"); if (chargs == NULL) chargs = alloc_chargs(6); *************** *** 48,53 **** printf("-> Moving to RA: %s - DEC: %s...\n", tel->task->ra, tel->task->dec); ! /* fork processess */ ! chpid = spawn_child(tel->childfname, chargs); setstatus(tel->ginfo->sec, TEL_MOVING, S_TRUE); --- 49,60 ---- printf("-> Moving to RA: %s - DEC: %s...\n", tel->task->ra, tel->task->dec); ! */ ! ! /* build command line */ ! snprintf(cmdline, 255, tel->child_cmdline, ! tel->task->ra, tel->task->dec); ! ! /* fork processess */ ! chpid = spawn_child(cmdline); setstatus(tel->ginfo->sec, TEL_MOVING, S_TRUE); |
From: <st...@us...> - 2004-03-05 20:27:41
|
Update of /cvsroot/uts/uts/src/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19285 Modified Files: secd spmd Log Message: Fixed start/stop order in init scripts. Index: secd =================================================================== RCS file: /cvsroot/uts/uts/src/etc/secd,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** secd 4 Mar 2004 20:29:55 -0000 1.3 --- secd 5 Mar 2004 20:05:10 -0000 1.4 *************** *** 5,9 **** # Starts the Socket Secretary daemon # ! # chkconfig: 4 41 60 # description: Run socket secretaries for each instrument. --- 5,9 ---- # Starts the Socket Secretary daemon # ! # chkconfig: 4 41 61 # description: Run socket secretaries for each instrument. *************** *** 22,27 **** case "$1" in start) ! echo -n 'Starting Socket Secretary daemon: ' ! daemon $UTS_BIN/runsecs.sh touch /var/lock/subsys/secd echo --- 22,30 ---- case "$1" in start) ! echo -n 'Starting Socket Secretary daemons... ' ! #daemon $UTS_BIN/runsecs.sh ! for INST in `ls -1 $UTS_ETC/*.conf`; do ! daemon $UTS_BIN/sec -d $INST; ! done touch /var/lock/subsys/secd echo *************** *** 29,34 **** stop) echo -n 'Stopping Socket Secretary daemon: ' ! echo ! . $UTS_BIN/stopsecs rm -f /var/lock/subsys/secd echo --- 32,36 ---- stop) echo -n 'Stopping Socket Secretary daemon: ' ! killproc sec rm -f /var/lock/subsys/secd echo Index: spmd =================================================================== RCS file: /cvsroot/uts/uts/src/etc/spmd,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** spmd 4 Mar 2004 20:15:46 -0000 1.2 --- spmd 5 Mar 2004 20:05:28 -0000 1.3 *************** *** 5,9 **** # Starts the Spm daemon # ! # chkconfig: 345 40 60 # description: Spm is the Simple Sockets Library (SSL) # PortMaster. It controls server names and their port numbers. --- 5,9 ---- # Starts the Spm daemon # ! # chkconfig: 4 40 62 # description: Spm is the Simple Sockets Library (SSL) # PortMaster. It controls server names and their port numbers. *************** *** 28,35 **** echo -n 'Starting Spm daemon: ' daemon $UTS_BIN/Spm - sleep 2 RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/Spm echo fi ;; --- 28,35 ---- echo -n 'Starting Spm daemon: ' daemon $UTS_BIN/Spm RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/Spm echo + sleep 2 fi ;; |
From: <st...@us...> - 2004-03-05 19:46:38
|
Update of /cvsroot/uts/uts/src/tel/teld In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10356/src/tel/teld Modified Files: main.c Log Message: Nao lembro.... :( Index: main.c =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/main.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** main.c 29 Jan 2004 03:03:21 -0000 1.1.1.1 --- main.c 5 Mar 2004 19:24:27 -0000 1.2 *************** *** 28,31 **** --- 28,32 ---- + static void goto_bg(void); *************** *** 40,43 **** --- 41,46 ---- free(malloc(1)); + printf("Jumping into background\n"); + goto_bg(); signal(SIGPIPE, pipe_error); /* error handling */ *************** *** 53,54 **** --- 56,70 ---- + static void goto_bg(void) + { + int daemon = 0; + + daemon = fork(); + if (daemon < 0) fprintf(stderr, + "*** Error: Could not detach from terminal\n"); + else if (daemon) exit(0); /* We're the parent, so bye-bye! */ + + setsid(); /* release controlling terminal */ + + } + |
From: <st...@us...> - 2004-03-05 19:46:38
|
Update of /cvsroot/uts/uts/src/cam/camd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10356/src/cam/camd Modified Files: main.c Log Message: Nao lembro.... :( Index: main.c =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/main.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** main.c 29 Jan 2004 03:02:36 -0000 1.1.1.1 --- main.c 5 Mar 2004 19:24:27 -0000 1.2 *************** *** 28,32 **** ! --- 28,32 ---- ! static void goto_bg(void); *************** *** 40,43 **** --- 40,45 ---- free(malloc(1)); + printf("Jumping into background...n"); + goto_bg(); signal(SIGPIPE, pipe_error); /* error handling */ *************** *** 53,54 **** --- 55,69 ---- + static void goto_bg(void) + { + int daemon = 0; + + daemon = fork(); + if (daemon < 0) fprintf(stderr, + "*** Error: Could not detach from terminal\n"); + else if (daemon) exit(0); /* We're the parent, so bye-bye! */ + + setsid(); /* release controlling terminal */ + + } + |
From: <st...@us...> - 2004-03-05 18:56:22
|
Update of /cvsroot/uts/uts/src/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32213 Added Files: camd teld Log Message: Added init scripts for loadind teld and camd. --- NEW FILE: camd --- #!/bin/bash # # /etc/rc.d/init.d/camd # # Starts the CCD camera daemon # # chkconfig: 4 42 60 # description: Controls the CCD camera # processname: camd # Source function library. . /etc/rc.d/init.d/functions . /etc/rc.d/init.d/uts_defaults test -x $UTS_BIN/camd || exit 0 RETVAL=0 # # See how we were called. # case "$1" in start) # Check if camerad is already running if [ ! -f /var/lock/subsys/camd ]; then echo -n 'Starting camd daemon: ' $UTS_BIN/camd & RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/camd echo fi ;; stop) echo -n 'Stopping camd daemon: ' killproc $UTS_BIN/camd RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/camd echo ;; reload|restart) $0 stop $0 start RETVAL=$? ;; status) status $UTS_BIN/camd RETVAL=$? ;; *) echo "Usage: /etc/rc.d/init.d/camd {start|stop|restart|reload|status}" exit 1 esac exit $RETVAL --- NEW FILE: teld --- #!/bin/bash # # /etc/rc.d/init.d/teld # # Starts the Telescope daemon # # chkconfig: 4 43 60 # description: Controls thje telescope. # processname: Spm # Source function library. . /etc/rc.d/init.d/functions . /etc/rc.d/init.d/uts_defaults test -x $UTS_BIN/teld || exit 0 RETVAL=0 # # See how we were called. # case "$1" in start) # Check if teld is already running if [ ! -f /var/lock/subsys/teld ]; then echo -n 'Starting Telescope daemon: ' $UTS_BIN/teld & RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/teld echo fi ;; stop) echo -n 'Stopping Telescope daemon: ' killproc $UTS_BIN/teld RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/teld echo ;; reload|restart) $0 stop $0 start RETVAL=$? ;; status) status $UTS_BIN/teld RETVAL=$? ;; *) echo "Usage: /etc/rc.d/init.d/teld {start|stop|restart|reload|status}" exit 1 esac exit $RETVAL |
From: <st...@us...> - 2004-03-05 17:09:19
|
Update of /cvsroot/uts/uts/src/tel/teld In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7500/src/tel/teld Modified Files: skterror.c Log Message: Changed 'error' to 's_error' in several skterror.c files. Index: skterror.c =================================================================== RCS file: /cvsroot/uts/uts/src/tel/teld/skterror.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** skterror.c 29 Jan 2004 03:03:21 -0000 1.1.1.1 --- skterror.c 5 Mar 2004 16:47:09 -0000 1.2 *************** *** 24,28 **** static Socket *watch_socket; ! static int error; /* prepare to write socket */ --- 24,28 ---- static Socket *watch_socket; ! static int s_error; /* prepare to write socket */ *************** *** 30,34 **** { watch_socket = skt; ! error = FALSE; } --- 30,34 ---- { watch_socket = skt; ! s_error = FALSE; } *************** *** 36,40 **** int skterror(void) { ! if (error) return (1); return (0); } --- 36,40 ---- int skterror(void) { ! if (s_error) return (1); return (0); } *************** *** 47,51 **** "\n\n*** Error: Attempt to write to a broken socket.\n"); ! error = TRUE; ! } \ No newline at end of file --- 47,51 ---- "\n\n*** Error: Attempt to write to a broken socket.\n"); ! s_error = TRUE; ! } |
From: <st...@us...> - 2004-03-05 17:09:19
|
Update of /cvsroot/uts/uts/src/cam/camd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7500/src/cam/camd Modified Files: skterror.c Log Message: Changed 'error' to 's_error' in several skterror.c files. Index: skterror.c =================================================================== RCS file: /cvsroot/uts/uts/src/cam/camd/skterror.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** skterror.c 29 Jan 2004 03:02:37 -0000 1.1.1.1 --- skterror.c 5 Mar 2004 16:47:08 -0000 1.2 *************** *** 24,28 **** static Socket *watch_socket; ! static int error; /* prepare to write socket */ --- 24,28 ---- static Socket *watch_socket; ! static int s_error; /* prepare to write socket */ *************** *** 30,34 **** { watch_socket = skt; ! error = FALSE; } --- 30,34 ---- { watch_socket = skt; ! s_error = FALSE; } *************** *** 36,40 **** int skterror(void) { ! if (error) return (1); return (0); } --- 36,40 ---- int skterror(void) { ! if (s_error) return (1); return (0); } *************** *** 47,51 **** "\n\n*** Error: Attempt to write to a broken socket.\n"); ! error = TRUE; ! } \ No newline at end of file --- 47,51 ---- "\n\n*** Error: Attempt to write to a broken socket.\n"); ! s_error = TRUE; ! } |
From: <st...@us...> - 2004-03-05 17:09:19
|
Update of /cvsroot/uts/uts/src/sync/syncd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7500/src/sync/syncd Modified Files: skterror.c Log Message: Changed 'error' to 's_error' in several skterror.c files. Index: skterror.c =================================================================== RCS file: /cvsroot/uts/uts/src/sync/syncd/skterror.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** skterror.c 29 Jan 2004 03:02:47 -0000 1.1.1.1 --- skterror.c 5 Mar 2004 16:47:09 -0000 1.2 *************** *** 25,29 **** static Socket *watch_socket; ! static int error; --- 25,29 ---- static Socket *watch_socket; ! static int s_error; *************** *** 33,37 **** { watch_socket = skt; ! error = FALSE; } --- 33,37 ---- { watch_socket = skt; ! s_error = FALSE; } *************** *** 40,44 **** int skterror(void) { ! if (error) return (1); return (0); } --- 40,44 ---- int skterror(void) { ! if (s_error) return (1); return (0); } *************** *** 52,56 **** "\n\n*** Error: Attempt to write to a broken socket.\n"); ! error = TRUE; } --- 52,56 ---- "\n\n*** Error: Attempt to write to a broken socket.\n"); ! s_error = TRUE; } |
From: <st...@us...> - 2004-03-05 16:16:02
|
Update of /cvsroot/uts/uts/src/sec In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26761 Modified Files: skterror.c Log Message: renamed varible 'error' to 's_error' in skterror.c due to name conflict. Index: skterror.c =================================================================== RCS file: /cvsroot/uts/uts/src/sec/skterror.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** skterror.c 29 Jan 2004 03:02:42 -0000 1.1.1.1 --- skterror.c 5 Mar 2004 15:53:56 -0000 1.2 *************** *** 24,28 **** static Socket *watch_socket; ! static int error; /* prepare to write to Status socket */ --- 24,28 ---- static Socket *watch_socket; ! static int s_error; /* prepare to write to Status socket */ *************** *** 30,34 **** { watch_socket = skt; ! error = FALSE; } --- 30,34 ---- { watch_socket = skt; ! s_error = FALSE; } *************** *** 36,40 **** int skterror(void) { ! if (error) return (1); return (0); } --- 36,40 ---- int skterror(void) { ! if (s_error) return (1); return (0); } *************** *** 46,50 **** printf("\n\n*** Error: Attempt to write to a broken socket.\n"); ! error = TRUE; } --- 46,50 ---- printf("\n\n*** Error: Attempt to write to a broken socket.\n"); ! s_error = TRUE; } |