libgphoto2 photo camera library (libgphoto2) API  2.5.22
template.c File Reference

Documented source code template for a camera driver (camlib). More...

#include "config.h"
#include <string.h>
#include <gphoto2/gphoto2-library.h>
#include <gphoto2/gphoto2-result.h>
Include dependency graph for template.c:

Macros

#define _(String)   (String)
 
#define N_(String)   (String)
 

Functions

Camera object member functions

The prototypes for these functions are defined in gphoto2-camera.h

int camera_exit (Camera *camera, GPContext *context)
 
int camera_config_get (Camera *camera, CameraWidget **window, GPContext *context)
 
int camera_config_set (Camera *camera, CameraWidget *window, GPContext *context)
 
int camera_capture_preview (Camera *camera, CameraFile *file, GPContext *context)
 
int camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, GPContext *context)
 
int camera_summary (Camera *camera, CameraText *summary, GPContext *context)
 
int camera_manual (Camera *camera, CameraText *manual, GPContext *context)
 
int camera_about (Camera *camera, CameraText *about, GPContext *context)
 
CameraFilesystem member functions
int get_file_func (CameraFilesystem *fs, const char *folder, const char *filename, CameraFileType type, CameraFile *file, void *data, GPContext *context)
 
int put_file_func (CameraFilesystem *fs, const char *folder, const char *name, CameraFileType type, CameraFile *file, void *data, GPContext *context)
 
int delete_file_func (CameraFilesystem *fs, const char *folder, const char *filename, void *data, GPContext *context)
 
int delete_all_func (CameraFilesystem *fs, const char *folder, void *data, GPContext *context)
 
int get_info_func (CameraFilesystem *fs, const char *folder, const char *filename, CameraFileInfo *info, void *data, GPContext *context)
 
int set_info_func (CameraFilesystem *fs, const char *folder, const char *file, CameraFileInfo info, void *data, GPContext *context)
 
int folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, void *data, GPContext *context)
 
int file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, void *data, GPContext *context)
 
int storage_info_func (CameraFilesystem *fs, CameraStorageInformation **storageinformations, int *nrofstorageinformations, void *data, GPContext *context)
 

camlib API functions

CameraFilesystemFuncs fsfuncs
 
int camera_id (CameraText *id)
 Get a unique camera id. More...
 
int camera_abilities (CameraAbilitiesList *list)
 Get a list of abilities of all supported cameras. More...
 
int camera_init (Camera *camera, GPContext *context)
 

Detailed Description

Documented source code template for a camera driver (camlib).

Author
Copyright 2001 Lutz Mueller lutz@.nosp@m.user.nosp@m.s.sou.nosp@m.rcef.nosp@m.orge..nosp@m.net
Copyright 2005 Hans Ulrich Niedermann gp@n-.nosp@m.dime.nosp@m.nsion.nosp@m.al.d.nosp@m.e
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Introduction to camera drivers (camlibs)

Every camlib must implement the following three function groups:

  • Camera object member functions
  • CameraFilesystem object member functions
  • camlib API functions

We implement the camlib API functions last in this file because camera_init() must reference all the object member functions and by making camera_init() the last function in this file, we can avoid the need for forward declarations of the object member functions.

Note about "static" functions and exporting symbols

The build system uses libtool to explicitly specify the list of exported symbols. Only the three functions of the camlib API (camera_init(), camera_id(), and camera_abilities()) are exported.

Therefore it doesn't matter whether you declare your other functions static or not - regardless of whether they are object member functions or internal camlib functions.

We do not define the object member functions as static in this template in order to have autogenerated documentation about them.

Function Documentation

◆ camera_abilities()

int camera_abilities ( CameraAbilitiesList list)

Get a list of abilities of all supported cameras.

Fill list with abilities of the cameras supported by this camlib.

For each camera, fill a CameraAbilities structure with data about that camera and append it to the list.

