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

int gp_camera_set_port_speed ( Camera *  camera,
int  speed 

gp_camera_set_port_speed: : a Camera : the speed

Sets the speed. This function is typically used prior first initialization using gp_camera_init for debugging purposes. Normally, a camera driver will try to figure out the current speed of the camera and set the speed to the optimal one automatically. Note that this function only works with serial ports. In other words, you have to set the camera's port to a serial one (using gp_camera_set_port_path or gp_camera_set_port_name) prior calling this function.

Return value: a gphoto2 error code

Definition at line 474 of file gphoto2-camera.c.

References gp_camera_exit().

      GPPortSettings settings;

      CHECK_NULL (camera);

      if (!camera->port) {
            gp_log (GP_LOG_ERROR, "camera", "You need to set "
                  "a port prior trying to set the speed");
            return (GP_ERROR_BAD_PARAMETERS);

      if (camera->port->type != GP_PORT_SERIAL) {
            gp_log (GP_LOG_ERROR, "camera", "You can specify "
                  "a speed only with serial ports");
            return (GP_ERROR_BAD_PARAMETERS);

       * If the camera is currently initialized, terminate that connection.
       * We don't care if we are successful or not.
      if (camera->pc->lh)
            gp_camera_exit (camera, NULL);

      CR (camera, gp_port_get_settings (camera->port, &settings), NULL);
      settings.serial.speed = speed;
      CR (camera, gp_port_set_settings (camera->port, settings), NULL);
      camera->pc->speed = speed;

      return (GP_OK);

Generated by  Doxygen 1.6.0   Back to index