Logo Search packages:      
Sourcecode: libgphoto2 version File versions

int gp_port_info_list_get_info ( GPPortInfoList list,
int  n,
GPPortInfo info 
)

Get port information of specific entry.

Parameters:
list a GPPortInfoList
n the index of the entry
info the returned information
Retreives an entry from the list and stores it into info.

Returns:
a gphoto2 error code

Definition at line 465 of file gphoto2-port-info-list.c.

References CHECK_NULL, _GPPortInfoList::count, GP_ERROR_BAD_PARAMETERS, gp_log(), GP_LOG_DEBUG, GP_OK, _GPPortInfoList::info, and _GPPortInfo::name.

Referenced by gp_abilities_list_detect(), and gp_camera_init().

{
      int i;

      CHECK_NULL (list && info);

      gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list", _("Getting info of "
            "entry %i (%i available)..."), n, list->count);

      if (n < 0 || n >= list->count)
            return (GP_ERROR_BAD_PARAMETERS);

      /* Ignore generic entries */
      for (i = 0; i <= n; i++)
            if (!strlen (list->info[i].name))
                  n++;

      if (n >= list->count)
            return (GP_ERROR_BAD_PARAMETERS);

      memcpy (info, &(list->info[n]), sizeof (GPPortInfo));

      return (GP_OK);
}


Generated by  Doxygen 1.6.0   Back to index