The job of this function is basically to extract data from a camlib specific database and insert it into the libgphoto2 camera database. Due to redundant data and other issues, we may decide to revise that database mechanism and replace it by something more flexible and efficient.

This is a camlib API function.

References CameraAbilities::file_operations, CameraAbilities::folder_operations, gp_abilities_list_append(), GP_CAPTURE_IMAGE, GP_DRIVER_STATUS_PRODUCTION, GP_FILE_OPERATION_DELETE, GP_FILE_OPERATION_PREVIEW, GP_FOLDER_OPERATION_NONE, GP_OK, GP_OPERATION_CAPTURE_PREVIEW, GP_PORT_SERIAL, GP_PORT_USB, CameraAbilities::model, CameraAbilities::operations, CameraAbilities::port, CameraAbilities::speed, and CameraAbilities::status.

◆ camera_about()

int camera_about ( Camera camera,
CameraText about,
GPContext context 
)

Return "About" content as textual description. Will be translated.

This function is a method of the Camera object.

References CameraText::text.

Referenced by camera_init().

◆ camera_capture()

int camera_capture ( Camera camera,
CameraCaptureType  type,
CameraFilePath path,
GPContext context 
)

Capture an image and tell libgphoto2 where to find it by filling out the path.

This function is a method of the Camera object.

References GP_OK.

Referenced by camera_init().

◆ camera_capture_preview()

int camera_capture_preview ( Camera camera,
CameraFile file,
GPContext context 
)

Capture a preview and return the data in the given file (again, use gp_file_set_data_and_size, gp_file_set_mime_type, etc.). libgphoto2 assumes that previews are NOT stored on the camera's disk. If your camera does, please delete it from the camera.

This function is a method of the Camera object.

References GP_OK.

Referenced by camera_init().

◆ camera_config_get()

int camera_config_get ( Camera camera,
CameraWidget **  window,
GPContext context 
)

Get the full configuration tree of the camera.

This function is a method of the Camera object.

References GP_OK, gp_widget_new(), and GP_WIDGET_WINDOW.

Referenced by camera_init().

◆ camera_config_set()

int camera_config_set ( Camera camera,
CameraWidget window,
GPContext context 
)

Set parts of the configuration tree. Note that you get back the whole tree, but should only set the modified values.

This function is a method of the Camera object.

References GP_OK.

Referenced by camera_init().

◆ camera_exit()

int camera_exit ( Camera camera,
GPContext context 
)

Finish up the camera communication and free private data. You do not need to close the port.

This function is a method of the Camera object.

References GP_OK.

Referenced by camera_init().

◆ camera_id()

int camera_id ( CameraText id)

Get a unique camera id.

Set library ID string.

Probably redundant and to be removed shortly, being replaced by the libtool module name defined in the build system.

This is a camlib API function.

References GP_OK, and CameraText::text.

◆ camera_init()

int camera_init ( Camera camera,
GPContext context 
)

Initialize a Camera object.

Sets up all the proper object function pointers, initialize camlib internal data structures, and probably establish a connection to the camera.

This is a camlib API function.

References _CameraFunctions::about, camera_about(), camera_capture(), camera_capture_preview(), camera_config_get(), camera_config_set(), camera_exit(), camera_manual(), camera_summary(), _CameraFunctions::capture, _CameraFunctions::capture_preview, _CameraFunctions::exit, fsfuncs, _CameraFunctions::get_config, gp_filesystem_set_funcs(), GP_OK, _CameraFunctions::manual, _CameraFunctions::set_config, and _CameraFunctions::summary.

◆ camera_manual()

int camera_manual ( Camera camera,
CameraText manual,
GPContext context 
)

Return the camera drivers manual. If you would like to tell the user some information about how to use the camera or the driver, this is the place to do.

This function is a method of the Camera object.

References GP_OK.

Referenced by camera_init().

◆ camera_summary()

int camera_summary ( Camera camera,
CameraText summary,
GPContext context 
)

Fill out the summary with textual information about the current state of the camera (like pictures taken, etc.).

This function is a method of the Camera object.

