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

int gp_port_check_int_fast ( GPPort port,
char *  data,
int  size 
)

Check for interrupt without wait.

Parameters:
port a GPPort
data a pointer to an allocated buffer
size the number of bytes that should be read
Reads a specified number of bytes from the inerrupt endpoint into the supplied buffer. Function waits 50 miliseconds for data on interrupt endpoint.

Returns:
a gphoto2 error code

Definition at line 453 of file gphoto2-port.c.

References _GPPortOperations::check_int, CHECK_NULL, CHECK_RESULT, FAST_TIMEOUT, gp_log(), gp_log_data(), GP_LOG_DEBUG, _GPPortPrivateCore::ops, and _GPPort::pc.

{
        int retval;

      CHECK_NULL (port);
      CHECK_INIT (port);

      /* Check if we read as many bytes as expected */
      CHECK_SUPP (port, "check_int", port->pc->ops->check_int);
      retval = port->pc->ops->check_int (port, data, size, FAST_TIMEOUT);
      CHECK_RESULT (retval);

#ifdef IGNORE_EMPTY_INTR_READS
      if (retval != size && retval != 0 )
#else
      if (retval != size )
#endif
            gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Could only read %i "
                  "out of %i byte(s)"), retval, size);

#ifdef IGNORE_EMPTY_INTR_READS
      if ( retval != 0 ) {
#endif
            /* For Canon cameras, we will make lots of
               reads that will return zero length. Don't
               bother to log them as errors. */
            gp_log (GP_LOG_DEBUG, "gphoto2-port",
                  _("Reading %i=0x%x bytes from interrupt endpoint (fast)..."),
                  size, size);
            gp_log_data ("gphoto2-port", data, retval);
#ifdef IGNORE_EMPTY_INTR_READS
      }
#endif

      return (retval);
}


Generated by  Doxygen 1.6.0   Back to index