libgphoto2 photo camera library (libgphoto2) Internals
2.5.26
|
#include "config.h"
#include <gphoto2/gphoto2-port-info-list.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ltdl.h>
#include <gphoto2/gphoto2-port-result.h>
#include <gphoto2/gphoto2-port-library.h>
#include <gphoto2/gphoto2-port-log.h>
#include "gphoto2-port-info.h"
Go to the source code of this file.
Data Structures | |
struct | _GPPortInfoList |
Macros | |
#define | _GNU_SOURCE |
#define | textdomain(String) (String) |
#define | gettext(String) (String) |
#define | dgettext(Domain, Message) (Message) |
#define | dcgettext(Domain, Message, Type) (Message) |
#define | bindtextdomain(Domain, Directory) (Domain) |
#define | bind_textdomain_codeset(Domain, codeset) (codeset) |
#define | ngettext(String1, String2, Count) ((Count==1)?String1:String2) |
#define | _(String) (String) |
#define | N_(String) (String) |
#define | CR(x) {int r=(x);if (r<0) return (r);} |
Functions | |
const char * | gp_port_message_codeset (const char *codeset) |
Specify codeset for translations. More... | |
int | gp_port_info_list_new (GPPortInfoList **list) |
Create a new GPPortInfoList. More... | |
int | gp_port_info_list_free (GPPortInfoList *list) |
Free a GPPortInfo list. More... | |
int | gp_port_info_list_append (GPPortInfoList *list, GPPortInfo info) |
Append a portinfo to the port information list. More... | |
static int | foreach_func (const char *filename, lt_ptr data) |
int | gp_port_info_list_load (GPPortInfoList *list) |
Load system ports. More... | |
int | gp_port_info_list_count (GPPortInfoList *list) |
Number of ports in the list. More... | |
int | gp_port_info_list_lookup_path (GPPortInfoList *list, const char *path) |
Lookup a specific path in the list. More... | |
int | gp_port_info_list_lookup_name (GPPortInfoList *list, const char *name) |
Look up a name in the list. More... | |
int | gp_port_info_list_get_info (GPPortInfoList *list, int n, GPPortInfo *info) |
Get port information of specific entry. More... | |
int | gp_port_info_get_name (GPPortInfo info, char **name) |
Get name of a specific port entry. More... | |
int | gp_port_info_set_name (GPPortInfo info, const char *name) |
Set name of a specific port entry. More... | |
int | gp_port_info_get_path (GPPortInfo info, char **path) |
Get path of a specific port entry. More... | |
int | gp_port_info_set_path (GPPortInfo info, const char *path) |
Set path of a specific port entry. More... | |
int | gp_port_info_get_type (GPPortInfo info, GPPortType *type) |
Get type of a specific port entry. More... | |
int | gp_port_info_set_type (GPPortInfo info, GPPortType type) |
Set type of a specific port entry. More... | |
int | gp_port_info_new (GPPortInfo *info) |
Create a new portinfo. More... | |
Definition in file gphoto2-port-info-list.c.
#define _ | ( | String | ) | (String) |
Definition at line 65 of file gphoto2-port-info-list.c.
#define _GNU_SOURCE |
Definition at line 23 of file gphoto2-port-info-list.c.
#define bind_textdomain_codeset | ( | Domain, | |
codeset | |||
) | (codeset) |
Definition at line 63 of file gphoto2-port-info-list.c.
#define bindtextdomain | ( | Domain, | |
Directory | |||
) | (Domain) |
Definition at line 62 of file gphoto2-port-info-list.c.
#define CR | ( | x | ) | {int r=(x);if (r<0) return (r);} |
Definition at line 80 of file gphoto2-port-info-list.c.
#define dcgettext | ( | Domain, | |
Message, | |||
Type | |||
) | (Message) |
Definition at line 61 of file gphoto2-port-info-list.c.
#define dgettext | ( | Domain, | |
Message | |||
) | (Message) |
Definition at line 60 of file gphoto2-port-info-list.c.
#define gettext | ( | String | ) | (String) |
Definition at line 59 of file gphoto2-port-info-list.c.
#define N_ | ( | String | ) | (String) |
Definition at line 66 of file gphoto2-port-info-list.c.
#define ngettext | ( | String1, | |
String2, | |||
Count | |||
) | ((Count==1)?String1:String2) |
Definition at line 64 of file gphoto2-port-info-list.c.
#define textdomain | ( | String | ) | (String) |
Definition at line 58 of file gphoto2-port-info-list.c.
|
static |
Definition at line 196 of file gphoto2-port-info-list.c.
References _GPPortInfoList::count, gp_port_result_as_string(), _GPPortInfoList::info, _GPPortInfoList::iolib_count, _GPPortInfo::library_filename, _GPPortInfo::name, _GPPortInfo::path, result, and _GPPortInfo::type.
Referenced by gp_port_info_list_load().
int gp_port_info_get_name | ( | GPPortInfo | info, |
char ** | name | ||
) |
Get name of a specific port entry.
info | a GPPortInfo |
name | a pointer to a char* which will receive the name |
Retreives the name of the passed in GPPortInfo, by reference.
Definition at line 492 of file gphoto2-port-info-list.c.
References GP_OK, and _GPPortInfo::name.
Referenced by gp_camera_set_port_info().
int gp_port_info_get_path | ( | GPPortInfo | info, |
char ** | path | ||
) |
Get path of a specific port entry.
info | a GPPortInfo |
path | a pointer to a char* which will receive the path |
Retreives the path of the passed in GPPortInfo, by reference.
Definition at line 523 of file gphoto2-port-info-list.c.
References GP_OK, and _GPPortInfo::path.
Referenced by gp_abilities_list_detect(), gp_camera_init(), and gp_camera_set_port_info().
int gp_port_info_get_type | ( | GPPortInfo | info, |
GPPortType * | type | ||
) |
Get type of a specific port entry.
info | a GPPortInfo |
type | a pointer to a GPPortType variable which will receive the type |
Retreives the type of the passed in GPPortInfo
Definition at line 554 of file gphoto2-port-info-list.c.
References GP_OK, and _GPPortInfo::type.
Referenced by gp_abilities_list_detect(), and gp_camera_init().
int gp_port_info_list_append | ( | GPPortInfoList * | list, |
GPPortInfo | info | ||
) |
Append a portinfo to the port information list.
list | a GPPortInfoList |
info | the info to append |
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 successful - will append this entry to the list.
Definition at line 177 of file gphoto2-port-info-list.c.
References _GPPortInfoList::count, _GPPortInfoList::info, and _GPPortInfo::name.
Referenced by gp_port_info_list_lookup_path().
int gp_port_info_list_count | ( | GPPortInfoList * | list | ) |
Number of ports in the list.
list | a GPPortInfoList |
Returns the number of entries in the passed list.
Definition at line 305 of file gphoto2-port-info-list.c.
References _GPPortInfoList::count, _GPPortInfoList::info, and _GPPortInfo::name.
Referenced by gp_abilities_list_detect(), and gp_camera_autodetect().
int gp_port_info_list_free | ( | GPPortInfoList * | list | ) |
Free a GPPortInfo list.
list | a GPPortInfoList |
Frees a GPPortInfoList structure and its internal data structures.
Definition at line 135 of file gphoto2-port-info-list.c.
References _GPPortInfoList::count, GP_OK, _GPPortInfoList::info, _GPPortInfo::library_filename, _GPPortInfo::name, and _GPPortInfo::path.
Referenced by gp_camera_autodetect(), and gp_camera_init().
int gp_port_info_list_get_info | ( | GPPortInfoList * | list, |
int | n, | ||
GPPortInfo * | info | ||
) |
Get port information of specific entry.
list | a GPPortInfoList |
n | the index of the entry |
info | the returned information |
Returns a pointer to the current port entry.
Definition at line 460 of file gphoto2-port-info-list.c.
References _GPPortInfoList::count, GP_OK, _GPPortInfoList::info, and _GPPortInfo::name.
Referenced by gp_abilities_list_detect(), and gp_camera_init().
int gp_port_info_list_load | ( | GPPortInfoList * | list | ) |
Load system ports.
list | a GPPortInfoList |
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 or to do autodetection.
Definition at line 274 of file gphoto2-port-info-list.c.
References foreach_func(), GP_ERROR_LIBRARY, GP_OK, _GPPortInfoList::iolib_count, and result.
Referenced by gp_camera_autodetect(), and gp_camera_init().
int gp_port_info_list_lookup_name | ( | GPPortInfoList * | list, |
const char * | name | ||
) |
Look up a name in the list.
list | a GPPortInfoList |
name | a name |
Looks for an entry in the list with the exact given name.
Definition at line 431 of file gphoto2-port-info-list.c.
References _GPPortInfoList::count, GP_ERROR_UNKNOWN_PORT, _GPPortInfoList::info, and _GPPortInfo::name.
int gp_port_info_list_lookup_path | ( | GPPortInfoList * | list, |
const char * | path | ||
) |
Lookup a specific path in the list.
list | a GPPortInfoList |
path | a 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:*".
Definition at line 336 of file gphoto2-port-info-list.c.
References _, _GPPortInfoList::count, CR, GP_ERROR_UNKNOWN_PORT, gp_port_info_list_append(), gp_port_info_new(), gp_port_info_set_name(), gp_port_info_set_path(), gp_port_info_set_type(), _GPPortInfoList::info, _GPPortInfo::library_filename, _GPPortInfo::name, _GPPortInfo::path, result, and _GPPortInfo::type.
Referenced by gp_camera_init().
int gp_port_info_list_new | ( | GPPortInfoList ** | list | ) |
Create a new GPPortInfoList.
list | pointer to a GPPortInfoList* which is allocated |
Creates a new list which can later be filled with port infos (GPPortInfo) using gp_port_info_list_load.
Definition at line 111 of file gphoto2-port-info-list.c.
References bindtextdomain, and GP_OK.
Referenced by gp_camera_autodetect(), and gp_camera_init().
int gp_port_info_new | ( | GPPortInfo * | info | ) |
Create a new portinfo.
info | pointer to a GPPortInfo |
Allocates and initializes a GPPortInfo structure. This is a libgphoto2_port internal function.
Definition at line 585 of file gphoto2-port-info-list.c.
References GP_OK.
Referenced by gp_port_info_list_lookup_path().
int gp_port_info_set_name | ( | GPPortInfo | info, |
const char * | name | ||
) |
Set name of a specific port entry.
info | a GPPortInfo |
name | a char* pointer which will receive the name |
Sets the name of the passed in GPPortInfo This is a libgphoto2_port internal function.
Definition at line 508 of file gphoto2-port-info-list.c.
References GP_OK, and _GPPortInfo::name.
Referenced by gp_port_info_list_lookup_path().
int gp_port_info_set_path | ( | GPPortInfo | info, |
const char * | path | ||
) |
Set path of a specific port entry.
info | a GPPortInfo |
path | a char* pointer which will receive the path |
Sets the path of the passed in GPPortInfo This is a libgphoto2_port internal function.
Definition at line 539 of file gphoto2-port-info-list.c.
References GP_OK, and _GPPortInfo::path.
Referenced by gp_port_info_list_lookup_path().
int gp_port_info_set_type | ( | GPPortInfo | info, |
GPPortType | type | ||
) |
Set type of a specific port entry.
info | a GPPortInfo |
type | a GPPortType variable which will has the type |
Sets the type of the passed in GPPortInfo This is a libgphoto2_port internal function.
Definition at line 570 of file gphoto2-port-info-list.c.
References GP_OK, and _GPPortInfo::type.
Referenced by gp_port_info_list_lookup_path().
const char* gp_port_message_codeset | ( | const char * | codeset | ) |
Specify codeset for translations.
This function specifies the codeset that are used for the translated strings that are passed back by the libgphoto2_port functions.
This function is called by the gp_message_codeset() function, there is no need to call it yourself.
codeset | new codeset to use |
Definition at line 96 of file gphoto2-port-info-list.c.
References bind_textdomain_codeset.
Referenced by gp_message_codeset().