References GP_OK.

Referenced by camera_init().

◆ delete_all_func()

int delete_all_func ( CameraFilesystem fs,
const char *  folder,
void *  data,
GPContext context 
)

Delete all files from the camera.

This function is a CameraFilesystem method.

References GP_OK.

◆ delete_file_func()

int delete_file_func ( CameraFilesystem fs,
const char *  folder,
const char *  filename,
void *  data,
GPContext context 
)

Delete a file from the camera.

This function is a CameraFilesystem method.

References GP_OK.

◆ file_list_func()

int file_list_func ( CameraFilesystem fs,
const char *  folder,
CameraList list,
void *  data,
GPContext context 
)

List available files in the specified folder.

This function is a CameraFilesystem method.

References GP_OK.

◆ folder_list_func()

int folder_list_func ( CameraFilesystem fs,
const char *  folder,
CameraList list,
void *  data,
GPContext context 
)

List available folders in the specified folder.

This function is a CameraFilesystem method.

References GP_OK.

◆ get_file_func()

int get_file_func ( CameraFilesystem fs,
const char *  folder,
const char *  filename,
CameraFileType  type,
CameraFile file,
void *  data,
GPContext context 
)

Get the file from the camera.

This function is a CameraFilesystem method.

References GP_OK.

◆ get_info_func()

int get_info_func ( CameraFilesystem fs,
const char *  folder,
const char *  filename,
CameraFileInfo info,
void *  data,
GPContext context 
)

Get the file info here and write it to space provided by caller.

Parameters
infoSpace provided by caller in which file info is written.

This function is a CameraFilesystem method.

References GP_OK.

◆ put_file_func()

int put_file_func ( CameraFilesystem fs,
const char *  folder,
const char *  name,
CameraFileType  type,
CameraFile file,
void *  data,
GPContext context 
)

Put a file onto the camera.

This function is a CameraFilesystem method.

References GP_OK.

◆ set_info_func()

int set_info_func ( CameraFilesystem fs,
const char *  folder,
const char *  file,
CameraFileInfo  info,
void *  data,
GPContext context 
)

FIXME.

This function is a CameraFilesystem method.

References GP_OK.

◆ storage_info_func()

int storage_info_func ( CameraFilesystem fs,
CameraStorageInformation **  storageinformations,
int *  nrofstorageinformations,
void *  data,
GPContext context 
)

Get information on all available storages in the camera.

This function is a CameraFilesystem method.

References GP_ERROR_NOT_SUPPORTED.

Variable Documentation

◆ fsfuncs

Initial value:
= {
.file_list_func = file_list_func,
.folder_list_func = folder_list_func,
.get_info_func = get_info_func,
.set_info_func = set_info_func,
.get_file_func = get_file_func,
.del_file_func = delete_file_func,
.put_file_func = put_file_func,
.delete_all_func = delete_all_func,
.storage_info_func = storage_info_func
}

All filesystem accessor functions.

This should contain all filesystem accessor functions available in the camera library. Non-present fields are NULL.

Referenced by camera_init().

