#include <gphoto2/gphoto2-port-info-list.h>#include <gphoto2/gphoto2-port-portability.h>


Go to the source code of this file.
Data Structures | |
| struct | _GPPortSettingsSerial |
| Port settings for serial ports. More... | |
| struct | _GPPortSettingsUSB |
| Port settings for USB ports. More... | |
| struct | _GPPortSettingsDisk |
| Port settings for the local disk (directories) port. More... | |
| struct | _GPPortSettingsUsbDiskDirect |
| Port settings for USB mass storage direct IO ports. More... | |
| struct | _GPPortSettingsUsbScsi |
| Port settings for USB Mass Storage raw SCSI ports. More... | |
| union | _GPPortSettings |
| Union of port settings. More... | |
| struct | _GPPort |
| The GPhoto port structure. More... | |
Defines | |
| #define | TRUE (0==0) |
| #define | FALSE (1==0) |
| #define | GP_PORT_MAX_BUF_LEN 4096 |
| Maximum length of receive buffer. | |
| #define | PIN_CTS GP_PIN_CTS |
Typedefs | |
| typedef enum _GPPortSerialParity | GPPortSerialParity |
|
typedef struct _GPPortSettingsSerial | GPPortSettingsSerial |
| typedef struct _GPPortSettingsUSB | GPPortSettingsUSB |
| typedef struct _GPPortSettingsDisk | GPPortSettingsDisk |
|
typedef struct _GPPortSettingsUsbDiskDirect | GPPortSettingsUsbDiskDirect |
|
typedef struct _GPPortSettingsUsbScsi | GPPortSettingsUsbScsi |
| typedef union _GPPortSettings | GPPortSettings |
|
typedef struct _GPPortPrivateLibrary | GPPortPrivateLibrary |
| typedef struct _GPPortPrivateCore | GPPortPrivateCore |
| typedef struct _GPPort | GPPort |
| typedef enum _GPPin | GPPin |
| typedef enum _GPLevel | GPLevel |
| typedef GPPort | gp_port |
| typedef GPPortSettings | gp_port_settings |
Enumerations | |
| enum | _GPPortSerialParity { GP_PORT_SERIAL_PARITY_OFF = 0, GP_PORT_SERIAL_PARITY_EVEN, GP_PORT_SERIAL_PARITY_ODD } |
| Serial parity. More... | |
| enum | { GP_PORT_USB_ENDPOINT_IN, GP_PORT_USB_ENDPOINT_OUT, GP_PORT_USB_ENDPOINT_INT } |
| enum | _GPPin { GP_PIN_RTS, GP_PIN_DTR, GP_PIN_CTS, GP_PIN_DSR, GP_PIN_CD, GP_PIN_RING } |
| Serial pins. More... | |
| enum | _GPLevel { GP_LEVEL_LOW = 0, GP_LEVEL_HIGH = 1 } |
| Level to pull specific lines. More... | |
Functions | |
| int | gp_port_new (GPPort **port) |
| Create new GPPort. | |
| int | gp_port_free (GPPort *port) |
| Free the port structure. | |
| int | gp_port_set_info (GPPort *port, GPPortInfo info) |
| Configure a port. | |
| int | gp_port_get_info (GPPort *port, GPPortInfo *info) |
| Retreives information about the port. | |
| int | gp_port_open (GPPort *port) |
| Open a port. | |
| int | gp_port_close (GPPort *port) |
| Close a port. | |
| int | gp_port_write (GPPort *port, const char *data, int size) |
| Writes a specified amount of data to a port. | |
| int | gp_port_read (GPPort *port, char *data, int size) |
| Read data from port. | |
| int | gp_port_check_int (GPPort *port, char *data, int size) |
| Check for intterupt. | |
| int | gp_port_check_int_fast (GPPort *port, char *data, int size) |
| Check for interrupt without wait. | |
| int | gp_port_get_timeout (GPPort *port, int *timeout) |
| Get the current port timeout. | |
| int | gp_port_set_timeout (GPPort *port, int timeout) |
| Set timeout of port. | |
| int | gp_port_set_settings (GPPort *port, GPPortSettings settings) |
| Set port settings. | |
| int | gp_port_get_settings (GPPort *port, GPPortSettings *settings) |
| Get the current port settings. | |
| int | gp_port_get_pin (GPPort *port, GPPin pin, GPLevel *level) |
| Get setting of specific serial PIN. | |
| int | gp_port_set_pin (GPPort *port, GPPin pin, GPLevel level) |
| Set specified serial PIN to value. | |
| int | gp_port_send_break (GPPort *port, int duration) |
| Send a break over a serial port. | |
| int | gp_port_flush (GPPort *port, int direction) |
| Flush data on serial port. | |
| int | gp_port_usb_find_device (GPPort *port, int idvendor, int idproduct) |
| Find USB device by vendor/product. | |
| int | gp_port_usb_find_device_by_class (GPPort *port, int mainclass, int subclass, int protocol) |
| Find USB device by interface class. | |
| int | gp_port_usb_clear_halt (GPPort *port, int ep) |
| Clear USB endpoint HALT condition. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| int | gp_port_seek (GPPort *port, int offset, int whence) |
| Seek on a port (for usb disk direct ports). | |
| 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). | |
| int | gp_port_set_error (GPPort *port, const char *format,...) |
| Set verbose port error message. | |
| const char * | gp_port_get_error (GPPort *port) |
| Get verbose port error message. | |
| #define PIN_CTS GP_PIN_CTS |
| typedef GPPortSettings gp_port_settings |
| anonymous enum |
| enum _GPLevel |
| enum _GPPin |
Serial pins.
A number of serial pins to trigger and pull. This is necessary for some devices that have more than just the regular 3 or 4 wires.
| enum _GPPortSerialParity |
| int gp_port_check_int | ( | GPPort * | port, | |
| char * | data, | |||
| int | size | |||
| ) |
Check for intterupt.
| port | a GPPort | |
| data | a pointer to an allocated buffer | |
| size | the number of bytes that should be read |
References _GPPortOperations::check_int, gp_log(), gp_log_data(), GP_LOG_DEBUG, _GPPortPrivateCore::ops, _GPPort::pc, and _GPPort::timeout.
| int gp_port_check_int_fast | ( | GPPort * | port, | |
| char * | data, | |||
| int | size | |||
| ) |
Check for interrupt without wait.
| port | a GPPort | |
| data | a pointer to an allocated buffer | |
| size | the number of bytes that should be read |
References _GPPortOperations::check_int, FAST_TIMEOUT, gp_log(), gp_log_data(), GP_LOG_DEBUG, _GPPortPrivateCore::ops, and _GPPort::pc.
| int gp_port_close | ( | GPPort * | port | ) |
Close a port.
| port | a GPPort |
References _GPPortOperations::close, gp_log(), GP_LOG_DEBUG, GP_OK, _GPPortPrivateCore::ops, and _GPPort::pc.
Referenced by gp_camera_exit(), gp_camera_init(), and gp_port_free().
| int gp_port_flush | ( | GPPort * | port, | |
| int | direction | |||
| ) |
Flush data on serial port.
| port | a GPPort | |
| direction | the direction of the flush |
References _GPPortOperations::flush, gp_log(), GP_LOG_DEBUG, GP_OK, _GPPortPrivateCore::ops, and _GPPort::pc.
| int gp_port_free | ( | GPPort * | port | ) |
Free the port structure.
| port | a GPPort |
References gp_log(), GP_LOG_DEBUG, GP_OK, gp_port_close(), _GPPortPrivateCore::lh, _GPPortPrivateCore::ops, and _GPPort::pc.
Referenced by gp_abilities_list_detect(), gp_camera_free(), and gp_port_new().
| const char* gp_port_get_error | ( | GPPort * | port | ) |
Get verbose port error message.
| port | a GPPort |
References _GPPortPrivateCore::error, and _GPPort::pc.
| int gp_port_get_info | ( | GPPort * | port, | |
| GPPortInfo * | info | |||
| ) |
Retreives information about the port.
Retrieves the informations set by gp_port_set_info().
| port | a GPPort | |
| info | GPPortInfo |
References GP_OK, _GPPortPrivateCore::info, and _GPPort::pc.
Referenced by gp_camera_init().
| int gp_port_get_pin | ( | GPPort * | port, | |
| GPPin | pin, | |||
| GPLevel * | level | |||
| ) |
Get setting of specific serial PIN.
| port | a GPPort | |
| pin | the serial pin to be retrieved | |
| level | the setting of the pin |
References _GPPortOperations::get_pin, gp_log(), GP_LOG_DEBUG, GP_OK, _GPPortPrivateCore::ops, and _GPPort::pc.
| int gp_port_get_settings | ( | GPPort * | port, | |
| GPPortSettings * | settings | |||
| ) |
Get the current port settings.
| port | a GPPort | |
| settings | pointer to the retrieved settings |
References GP_OK, and _GPPort::settings.
Referenced by gp_camera_set_port_speed(), and gp_port_settings_get().
| int gp_port_get_timeout | ( | GPPort * | port, | |
| int * | timeout | |||
| ) |
Get the current port timeout.
| port | a GPPort | |
| timeout | pointer to timeout |
References gp_log(), GP_LOG_DEBUG, GP_OK, and _GPPort::timeout.
Referenced by gp_port_timeout_get().
| int gp_port_new | ( | GPPort ** | port | ) |
Create new GPPort.
Allocate and initialize the memory for a new GPPort.
After you called this function, you probably want to call gp_port_set_info in order to make the newly created port functional.
| port | Pointer the GPPort* pointer |
References GP_ERROR_NO_MEMORY, gp_log(), GP_LOG_DEBUG, GP_OK, and gp_port_free().
Referenced by gp_abilities_list_detect(), and gp_camera_new().
| int gp_port_open | ( | GPPort * | port | ) |
Open a port.
| port | a GPPort |
References gp_log(), GP_LOG_DEBUG, GP_OK, GP_PORT_SERIAL, GP_PORT_USB, _GPPortOperations::open, _GPPortPrivateCore::ops, _GPPort::pc, and _GPPort::type.
Referenced by gp_camera_exit(), and gp_camera_init().
| int gp_port_read | ( | GPPort * | port, | |
| char * | data, | |||
| int | size | |||
| ) |
Read data from port.
| port | a GPPort | |
| data | a pointer to an allocated buffer | |
| size | the number of bytes that should be read |
References gp_log(), gp_log_data(), GP_LOG_DEBUG, _GPPortPrivateCore::ops, _GPPort::pc, and _GPPortOperations::read.
| int gp_port_seek | ( | GPPort * | port, | |
| int | offset, | |||
| int | whence | |||
| ) |
Seek on a port (for usb disk direct ports).
| port | a GPPort | |
| offset | offset to seek to | |
| whence | the underlying lseek call whence parameter |
References gp_log(), GP_LOG_DEBUG, _GPPortPrivateCore::ops, _GPPort::pc, and _GPPortOperations::seek.
| int gp_port_send_break | ( | GPPort * | port, | |
| int | duration | |||
| ) |
Send a break over a serial port.
| port | a GPPort | |
| duration | duration of break in milliseconds |
References gp_log(), GP_LOG_DEBUG, GP_OK, _GPPortPrivateCore::ops, _GPPort::pc, and _GPPortOperations::send_break.
| 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).
| port | a GPPort | |
| to_dev | data direction, set to 1 for a scsi cmd which sends data to the device, set to 0 for cmds which read data from the dev. | |
| cmd | buffer holding the command to send | |
| cmd_size | sizeof cmd buffer | |
| sense | buffer for returning scsi sense information | |
| sense_size | sizeof sense buffer | |
| data | buffer containing informatino to write to the device (to_dev is 1), or to store data read from the device (to_dev 0). |
References gp_log(), gp_log_data(), GP_LOG_DEBUG, _GPPortPrivateCore::ops, _GPPort::pc, and _GPPortOperations::send_scsi_cmd.
| int gp_port_set_error | ( | GPPort * | port, | |
| const char * | format, | |||
| ... | ||||
| ) |
Set verbose port error message.
| port | a GPPort | |
| format | printf style format string | |
| ... | variable arguments depending on format string |
References _GPPortPrivateCore::error, GP_ERROR_BAD_PARAMETERS, gp_log(), GP_LOG_ERROR, GP_OK, and _GPPort::pc.
Referenced by gp_abilities_list_detect().
| int gp_port_set_info | ( | GPPort * | port, | |
| GPPortInfo | info | |||
| ) |
Configure a port.
Makes a port functional by passing in the necessary path information (from the serial:/dev/ttyS0 or similar variables). After calling this function, you can access the port using for example gp_port_open().
| port | a GPPort | |
| info | the GPPortInfo to set |
References _GPPortSettingsUSB::altsetting, _GPPortSettingsSerial::bits, _GPPortSettingsUSB::config, _GPPortSettings::disk, GP_ERROR_LIBRARY, gp_log(), GP_LOG_ERROR, GP_OK, GP_PORT_DISK, GP_PORT_SERIAL, gp_port_set_settings(), gp_port_set_timeout(), GP_PORT_USB, GP_PORT_USB_DISK_DIRECT, GP_PORT_USB_SCSI, _GPPortSettingsUSB::inep, _GPPortPrivateCore::info, _GPPortSettingsUSB::interface, _GPPortPrivateCore::lh, _GPPortInfo::library_filename, _GPPortSettingsDisk::mountpoint, _GPPortPrivateCore::ops, _GPPortSettingsUSB::outep, _GPPortSettingsSerial::parity, _GPPortSettingsUsbScsi::path, _GPPortSettingsUsbDiskDirect::path, _GPPortInfo::path, _GPPort::pc, _GPPortSettingsUSB::port, _GPPortSettingsSerial::port, _GPPortSettings::serial, _GPPort::settings, _GPPortSettingsSerial::speed, _GPPortSettingsSerial::stopbits, _GPPortInfo::type, _GPPort::type, _GPPortSettings::usb, _GPPortSettings::usbdiskdirect, and _GPPortSettings::usbscsi.
Referenced by gp_abilities_list_detect().
| int gp_port_set_pin | ( | GPPort * | port, | |
| GPPin | pin, | |||
| GPLevel | level | |||
| ) |
Set specified serial PIN to value.
| port | a GPPort | |
| pin | the serial pin to be retrieved | |
| level | the setting of the pin |
References gp_log(), GP_LOG_DEBUG, GP_OK, _GPPortPrivateCore::ops, _GPPort::pc, and _GPPortOperations::set_pin.
| int gp_port_set_settings | ( | GPPort * | port, | |
| GPPortSettings | settings | |||
| ) |
Set port settings.
| port | a GPPort | |
| settings | the GPPortSettings to be set |
References gp_log(), GP_LOG_DEBUG, GP_OK, _GPPortPrivateCore::ops, _GPPort::pc, _GPPort::settings_pending, and _GPPortOperations::update.
Referenced by gp_camera_set_port_speed(), gp_port_set_info(), and gp_port_settings_set().
| int gp_port_set_timeout | ( | GPPort * | port, | |
| int | timeout | |||
| ) |
Set timeout of port.
| port | a GPPort | |
| timeout | the timeout |
References gp_log(), GP_LOG_DEBUG, GP_OK, and _GPPort::timeout.
Referenced by gp_port_set_info(), and gp_port_timeout_set().
| int gp_port_usb_clear_halt | ( | GPPort * | port, | |
| int | ep | |||
| ) |
Clear USB endpoint HALT condition.
| port | a GPPort | |
| ep | endpoint to clear HALT |
References _GPPortOperations::clear_halt, gp_log(), GP_LOG_DEBUG, GP_OK, _GPPortPrivateCore::ops, and _GPPort::pc.
| int gp_port_usb_find_device | ( | GPPort * | port, | |
| int | idvendor, | |||
| int | idproduct | |||
| ) |
Find USB device by vendor/product.
| port | a GPPort | |
| idvendor | USB vendor id | |
| idproduct | USB product id |
References _GPPortOperations::find_device, GP_OK, _GPPortPrivateCore::ops, and _GPPort::pc.
Referenced by gp_camera_init().
| int gp_port_usb_find_device_by_class | ( | GPPort * | port, | |
| int | mainclass, | |||
| int | subclass, | |||
| int | protocol | |||
| ) |
Find USB device by interface class.
| port | a GPPort | |
| mainclass | the USB interface class | |
| subclass | the USB interface subclass | |
| protocol | the USB interface protocol |
References _GPPortOperations::find_device_by_class, GP_OK, _GPPortPrivateCore::ops, and _GPPort::pc.
Referenced by gp_camera_init().
| 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.
| port | a GPPort | |
| request | control request code | |
| value | control value | |
| index | control index | |
| bytes | pointer to data | |
| size | size of the data |
References gp_log(), gp_log_data(), GP_LOG_DEBUG, _GPPortOperations::msg_class_read, _GPPortPrivateCore::ops, and _GPPort::pc.
| 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.
| port | a GPPort | |
| request | control request code | |
| value | control value | |
| index | control index | |
| bytes | pointer to data | |
| size | size of the data |
References gp_log(), gp_log_data(), GP_LOG_DEBUG, _GPPortOperations::msg_class_write, _GPPortPrivateCore::ops, and _GPPort::pc.
| 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.
| port | a GPPort | |
| request | control request code | |
| value | control value | |
| index | control index | |
| bytes | pointer to data | |
| size | size of the data |
References gp_log(), gp_log_data(), GP_LOG_DEBUG, _GPPortOperations::msg_interface_read, _GPPortPrivateCore::ops, and _GPPort::pc.
| 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.
| port | a GPPort | |
| request | control request code | |
| value | control value | |
| index | control index | |
| bytes | pointer to data | |
| size | size of the data |
References gp_log(), gp_log_data(), GP_LOG_DEBUG, _GPPortOperations::msg_interface_write, _GPPortPrivateCore::ops, and _GPPort::pc.
| 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.
| port | a GPPort | |
| request | control request code | |
| value | control value | |
| index | control index | |
| bytes | pointer to data | |
| size | size of the data |
References gp_log(), gp_log_data(), GP_LOG_DEBUG, _GPPortOperations::msg_read, _GPPortPrivateCore::ops, and _GPPort::pc.
| 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.
| port | a GPPort | |
| request | control request code | |
| value | control value | |
| index | control index | |
| bytes | pointer to data | |
| size | size of the data |
References gp_log(), gp_log_data(), GP_LOG_DEBUG, _GPPortOperations::msg_write, _GPPortPrivateCore::ops, and _GPPort::pc.
| int gp_port_write | ( | GPPort * | port, | |
| const char * | data, | |||
| int | size | |||
| ) |
Writes a specified amount of data to a port.
| port | a GPPort | |
| data | the data to write to the port | |
| size | the number of bytes to write to the port |
References gp_log(), gp_log_data(), GP_LOG_DEBUG, GP_PORT_SERIAL, _GPPortPrivateCore::ops, _GPPort::pc, _GPPort::type, and _GPPortOperations::write.
1.5.5