Logo Search packages:      
Sourcecode: qcam version File versions  Download package

probeqcam.c

/* probeqcam.c -- try to autodetect the QuickCam */

/* Version 0.2, January 3, 1996 */


/******************************************************************

Copyright (C) 1996 by Scott Laird

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL SCOTT LAIRD BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

******************************************************************/

#include <stdio.h>
#include <stdlib.h>

#include <unistd.h>

#include "qcam.h"

int main(int argc, char **argv)
{
  struct qcam *q;
  int ioports[]={0x378, 0x278, 0x3bc,0};
  int i=0;

  /* Read defaults */

  q=qc_init();
  qc_initfile(q, 0);

  /* Attempt to get permission to access IO ports.  Must be root */

  while(ioports[i]!=0) {
    q->port=ioports[i++];

    if (qc_open(q)) {
      perror("Can't get I/O permission");
      exit(1);
    }

    if(qc_detect(q))
      fprintf(stderr,"QuickCam detected at 0x%x\n",q->port);
    else
      fprintf(stderr,"QuickCam not found on 0x%x\n",q->port);
    qc_close(q);
  }

  return 0;
}

Generated by  Doxygen 1.6.0   Back to index