gp_system_closedir
int gp_system_closedir(gp_system_dir dir)
closedir UNIX functionality
Definition: gphoto2-port-portability.c:249
_GPPortInfo::name
char * name
The name of this port (usb:)
Definition: gphoto2-port-info.h:34
LogFunc
Internal logging function entry.
Definition: gphoto2-port-log.c:57
_GPPortInfo
Definition: gphoto2-port-info.h:32
gp_port_usb_msg_write
int gp_port_usb_msg_write(GPPort *port, int request, int value, int index, char *bytes, int size)
Send a USB control message with output data.
Definition: gphoto2-port.c:864
gp_log
void gp_log(GPLogLevel level, const char *domain, const char *format,...)
Log a debug or error message.
Definition: gphoto2-port-log.c:331
gp_port_get_timeout
int gp_port_get_timeout(GPPort *port, int *timeout)
Get the current port timeout.
Definition: gphoto2-port.c:568
gp_port_usb_msg_class_write
int gp_port_usb_msg_class_write(GPPort *port, int request, int value, int index, char *bytes, int size)
Send a USB class control message with output data.
Definition: gphoto2-port.c:1015
_GPPortSettingsSerial::parity
GPPortSerialParity parity
Definition: gphoto2-port.h:70
gp_logv
void gp_logv(GPLogLevel level, const char *domain, const char *format, va_list args)
Log a debug or error message with va_list.
Definition: gphoto2-port-log.c:299
put_file_func
int put_file_func(CameraFilesystem *fs, const char *folder, const char *name, CameraFileType type, CameraFile *file, void *data, GPContext *context)
Definition: template.c:274
_GPPortSettingsUsbScsi::path
char path[128]
Definition: gphoto2-port.h:105
gp_log_data
void gp_log_data(const char *domain, const char *data, unsigned int size, const char *format,...)
Log data.
Definition: gphoto2-port-log.c:205
gp_system_filename
const char * gp_system_filename(gp_system_dirent de)
retrieve UNIX filename out of a directory entry
Definition: gphoto2-port-portability.c:237
GP_ERROR_IO
#define GP_ERROR_IO
Generic I/O error.
Definition: gphoto2-port-result.h:58
GP_PIN_DTR
@ GP_PIN_DTR
DTR line.
Definition: gphoto2-port.h:186
file_list_func
int file_list_func(CameraFilesystem *fs, const char *folder, CameraList *list, void *data, GPContext *context)
Definition: template.c:399
gp_port_check_int
int gp_port_check_int(GPPort *port, char *data, int size)
Check for intterupt.
Definition: gphoto2-port.c:463
_GPPortInfo::type
GPPortType type
The type of this port.
Definition: gphoto2-port-info.h:33
GP_ERROR_FIXED_LIMIT_EXCEEDED
#define GP_ERROR_FIXED_LIMIT_EXCEEDED
Buffer overflow of internal structure.
Definition: gphoto2-port-result.h:62
HEXDUMP_INIT_Y
#define HEXDUMP_INIT_Y
Definition: gphoto2-port-log.c:168
GP_LOG_DATA
@ GP_LOG_DATA
Log message is a data hex dump.
Definition: gphoto2-port-log.h:34
gp_system_readdir
gp_system_dirent gp_system_readdir(gp_system_dir d)
readdir UNIX functionality
Definition: gphoto2-port-portability.c:225
GP_ERROR_UNKNOWN_PORT
#define GP_ERROR_UNKNOWN_PORT
Unknown libgphoto2 port passed.
Definition: gphoto2-port-result.h:50
gp_port_set_error
int gp_port_set_error(GPPort *port, const char *format,...)
Set verbose port error message.
Definition: gphoto2-port.c:1180
delete_file_func
int delete_file_func(CameraFilesystem *fs, const char *folder, const char *filename, void *data, GPContext *context)
Definition: template.c:296
gp_port_usb_msg_read
int gp_port_usb_msg_read(GPPort *port, int request, int value, int index, char *bytes, int size)
Send a USB control message with input data.
Definition: gphoto2-port.c:897
gp_port_get_info
int gp_port_get_info(GPPort *port, GPPortInfo *info)
Retreives information about the port.
Definition: gphoto2-port.c:255
gp_port_seek
int gp_port_seek(GPPort *port, int offset, int whence)
Seek on a port (for usb disk direct ports)
Definition: gphoto2-port.c:1084
gp_port_close
int gp_port_close(GPPort *port)
Close a port.
Definition: gphoto2-port.c:297
GP_ERROR_IO_READ
#define GP_ERROR_IO_READ
I/O during read.
Definition: gphoto2-port-result.h:84
storage_info_func
int storage_info_func(CameraFilesystem *fs, CameraStorageInformation **storageinformations, int *nrofstorageinformations, void *data, GPContext *context)
Definition: template.c:420
LogFunc::level
GPLogLevel level
Definition: gphoto2-port-log.c:59
_GPPortSettings::usbdiskdirect
GPPortSettingsUsbDiskDirect usbdiskdirect
usb disk direct port specific settings
Definition: gphoto2-port.h:117
gp_port_send_scsi_cmd
int gp_port_send_scsi_cmd(GPPort *port, int to_dev, char *cmd, int cmd_size, char *sense, int sense_size, char *data, int data_size)
Send a SCSI command to a port (for usb scsi ports)
Definition: gphoto2-port.c:1118
gp_port_write
int gp_port_write(GPPort *port, const char *data, int size)
Writes a specified amount of data to a port.
Definition: gphoto2-port.c:392
_GPPortPrivateCore::lh
lt_dlhandle lh
Definition: gphoto2-port.c:78
GP_ERROR_IO_INIT
#define GP_ERROR_IO_INIT
Error initialising I/O.
Definition: gphoto2-port-result.h:80
folder_list_func
int folder_list_func(CameraFilesystem *fs, const char *folder, CameraList *list, void *data, GPContext *context)
Definition: template.c:379
_GPPort::pc
GPPortPrivateCore * pc
Port library private data pointer.
Definition: gphoto2-port.h:153
gp_port_usb_msg_interface_read
int gp_port_usb_msg_interface_read(GPPort *port, int request, int value, int index, char *bytes, int size)
Send a USB interface control message with input data.
Definition: gphoto2-port.c:972
GP_ERROR_NO_MEMORY
#define GP_ERROR_NO_MEMORY
Out of memory.
Definition: gphoto2-port-result.h:42
HEXDUMP_COMPLETE_LINE
#define HEXDUMP_COMPLETE_LINE
Definition: gphoto2-port-log.c:181
gp_system_is_file
int gp_system_is_file(const char *filename)
check if passed filename is a file
Definition: gphoto2-port-portability.c:263
GP_ERROR_HAL
#define GP_ERROR_HAL
Unspecified error when talking to HAL.
Definition: gphoto2-port-result.h:120
gp_port_usb_clear_halt
int gp_port_usb_clear_halt(GPPort *port, int ep)
Clear USB endpoint HALT condition.
Definition: gphoto2-port.c:836
HEXDUMP_LINE_WIDTH
#define HEXDUMP_LINE_WIDTH
Definition: gphoto2-port-log.c:171
gp_port_new
int gp_port_new(GPPort **port)
Create new GPPort.
Definition: gphoto2-port.c:94
gphoto2-port-result.h
gp_port_flush
int gp_port_flush(GPPort *port, int direction)
Flush data on serial port.
Definition: gphoto2-port.c:762
GP_PIN_DSR
@ GP_PIN_DSR
DSR line.
Definition: gphoto2-port.h:188
gp_port_set_info
int gp_port_set_info(GPPort *port, GPPortInfo info)
Configure a port.
Definition: gphoto2-port.c:149
GP_PIN_CTS
@ GP_PIN_CTS
CTS line.
Definition: gphoto2-port.h:187
GP_ERROR_IO_LOCK
#define GP_ERROR_IO_LOCK
Error when trying to lock the device.
Definition: gphoto2-port-result.h:115
gp_system_rmdir
int gp_system_rmdir(const char *dirname)
rmdir UNIX functionality
Definition: gphoto2-port-portability.c:194
_GPPortPrivateCore::error
char error[2048]
Definition: gphoto2-port.c:74
GP_PIN_RING
@ GP_PIN_RING
RING (Modem) line.
Definition: gphoto2-port.h:190
gp_port_settings_set
int gp_port_settings_set(GPPort *, GPPortSettings)
Definition: gphoto2-port.c:617
_GPPortSettingsUSB::config
int config
USB bConfigurationValue used.
Definition: gphoto2-port.h:82
gphoto2-port.h
GP_ERROR_IO_WRITE
#define GP_ERROR_IO_WRITE
I/O during write.
Definition: gphoto2-port-result.h:88
_GPPort
The GPhoto port structure.
Definition: gphoto2-port.h:143
gphoto2-port-version.h
_GPPort::settings_pending
GPPortSettings settings_pending
Settings to be committed.
Definition: gphoto2-port.h:148
gp_port_usb_find_device_by_class
int gp_port_usb_find_device_by_class(GPPort *port, int mainclass, int subclass, int protocol)
Find USB device by interface class.
Definition: gphoto2-port.c:814
_GPPortSettings::serial
GPPortSettingsSerial serial
Serial specific settings.
Definition: gphoto2-port.h:115
gp_port_get_settings
int gp_port_get_settings(GPPort *port, GPPortSettings *settings)
Get the current port settings.
Definition: gphoto2-port.c:632
gp_port_result_as_string
const char * gp_port_result_as_string(int result)
Definition: gphoto2-port-result.c:54
_GPPortInfo::path
char * path
The path of this port (usb:001,023)
Definition: gphoto2-port-info.h:35
GP_PIN_CD
@ GP_PIN_CD
Carrier Detect line.
Definition: gphoto2-port.h:189
GP_PORT_USB
@ GP_PORT_USB
USB port.
Definition: gphoto2-port-info-list.h:37
GP_ERROR_IO_USB_CLEAR_HALT
#define GP_ERROR_IO_USB_CLEAR_HALT
Error during USB Clear HALT.
Definition: gphoto2-port-result.h:102
_GPPortSettings::usb
GPPortSettingsUSB usb
USB specific settings.
Definition: gphoto2-port.h:116
GP_PORT_USB_SCSI
@ GP_PORT_USB_SCSI
USB Mass Storage raw SCSI port.
Definition: gphoto2-port-info-list.h:41
GP_ERROR_BAD_PARAMETERS
#define GP_ERROR_BAD_PARAMETERS
Bad parameters passed.
Definition: gphoto2-port-result.h:38
_GPPortPrivateCore
Internal private libgphoto2_port data. This structure contains private data.
Definition: gphoto2-port.c:73
gp_system_mkdir
int gp_system_mkdir(const char *dirname)
mkdir UNIX functionality
Definition: gphoto2-port-portability.c:180
_GPPortSettingsUSB::inep
int inep
Bulk IN endpoint used.
Definition: gphoto2-port.h:79
GP_OK
#define GP_OK
Everything is OK.
Definition: gphoto2-port-result.h:30
GP_PIN_RTS
@ GP_PIN_RTS
RTS line.
Definition: gphoto2-port.h:185
gp_port_read
int gp_port_read(GPPort *port, char *data, int size)
Read data from port.
Definition: gphoto2-port.c:427
LogFunc::id
unsigned int id
Definition: gphoto2-port-log.c:58
GP_ERROR_IO_SUPPORTED_USB
#define GP_ERROR_IO_SUPPORTED_USB
USB ports not supported.
Definition: gphoto2-port-result.h:75
get_info_func
int get_info_func(CameraFilesystem *fs, const char *folder, const char *filename, CameraFileInfo *info, void *data, GPContext *context)
Definition: template.c:341
gp_port_usb_msg_interface_write
int gp_port_usb_msg_interface_write(GPPort *port, int request, int value, int index, char *bytes, int size)
Send a USB interface control message with output data.
Definition: gphoto2-port.c:937
HEXDUMP_INIT_X
#define HEXDUMP_INIT_X
Definition: gphoto2-port-log.c:165
GP_ERROR_IO_USB_FIND
#define GP_ERROR_IO_USB_FIND
Error when trying to find USB device.
Definition: gphoto2-port-result.h:106
GP_ERROR_IO_USB_CLAIM
#define GP_ERROR_IO_USB_CLAIM
Error when trying to claim the USB device.
Definition: gphoto2-port-result.h:110
gp_port_check_int_fast
int gp_port_check_int_fast(GPPort *port, char *data, int size)
Check for interrupt without wait.
Definition: gphoto2-port.c:496
LogFunc::data
void * data
Definition: gphoto2-port-log.c:61
GP_PORT_USB_DISK_DIRECT
@ GP_PORT_USB_DISK_DIRECT
Direct IO to an usb mass storage device.
Definition: gphoto2-port-info-list.h:40
GPLogLevel
GPLogLevel
Logging level Specifies the logging severity level.
Definition: gphoto2-port-log.h:30
gphoto2-port-info.h
GPLevel
enum _GPLevel GPLevel
Level to pull specific lines.
GP_ERROR
#define GP_ERROR
Generic Error.
Definition: gphoto2-port-result.h:34
_GPPortSettingsUSB::outep
int outep
Bulk OUT endpoint used.
Definition: gphoto2-port.h:80
gphoto2-port-library.h
gp_system_opendir
gp_system_dir gp_system_opendir(const char *dirname)
opendir UNIX functionality
Definition: gphoto2-port-portability.c:211
GPPin
enum _GPPin GPPin
Serial pins.
GP_PORT_SERIAL
@ GP_PORT_SERIAL
Serial port.
Definition: gphoto2-port-info-list.h:36
gp_port_settings_get
int gp_port_settings_get(GPPort *, GPPortSettings *)
Definition: gphoto2-port.c:611
_GPPortSettingsUSB::port
char port[64]
USB Portname. Specific to lowlevel USB.
Definition: gphoto2-port.h:91
gp_port_set_settings
int gp_port_set_settings(GPPort *port, GPPortSettings settings)
Set port settings.
Definition: gphoto2-port.c:590
gp_port_timeout_set
int gp_port_timeout_set(GPPort *, int)
Definition: gphoto2-port.c:546
get_file_func
int get_file_func(CameraFilesystem *fs, const char *folder, const char *filename, CameraFileType type, CameraFile *file, void *data, GPContext *context)
Definition: template.c:250
_GPPortSettings
Union of port settings.
Definition: gphoto2-port.h:114
gp_port_timeout_get
int gp_port_timeout_get(GPPort *, int *)
Definition: gphoto2-port.c:553
GP_LEVEL_HIGH
@ GP_LEVEL_HIGH
Pull to high (nV)
Definition: gphoto2-port.h:200
_GPPortSettings::usbscsi
GPPortSettingsUsbScsi usbscsi
usb scsi port specific settings
Definition: gphoto2-port.h:118
_GPPortPrivateCore::info
struct _GPPortInfo info
Definition: gphoto2-port.c:76
LogFunc::func
GPLogFunc func
Definition: gphoto2-port-log.c:60
gp_port_send_break
int gp_port_send_break(GPPort *port, int duration)
Send a break over a serial port.
Definition: gphoto2-port.c:737
gp_port_set_pin
int gp_port_set_pin(GPPort *port, GPPin pin, GPLevel level)
Set specified serial PIN to value.
Definition: gphoto2-port.c:703
GP_ERROR_IO_SERIAL_SPEED
#define GP_ERROR_IO_SERIAL_SPEED
Specified serial speed not possible.
Definition: gphoto2-port-result.h:97
gp_port_open
int gp_port_open(GPPort *port)
Open a port.
Definition: gphoto2-port.c:273
GP_LEVEL_LOW
@ GP_LEVEL_LOW
Pull to low (0V)
Definition: gphoto2-port.h:199
gphoto2-port-log.h
gp_port_free
int gp_port_free(GPPort *port)
Free the port structure.
Definition: gphoto2-port.c:341
gp_log_add_func
int gp_log_add_func(GPLogLevel level, GPLogFunc func, void *data)
Add a function to get logging information.
Definition: gphoto2-port-log.c:82
gp_port_usb_msg_class_read
int gp_port_usb_msg_class_read(GPPort *port, int request, int value, int index, char *bytes, int size)
Send a USB class control message with input data.
Definition: gphoto2-port.c:1050
gp_system_is_dir
int gp_system_is_dir(const char *dirname)
check if passed filename is a directory
Definition: gphoto2-port-portability.c:280
_GPPortInfo::library_filename
char * library_filename
Internal pathname of the port driver. Do not use outside of the port library.
Definition: gphoto2-port-info.h:38
_GPPortSettingsUsbDiskDirect::path
char path[128]
Definition: gphoto2-port.h:98
GP_ERROR_LIBRARY
#define GP_ERROR_LIBRARY
Error in the camera driver.
Definition: gphoto2-port-result.h:46
gp_port_set_timeout
int gp_port_set_timeout(GPPort *port, int timeout)
Set timeout of port.
Definition: gphoto2-port.c:534
set_info_func
int set_info_func(CameraFilesystem *fs, const char *folder, const char *file, CameraFileInfo info, void *data, GPContext *context)
Definition: template.c:359
GP_ERROR_IO_UPDATE
#define GP_ERROR_IO_UPDATE
I/O during update of settings.
Definition: gphoto2-port-result.h:92
_GPPortSettingsUSB::altsetting
int altsetting
USB Alternative Setting used.
Definition: gphoto2-port.h:84
_GPPortSettingsSerial::bits
int bits
Definition: gphoto2-port.h:69
FAST_TIMEOUT
#define FAST_TIMEOUT
Definition: gphoto2-port.c:482
_GPPort::timeout
int timeout
Port timeout in milliseconds.
Definition: gphoto2-port.h:150
gp_log
void gp_log(GPLogLevel level, const char *domain, const char *format,...)
Log a debug or error message.
Definition: gphoto2-port-log.c:331
_GPPort::settings
GPPortSettings settings
Current port settings.
Definition: gphoto2-port.h:147
GP_ERROR_TIMEOUT
#define GP_ERROR_TIMEOUT
Operation timed out.
Definition: gphoto2-port-result.h:66
_GPPortOperations
The port operations.
Definition: gphoto2-port-library.h:39
_GPPortPrivateCore::ops
GPPortOperations * ops
Definition: gphoto2-port.c:77
gp_log_remove_func
int gp_log_remove_func(int id)
Remove a logging receiving function.
Definition: gphoto2-port-log.c:138
_GPPort::type
GPPortType type
Actual type of this port.
Definition: gphoto2-port.h:145
GP_ERROR_IO_SUPPORTED_SERIAL
#define GP_ERROR_IO_SUPPORTED_SERIAL
Serial ports not supported.
Definition: gphoto2-port-result.h:71
_GPPortSettingsSerial::stopbits
int stopbits
Definition: gphoto2-port.h:72
gp_port_get_error
const char * gp_port_get_error(GPPort *port)
Get verbose port error message.
Definition: gphoto2-port.c:1210
GPLogFunc
void(* GPLogFunc)(GPLogLevel level, const char *domain, const char *str, void *data)
Logging function hook.
Definition: gphoto2-port-log.h:61
gp_port_get_pin
int gp_port_get_pin(GPPort *port, GPPin pin, GPLevel *level)
Get setting of specific serial PIN.
Definition: gphoto2-port.c:651
gp_port_usb_find_device
int gp_port_usb_find_device(GPPort *port, int idvendor, int idproduct)
Find USB device by vendor/product.
Definition: gphoto2-port.c:790
gp_port_reset
int gp_port_reset(GPPort *port)
Reset a port.
Definition: gphoto2-port.c:319
_GPPortSettingsUSB::interface
int interface
USB Interface number used.
Definition: gphoto2-port.h:83
gp_port_result_as_string
const char * gp_port_result_as_string(int result)
Definition: gphoto2-port-result.c:54
GP_ERROR_NOT_SUPPORTED
#define GP_ERROR_NOT_SUPPORTED
Functionality not supported.
Definition: gphoto2-port-result.h:54
delete_all_func
int delete_all_func(CameraFilesystem *fs, const char *folder, void *data, GPContext *context)
Definition: template.c:316
_GPPortSettingsSerial::speed
int speed
Definition: gphoto2-port.h:68