libgphoto2 photo camera library (libgphoto2) Internals
2.5.23
|
Go to the documentation of this file.
41 # define _(String) dgettext (GETTEXT_PACKAGE, String)
43 # define N_(String) gettext_noop (String)
45 # define N_(String) (String)
48 # define textdomain(String) (String)
49 # define gettext(String) (String)
50 # define dgettext(Domain,Message) (Message)
51 # define dcgettext(Domain,Message,Type) (Message)
52 # define bindtextdomain(Domain,Directory) (Domain)
53 # define bind_textdomain_codeset(Domain,Charset) (Domain)
54 # define _(String) (String)
55 # define N_(String) (String)
59 #define CHECK_RESULT(result) {int r = (result); if (r < 0) return (r);}
149 GP_LOG_D (
"Found '%s'.", filename);
163 int ret, x, old_count, new_count;
165 const char *filename;
170 C_PARAMS (list && dir);
172 GP_LOG_D (
"Using ltdl to load camera libraries from '%s'...", dir);
181 foreach_data.
list = flist;
183 lt_dladdsearchdir (dir);
184 ret = lt_dlforeachfile (dir,
foreach_func, &foreach_data);
188 GP_LOG_E (
"Internal error looking for camlibs (%d)", ret);
190 _(
"Internal error looking for camlibs. "
191 "(path names too long?)"));
200 GP_LOG_D (
"Found %i camera drivers.", count);
203 _(
"Loading camera drivers from '%s'..."), dir);
204 for (i = 0; i < count; i++) {
210 lh = lt_dlopenext (filename);
212 GP_LOG_D (
"Failed to load '%s': %s.", filename,
218 id = lt_dlsym (lh,
"camera_id");
220 GP_LOG_D (
"Library '%s' does not seem to "
221 "contain a camera_id function: %s",
222 filename, lt_dlerror ());
231 if (
id (&text) !=
GP_OK) {
241 ab = lt_dlsym (lh,
"camera_abilities");
243 GP_LOG_D (
"Library '%s' does not seem to "
244 "contain a camera_abilities function: "
245 "%s", filename, lt_dlerror ());
256 if (ab (list) !=
GP_OK) {
262 #if !defined(VALGRIND)
271 for (x = old_count; x < new_count; x++) {
304 const char *camlib_env = getenv(CAMLIBDIR_ENV);
305 const char *camlibs = (camlib_env != NULL)?camlib_env:CAMLIBS;
317 int *ability,
GPPort *port)
324 GP_LOG_D (
"Auto-detecting USB cameras...");
326 for (i = 0; i < count; i++) {
337 GP_LOG_D (
"Found '%s' (0x%x,0x%x)",
347 "gp_port_usb_find_device(vendor=0x%x, "
348 "product=0x%x) returned %i, clearing "
349 "error message on port", v, p, res);
362 GP_LOG_D (
"Found '%s' (0x%x,0x%x,0x%x)",
372 "gp_port_usb_find_device_by_class("
373 "class=0x%x, subclass=0x%x, "
374 "protocol=0x%x) returned %i, "
375 "clearing error message on port",
408 C_PARAMS (list && info_list && l);
415 for (i = 0; i < info_count; i++) {
446 s = strchr (xpath,
':');
450 snprintf (path,
sizeof(path),
"%s/DCIM", s);
451 if (-1 == stat(path, &stbuf)) {
452 snprintf (path,
sizeof(path),
"%s/dcim", s);
453 if (-1 == stat(path, &stbuf))
462 s = strchr (xpath,
':');
465 if (!strlen(s))
break;
492 ch = strchr(str,
':');
564 return (list->
count);
590 C_PARAMS (list &&
id);
592 for (x = 0; x < list->
count; x++)
611 C_PARAMS (list && model);
613 for (x = 0; x < list->
count; x++) {
618 GP_LOG_E (
"Could not find any driver for '%s'", model);
639 C_PARAMS (list && abilities);
640 C_PARAMS (0 <= index && index < list->count);
648 #ifdef _GPHOTO2_INTERNAL_CODE
651 const StringFlagItem gpi_camera_operation_map[] = {
662 const StringFlagItem gpi_file_operation_map[] = {
673 const StringFlagItem gpi_folder_operation_map[] = {
683 const StringFlagItem gpi_gphoto_device_type_map[] = {
690 const StringFlagItem gpi_camera_driver_status_map[] = {
int gp_abilities_list_detect(CameraAbilitiesList *list, GPPortInfoList *info_list, CameraList *l, GPContext *context)
Describes the properties of a specific camera.
@ GP_OPERATION_CAPTURE_PREVIEW
int gp_port_info_get_path(GPPortInfo info, char **path)
Get path of a specific port entry.
@ GP_FOLDER_OPERATION_NONE
static void remove_colon_from_string(char *str)
Remove first colon from string, if any. Replace it by a space.
@ GP_OPERATION_CAPTURE_IMAGE
char model[128]
name of camera model
@ GP_FILE_OPERATION_AUDIO
@ GP_FOLDER_OPERATION_DELETE_ALL
int usb_vendor
USB Vendor D.
int gp_abilities_list_load_dir(CameraAbilitiesList *list, const char *dir, GPContext *context)
static int gp_abilities_list_sort(CameraAbilitiesList *)
int gp_abilities_list_append(CameraAbilitiesList *list, CameraAbilities abilities)
Append the abilities to the list.
int gp_list_get_name(CameraList *list, int index, const char **name)
int gp_abilities_list_lookup_model(CameraAbilitiesList *list, const char *model)
Search the list for an entry of given model name.
@ GP_DRIVER_STATUS_DEPRECATED
#define bindtextdomain(Domain, Directory)
int gp_port_new(GPPort **port)
Create new GPPort.
int gp_abilities_list_load(CameraAbilitiesList *list, GPContext *context)
Scans the system for camera drivers.
int gp_port_set_info(GPPort *port, GPPortInfo info)
Configure a port.
int gp_list_count(CameraList *list)
GPContextFeedback gp_context_cancel(GPContext *context)
int usb_product
USB Product ID.
static int foreach_func(const char *filename, lt_ptr data)
char library[1024]
(Internal) library filename
int gp_list_reset(CameraList *list)
static int cmp_abilities(const void *a, const void *b)
CameraAbilities * abilities
int gp_port_usb_find_device(GPPort *port, int idvendor, int idproduct)
Find USB device by vendor/product.
int gp_list_free(CameraList *list)
unsigned int gp_context_progress_start(GPContext *context, float target, const char *format,...)
Start progress tracking.
@ GP_DRIVER_STATUS_PRODUCTION
@ GP_FOLDER_OPERATION_PUT_FILE
#define GP_ERROR_MODEL_NOT_FOUND
Specified camera model was not found.
int gp_port_free(GPPort *port)
Free the port structure.
int gp_port_info_list_get_info(GPPortInfoList *list, int n, GPPortInfo *info)
Get port information of specific entry.
The GPhoto port structure.
int gp_list_append(CameraList *list, const char *name, const char *value)
char id[1024]
(Internal) camera ID name
int gp_abilities_list_new(CameraAbilitiesList **list)
Allocate the memory for a new abilities list.
int(* CameraLibraryAbilitiesFunc)(CameraAbilitiesList *list)
Adds the abilities of the supported models to the supplied list.
@ GP_PORT_USB_SCSI
USB Mass Storage raw SCSI port.
#define GP_OK
Everything is OK.
int gp_abilities_list_count(CameraAbilitiesList *list)
Count the entries in the supplied list.
int gp_abilities_list_reset(CameraAbilitiesList *list)
Reset the list.
@ GP_OPERATION_CAPTURE_AUDIO
#define bind_textdomain_codeset(Domain, Charset)
@ GP_FOLDER_OPERATION_MAKE_DIR
@ GP_FILE_OPERATION_DELETE
void gp_context_progress_stop(GPContext *context, unsigned int id)
#define GP_ERROR_IO_USB_FIND
Error when trying to find USB device.
@ GP_PORT_USB_DISK_DIRECT
Direct IO to an usb mass storage device.
const char * gp_port_message_codeset(const char *)
Specify codeset for translations.
static int gp_abilities_list_detect_usb(CameraAbilitiesList *list, int *ability, GPPort *port)
int gp_port_info_get_type(GPPortInfo info, GPPortType *type)
Get type of a specific port entry.
#define GP_ERROR
Generic Error.
int gp_abilities_list_free(CameraAbilitiesList *list)
Free the given CameraAbilitiesList object.
int gp_port_info_list_count(GPPortInfoList *list)
Number of ports in the list.
@ GP_FILE_OPERATION_PREVIEW
@ GP_DRIVER_STATUS_TESTING
const char * gp_message_codeset(const char *codeset)
Set the current character codeset libgphoto2 is operating in.
char text[32 *1024]
Character string containing the translated text.
void gp_context_error(GPContext *context, const char *format,...)
int gp_list_new(CameraList **list)
Creates a new CameraList.
static int gp_abilities_list_lookup_id(CameraAbilitiesList *, const char *)
int usb_class
USB device class.
void gp_context_progress_update(GPContext *context, unsigned int id, float current)
@ GP_CONTEXT_FEEDBACK_CANCEL
int usb_protocol
USB device protocol.
@ GP_DRIVER_STATUS_EXPERIMENTAL
int gp_abilities_list_get_abilities(CameraAbilitiesList *list, int index, CameraAbilities *abilities)
Retrieve the camera abilities of entry with supplied index number.
int gp_port_set_error(GPPort *port, const char *format,...)
Set verbose port error message.
CameraText structure used in various functions.
int gp_port_usb_find_device_by_class(GPPort *port, int mainclass, int subclass, int protocol)
Find USB device by interface class.
@ GP_PORT_DISK
Disk / local mountpoint port.
int(* CameraLibraryIdFunc)(CameraText *id)
Returns a unique id for the camera driver.
List of supported camera models including their abilities.
int usb_subclass
USB device subclass.
#define GP_ERROR_CANCEL
Cancellation successful.
@ GP_FOLDER_OPERATION_REMOVE_DIR
GPPortType port
Supported port types.
GPPortType type
Actual type of this port.
#define CHECK_RESULT(result)
@ GP_OPERATION_CAPTURE_VIDEO
@ GP_PORT_PTPIP
PTP/IP port.
GPPortType
The gphoto port type.