| GPhoto2-Port API Reference Manual | |||
|---|---|---|---|
| <<< Previous Page | Home | Up | Next Page >>> |
enum GPPortType; struct GPPortInfo; struct GPPortInfoList; int gp_port_info_list_new (GPPortInfoList **list); int gp_port_info_list_free (GPPortInfoList *list); int gp_port_info_list_load (GPPortInfoList *list); int gp_port_info_list_count (GPPortInfoList *list); int gp_port_info_list_get_info (GPPortInfoList *list, int n, GPPortInfo *info); int gp_port_info_list_lookup_path (GPPortInfoList *list, const char *path); int gp_port_info_list_lookup_name (GPPortInfoList *list, const char *name); int gp_port_info_list_append (GPPortInfoList *list, GPPortInfo info); |
typedef enum {
GP_PORT_NONE = 0,
GP_PORT_SERIAL = 1 << 0,
GP_PORT_USB = 1 << 2
} GPPortType; |
struct GPPortInfo {
GPPortType type;
char name[64];
char path[64];
/* Private */
char library_filename[1024];
}; |
int gp_port_info_list_new (GPPortInfoList **list); |
Creates a new list which can later be filled with port infos (GPPortInfo) using gp_port_info_list_load.
| list : | |
| Returns : | a gphoto2 error code |
int gp_port_info_list_free (GPPortInfoList *list); |
Frees a list.
| list : | |
| Returns : | a gphoto2 error code |
int gp_port_info_list_load (GPPortInfoList *list); |
Searches the system for io-drivers and appends them to the list. You would normally call this function once after gp_port_info_list_new and then use this list in order to supply gp_port_set_info with parameters.
| list : | |
| Returns : | a gphoto2 error code |
int gp_port_info_list_count (GPPortInfoList *list); |
Returns the number of entries in the list.
| list : | |
| Returns : | The number of entries or a gphoto2 error code |
int gp_port_info_list_get_info (GPPortInfoList *list, int n, GPPortInfo *info); |
Retreives an entry from the list.
| list : | |
| n : | the index of the entry |
| info : | |
| Returns : | a gphoto2 error code |
int gp_port_info_list_lookup_path (GPPortInfoList *list, const char *path); |
Looks for an entry in the list with the supplied path. If no exact match can be found, a regex search will be performed in the hope some driver claimed ports like "serial:*".
| list : | |
| path : | a path |
| Returns : | The index of the entry or a gphoto2 error code |
int gp_port_info_list_lookup_name (GPPortInfoList *list, const char *name); |
Looks for an entry in the list with the given name.
| list : | |
| name : | a name |
| Returns : | The index of the entry or a gphoto2 error code |
int gp_port_info_list_append (GPPortInfoList *list, GPPortInfo info); |
Appends an entry to the list. This function is typically called by an io-driver during gp_port_library_list. If you leave info.name blank, gp_port_info_list_lookup_path will try to match non-existent paths against info.path and - if successfull - will append this entry to the list.
| list : | |
| info : | the info to append |
| Returns : | The index of the new entry or a gphoto2 error code |