diff options
author | Hans de Goede <hdegoede@redhat.com> | 2010-03-29 09:25:54 +0000 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2010-03-29 09:25:54 +0000 |
commit | 004777f2877233fa3e2374664cf2726d237bd214 (patch) | |
tree | 8c0ae93cb68458741c02d18c948caf4e51ec6bdd /libgphoto2_port/libgphoto2_port | |
parent | afe1e7bfffea54655a55e25215245989c24bf445 (diff) | |
download | libgphoto2-004777f2877233fa3e2374664cf2726d237bd214.tar.gz |
Add ax203 camlib for ax203 based picture frames
This makes it possible to download pictures from / upload pictures to
ax203 based picture frames
It consists of 2 parts:
1) an ax203 camlib, ax203 access, image table parsing, and decompress /
compress code.
2) usbscsi port driver, this is a *Linux only* (for now) port driver
for accessing devices which require sending custom scsi commands to
an usb mass storage device (using the /dev/sg# device under Linux).
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@12854 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2_port/libgphoto2_port')
-rw-r--r-- | libgphoto2_port/libgphoto2_port/gphoto2-port.c | 54 | ||||
-rw-r--r-- | libgphoto2_port/libgphoto2_port/libgphoto2_port.ver | 1 |
2 files changed, 55 insertions, 0 deletions
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port.c b/libgphoto2_port/libgphoto2_port/gphoto2-port.c index 06d18b551..e7206e2b8 100644 --- a/libgphoto2_port/libgphoto2_port/gphoto2-port.c +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port.c @@ -216,6 +216,11 @@ gp_port_set_info (GPPort *port, GPPortInfo info) sizeof(port->settings.usbdiskdirect.path), "%s", strchr(info->path, ':') + 1); break; + case GP_PORT_USB_SCSI: + snprintf(port->settings.usbscsi.path, + sizeof(port->settings.usbscsi.path), "%s", + strchr(info.path, ':') + 1); + break; default: /* Nothing in here */ break; @@ -1107,6 +1112,55 @@ gp_port_seek (GPPort *port, int offset, int whence) } /** + * \brief Send a SCSI command to a port (for usb scsi ports) + * + * \param port a #GPPort + * \param 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. + * \param cmd buffer holding the command to send + * \param cmd_size sizeof cmd buffer + * \param sense buffer for returning scsi sense information + * \param sense_size sizeof sense buffer + * \param data buffer containing informatino to write to the device + * (to_dev is 1), or to store data read from the device (to_dev 0). + * + * Send a SCSI command to a usb scsi port attached device. + * + * \return a gphoto2 error code + **/ +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) +{ + int retval; + + gp_log (GP_LOG_DEBUG, "gphoto2-port", "Sending scsi cmd:"); + gp_log_data ("gphoto2-port", cmd, cmd_size); + if (to_dev && data_size) { + gp_log (GP_LOG_DEBUG, "gphoto2-port", "scsi cmd data:"); + gp_log_data ("gphoto2-port", data, data_size); + } + + CHECK_NULL (port); + CHECK_INIT (port); + + CHECK_SUPP (port, "send_scsi_cmd", port->pc->ops->send_scsi_cmd); + retval = port->pc->ops->send_scsi_cmd (port, to_dev, cmd, cmd_size, + sense, sense_size, data, data_size); + + gp_log (GP_LOG_DEBUG, "gphoto2-port", "scsi cmd result: %d, sense:", + retval); + gp_log_data ("gphoto2-port", sense, sense_size); + if (!to_dev && data_size) { + gp_log (GP_LOG_DEBUG, "gphoto2-port", "scsi cmd data:"); + gp_log_data ("gphoto2-port", data, data_size); + } + + return retval; +} + +/** * \brief Set verbose port error message * \param port a #GPPort * \param format printf style format string diff --git a/libgphoto2_port/libgphoto2_port/libgphoto2_port.ver b/libgphoto2_port/libgphoto2_port/libgphoto2_port.ver index 6684883d3..a05434230 100644 --- a/libgphoto2_port/libgphoto2_port/libgphoto2_port.ver +++ b/libgphoto2_port/libgphoto2_port/libgphoto2_port.ver @@ -34,6 +34,7 @@ LIBGPHOTO2_5_0 { gp_port_result_as_string; gp_port_seek; gp_port_send_break; + gp_port_send_scsi_cmd; gp_port_set_error; gp_port_set_info; gp_port_set_pin; |