Device-QuickCam

 view release on metacpan or  search on metacpan

libcqcam/port.C  view on Meta::CPAN

#endif /* which OS */

#include "port.h"

port_t::port_t(int iport) {
  port = -1;

#ifdef LOCKING
  if (lock(iport) == -1) {
#ifdef DEBUG
    fprintf(stderr, "port 0x%x already locked\n", iport);
#endif /* DEBUG */
    return;
  }
#endif /* LOCKING */

#ifdef LINUX
#ifdef arm
  if ((devport = open("/dev/port", O_RDWR)) < 0) {
    perror("open /dev/port");
    return;

libcqcam/port.C  view on Meta::CPAN

}
    
void port_t::unlock(int portnum) {
  if (portnum == -1)
    return;
  close(lock_fd);    // this clears the lock
  char lockfile[80];
  sprintf(lockfile, "/tmp/LOCK.qcam.0x%x", portnum);
  if (unlink(lockfile)) perror(lockfile);
#ifdef DEBUG
  fprintf(stderr, "Unlocked port 0x%x\n", portnum);
#endif /* DEBUG */
}
#endif /* LOCKING */



( run in 0.731 second using v1.01-cache-2.11-cpan-49f99fa48dc )