some canon capture related property fixes.
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@8394 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
* library.c: Add EOS 350 canon id too, since
|
||||
it apparently reacts to PTP traffic on it too.
|
||||
|
||||
* ptp.c, ptp.h: Adjusted several canon properties to
|
||||
better names. Added some previously not known ones.
|
||||
"ramsize" is actually "firmwareversion" and so on.
|
||||
|
||||
2005-12-30 Marcus Meissner <marcus@jet.franken.de>
|
||||
|
||||
* library.c: Only allow getpartialobject for EXIF
|
||||
|
||||
@@ -1118,9 +1118,9 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path,
|
||||
* will download a file called "VirtualObject"
|
||||
*/
|
||||
if ( EXPERIMENTAL_CANON_CAPTURE &&
|
||||
camera->pl->params.deviceinfo.VendorExtensionID == PTP_VENDOR_CANON
|
||||
params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON
|
||||
) {
|
||||
if (!ptp_operation_issupported(&camera->pl->params, PTP_OC_CANON_InitiateCaptureInMemory)) {
|
||||
if (!ptp_operation_issupported(params, PTP_OC_CANON_InitiateCaptureInMemory)) {
|
||||
gp_context_error (context,
|
||||
_("Sorry, your Canon camera does not support Canon Captureinitiation"));
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
@@ -1192,8 +1192,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!ptp_operation_issupported(&camera->pl->params,
|
||||
PTP_OC_InitiateCapture)) {
|
||||
if (!ptp_operation_issupported(params,PTP_OC_InitiateCapture)) {
|
||||
gp_context_error(context,
|
||||
_("Sorry, your camera does not support generic capture"));
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
@@ -1207,7 +1206,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path,
|
||||
* indicating that the capure has been completed may occur after
|
||||
* few seconds. moving down the code. (kil3r)
|
||||
*/
|
||||
CPR(context,ptp_initiatecapture(&camera->pl->params, 0x00000000, 0x00000000));
|
||||
CPR(context,ptp_initiatecapture(params, 0x00000000, 0x00000000));
|
||||
CR (gp_port_set_timeout (camera->port, USB_TIMEOUT_CAPTURE));
|
||||
/* A word of comments is worth here.
|
||||
* After InitiateCapture camera should report with ObjectAdded event
|
||||
@@ -1226,8 +1225,9 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path,
|
||||
* Thus we set CameraFilePath to the path to last object reported by
|
||||
* the camera.
|
||||
*/
|
||||
|
||||
/* I hate workarounds! Nikon is not 100% PTP compatible here! */
|
||||
if (camera->pl->params.deviceinfo.VendorExtensionID==PTP_VENDOR_NIKON)
|
||||
if (params->deviceinfo.VendorExtensionID==PTP_VENDOR_NIKON)
|
||||
goto out;
|
||||
{
|
||||
short ret;
|
||||
@@ -1743,7 +1743,7 @@ _put_Nikon_OnOff_UINT8(Camera* camera, CameraWidget *widget, PTPPropertyValue *p
|
||||
}
|
||||
|
||||
static int
|
||||
_get_UINT32_as_MB(Camera* camera, CameraWidget **widget, struct submenu *menu, PTPDevicePropDesc *dpd) {
|
||||
_get_CANON_FirmwareVersion(Camera* camera, CameraWidget **widget, struct submenu *menu, PTPDevicePropDesc *dpd) {
|
||||
char value[64];
|
||||
|
||||
gp_widget_new (GP_WIDGET_TEXT, _(menu->label), widget);
|
||||
@@ -1751,7 +1751,8 @@ _get_UINT32_as_MB(Camera* camera, CameraWidget **widget, struct submenu *menu, P
|
||||
if (dpd->DataType != PTP_DTC_UINT32) {
|
||||
sprintf (value,_("unexpected datatype %i"),dpd->DataType);
|
||||
} else {
|
||||
sprintf (value,"%i",dpd->CurrentValue.u32/1024/1024);
|
||||
uint32_t x = dpd->CurrentValue.u32;
|
||||
sprintf (value,"%d.%d.%d.%d",((x&0xff000000)>>24),((x&0xff0000)>>16),((x&0xff00)>>8),x&0xff);
|
||||
}
|
||||
gp_widget_set_value (*widget,value);
|
||||
return (GP_OK);
|
||||
@@ -2747,14 +2748,14 @@ _put_Nikon_AFAreaIllum(Camera* camera, CameraWidget *widget, PTPPropertyValue *p
|
||||
|
||||
|
||||
|
||||
static struct deviceproptableu8 canon_macromode[] = {
|
||||
static struct deviceproptableu8 canon_afdistance[] = {
|
||||
{ N_("Off"), 0x01, 0 },
|
||||
{ N_("Macro"), 0x03, 0 },
|
||||
{ N_("Long distance"), 0x07, 0 }, /* Unchecked. */
|
||||
};
|
||||
|
||||
static int
|
||||
_get_Canon_Macro(Camera* camera, CameraWidget **widget, struct submenu *menu, PTPDevicePropDesc *dpd) {
|
||||
_get_Canon_AFDistance(Camera* camera, CameraWidget **widget, struct submenu *menu, PTPDevicePropDesc *dpd) {
|
||||
int i;
|
||||
|
||||
gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget);
|
||||
@@ -2763,25 +2764,25 @@ _get_Canon_Macro(Camera* camera, CameraWidget **widget, struct submenu *menu, PT
|
||||
return (GP_ERROR);
|
||||
if (dpd->DataType != PTP_DTC_UINT8)
|
||||
return (GP_ERROR);
|
||||
for (i=0;i<sizeof (canon_macromode)/sizeof (canon_macromode[0]);i++) {
|
||||
gp_widget_add_choice (*widget, _(canon_macromode[i].label));
|
||||
if (canon_macromode[i].value == dpd->CurrentValue.u8)
|
||||
gp_widget_set_value (*widget, _(canon_macromode[i].label));
|
||||
for (i=0;i<sizeof (canon_afdistance)/sizeof (canon_afdistance[0]);i++) {
|
||||
gp_widget_add_choice (*widget, _(canon_afdistance[i].label));
|
||||
if (canon_afdistance[i].value == dpd->CurrentValue.u8)
|
||||
gp_widget_set_value (*widget, _(canon_afdistance[i].label));
|
||||
}
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
_put_Canon_Macro(Camera* camera, CameraWidget *widget, PTPPropertyValue *propval) {
|
||||
_put_Canon_AFDistance(Camera* camera, CameraWidget *widget, PTPPropertyValue *propval) {
|
||||
char *value;
|
||||
int i, ret;
|
||||
|
||||
ret = gp_widget_get_value (widget, &value);
|
||||
if (ret != GP_OK)
|
||||
return ret;
|
||||
for (i=0;i<sizeof (canon_macromode)/sizeof (canon_macromode[0]);i++) {
|
||||
if (!strcmp (value, _(canon_macromode[i].label))) {
|
||||
propval->u8 = canon_macromode[i].value;
|
||||
for (i=0;i<sizeof (canon_afdistance)/sizeof (canon_afdistance[0]);i++) {
|
||||
if (!strcmp (value, _(canon_afdistance[i].label))) {
|
||||
propval->u8 = canon_afdistance[i].value;
|
||||
return (GP_OK);
|
||||
}
|
||||
}
|
||||
@@ -3149,7 +3150,7 @@ _put_Nikon_FastFS(Camera* camera, CameraWidget *widget, PTPPropertyValue *propva
|
||||
static struct submenu camera_settings_menu[] = {
|
||||
{ N_("Camera Owner"), "owner", PTP_DPC_CANON_CameraOwner, PTP_VENDOR_CANON, PTP_DTC_AUINT8, _get_AUINT8_as_CHAR_ARRAY, _put_AUINT8_as_CHAR_ARRAY },
|
||||
{ N_("Camera Model"), "model", PTP_DPC_CANON_CameraModel, PTP_VENDOR_CANON, PTP_DTC_STR, _get_STR, _put_None },
|
||||
{ N_("Flash Memory"), "internalmemory", PTP_DPC_CANON_FlashMemory, PTP_VENDOR_CANON, PTP_DTC_UINT32, _get_UINT32_as_MB, _put_None },
|
||||
{ N_("Firmware Version"), "firmwareversion", PTP_DPC_CANON_FirmwareVersion, PTP_VENDOR_CANON, PTP_DTC_UINT32, _get_CANON_FirmwareVersion, _put_None },
|
||||
{ N_("Camera Time"), "time", PTP_DPC_CANON_UnixTime, PTP_VENDOR_CANON, PTP_DTC_UINT32, _get_UINT32_as_time, _put_UINT32_as_time },
|
||||
{ N_("Camera Time"), "time", PTP_DPC_DateTime, 0, PTP_DTC_STR, _get_STR_as_time, _put_STR_as_time },
|
||||
{ N_("Beep Mode"), "beep", PTP_DPC_CANON_BeepMode, PTP_VENDOR_CANON, PTP_DTC_UINT8, _get_Canon_BeepMode, _put_Canon_BeepMode },
|
||||
@@ -3194,7 +3195,7 @@ static struct submenu capture_settings_menu[] = {
|
||||
{ N_("Focusing Point"), "focusingpoint", PTP_DPC_CANON_FocusingPoint, PTP_VENDOR_CANON, PTP_DTC_UINT16, _get_Canon_FocusingPoint, _put_Canon_FocusingPoint},
|
||||
{ N_("Shutter Speed"), "shutterspeed", PTP_DPC_CANON_ShutterSpeed, PTP_VENDOR_CANON, PTP_DTC_UINT16, _get_Canon_ShutterSpeed, _put_Canon_ShutterSpeed},
|
||||
{ N_("Metering Mode"), "meteringmode", PTP_DPC_CANON_MeteringMode, PTP_VENDOR_CANON, PTP_DTC_UINT8, _get_Canon_MeteringMode, _put_Canon_MeteringMode},
|
||||
{ N_("Macro Mode"), "macromode", PTP_DPC_CANON_MacroMode, PTP_VENDOR_CANON, PTP_DTC_UINT8, _get_Canon_Macro, _put_Canon_Macro},
|
||||
{ N_("AF Distance"), "afdistance", PTP_DPC_CANON_AFDistance, PTP_VENDOR_CANON, PTP_DTC_UINT8, _get_Canon_AFDistance, _put_Canon_AFDistance},
|
||||
/* { N_("Viewfinder Mode"), "viewfinder", PTP_DPC_CANON_ViewFinderMode, PTP_VENDOR_CANON, PTP_DTC_UINT32, _get_Canon_ViewFinderMode, _put_Canon_ViewFinderMode}, */
|
||||
{ NULL },
|
||||
};
|
||||
@@ -4290,6 +4291,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Configure the CameraFilesystem */
|
||||
CR (gp_filesystem_set_list_funcs (camera->fs, file_list_func,
|
||||
folder_list_func, camera));
|
||||
|
||||
@@ -987,18 +987,47 @@ ptp_ek_setserial (PTPParams* params, unsigned char *data, unsigned int size)
|
||||
return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, size, &data, NULL);
|
||||
}
|
||||
|
||||
/* unclear yet, but I guess it returns the info from 9008 */
|
||||
/* unclear what it does yet */
|
||||
uint16_t
|
||||
ptp_ek_9009 (PTPParams* params, unsigned char **data, unsigned int *size)
|
||||
ptp_ek_9007 (PTPParams* params, unsigned char **data, unsigned int *size)
|
||||
{
|
||||
PTPContainer ptp;
|
||||
|
||||
PTP_CNT_INIT(ptp);
|
||||
ptp.Code = 0x9009;
|
||||
ptp.Code = 0x9007;
|
||||
ptp.Nparam = 0;
|
||||
return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
|
||||
}
|
||||
|
||||
/* unclear what it does yet */
|
||||
uint16_t
|
||||
ptp_ek_9009 (PTPParams* params, uint32_t *p1, uint32_t *p2)
|
||||
{
|
||||
PTPContainer ptp;
|
||||
uint16_t ret;
|
||||
|
||||
PTP_CNT_INIT(ptp);
|
||||
ptp.Code = 0x9009;
|
||||
ptp.Nparam = 0;
|
||||
ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
|
||||
*p1 = ptp.Param1;
|
||||
*p2 = ptp.Param2;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* unclear yet, but I guess it returns the info from 9008 */
|
||||
uint16_t
|
||||
ptp_ek_900c (PTPParams* params, unsigned char **data, unsigned int *size)
|
||||
{
|
||||
PTPContainer ptp;
|
||||
|
||||
PTP_CNT_INIT(ptp);
|
||||
ptp.Code = 0x900c;
|
||||
ptp.Nparam = 0;
|
||||
return ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, data, size);
|
||||
/* returned data is 16bit,16bit,32bit,32bit */
|
||||
}
|
||||
|
||||
/**
|
||||
* ptp_ek_settext:
|
||||
* params: PTPParams*
|
||||
@@ -1328,6 +1357,17 @@ ptp_canon_initiatecaptureinmemory (PTPParams* params)
|
||||
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
ptp_canon_9012 (PTPParams* params)
|
||||
{
|
||||
PTPContainer ptp;
|
||||
|
||||
PTP_CNT_INIT(ptp);
|
||||
ptp.Code=0x9012;
|
||||
ptp.Nparam=0;
|
||||
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* ptp_canon_getpartialobject:
|
||||
*
|
||||
@@ -1843,10 +1883,9 @@ ptp_get_property_description(PTPParams* params, uint16_t dpc)
|
||||
{PTP_DPC_CANON_ImageQuality, N_("Image Quality")},
|
||||
{PTP_DPC_CANON_ImageSize, N_("Image Size")},
|
||||
{PTP_DPC_CANON_FlashMode, N_("Flash Mode")},
|
||||
/* a/v = audio/video */
|
||||
{PTP_DPC_CANON_TvAvSetting, N_("TV A/V Setting")},
|
||||
{PTP_DPC_CANON_ShootingMode, N_("Shooting Mode")},
|
||||
{PTP_DPC_CANON_MeteringMode, N_("Metering Mode")},
|
||||
{PTP_DPC_CANON_MacroMode, N_("Macro Mode")},
|
||||
{PTP_DPC_CANON_AFDistance, N_("AF Distance")},
|
||||
{PTP_DPC_CANON_FocusingPoint, N_("Focusing Point")},
|
||||
{PTP_DPC_CANON_WhiteBalance, N_("White Balance")},
|
||||
{PTP_DPC_CANON_ISOSpeed, N_("ISO Speed")},
|
||||
@@ -1855,11 +1894,11 @@ ptp_get_property_description(PTPParams* params, uint16_t dpc)
|
||||
{PTP_DPC_CANON_ExpCompensation, N_("Exposure Compensation")},
|
||||
{PTP_DPC_CANON_Zoom, N_("Zoom")},
|
||||
{PTP_DPC_CANON_SizeQualityMode, N_("Size Quality Mode")},
|
||||
{PTP_DPC_CANON_FlashMemory, N_("Flash Memory")},
|
||||
{PTP_DPC_CANON_FirmwareVersion, N_("Firmware Version")},
|
||||
{PTP_DPC_CANON_CameraModel, N_("Camera Model")},
|
||||
{PTP_DPC_CANON_CameraOwner, N_("Camera Owner")},
|
||||
{PTP_DPC_CANON_UnixTime, N_("UNIX Time")},
|
||||
{PTP_DPC_CANON_RealImageWidth, N_("Real Image Width")},
|
||||
{PTP_DPC_CANON_DZoomMagnification, N_("Digital Zoom Magnification")},
|
||||
{PTP_DPC_CANON_PhotoEffect, N_("Photo Effect")},
|
||||
{PTP_DPC_CANON_AssistLight, N_("Assist Light")},
|
||||
{0,NULL}
|
||||
|
||||
@@ -165,7 +165,9 @@ typedef struct _PTPUSBEventContainer PTPUSBEventContainer;
|
||||
#define PTP_OC_CANON_ViewfinderOff 0x900C
|
||||
#define PTP_OC_CANON_ReflectChanges 0x900D
|
||||
|
||||
/* 900e - send nothing, gets 5 uint16t in 32bit entities back in 20byte datablob */
|
||||
/* 900e - send nothing, gets 5 uint16t in 32bit entities back in 20byte datablob
|
||||
* GetFlashDevParam?
|
||||
*/
|
||||
#define PTP_OC_CANON_900e 0x900E
|
||||
/* 900f - gets data ... hmm, object handles ? */
|
||||
#define PTP_OC_CANON_900f 0x900F
|
||||
@@ -184,6 +186,7 @@ typedef struct _PTPUSBEventContainer PTPUSBEventContainer;
|
||||
#define PTP_OC_CANON_InitiateCaptureInMemory 0x901A
|
||||
#define PTP_OC_CANON_GetPartialObject 0x901B
|
||||
#define PTP_OC_CANON_GetViewfinderImage 0x901d
|
||||
/* Viewfinder Auto functions */
|
||||
#define PTP_OC_CANON_GetChanges 0x9020
|
||||
#define PTP_OC_CANON_GetFolderEntries 0x9021
|
||||
|
||||
@@ -274,6 +277,7 @@ typedef struct _PTPUSBEventContainer PTPUSBEventContainer;
|
||||
#define PTP_EC_UnreportedStatus 0x400E
|
||||
|
||||
/* Canon extension Event Codes */
|
||||
#define PTP_EC_CANON_ExtendedErrorcode 0xC005 /* ? */
|
||||
#define PTP_EC_CANON_ObjectInfoChanged 0xC008
|
||||
#define PTP_EC_CANON_RequestObjectTransfer 0xC009
|
||||
#define PTP_EC_CANON_CameraModeChanged 0xC00C
|
||||
@@ -632,26 +636,30 @@ typedef struct _PTPEKTextParams PTPEKTextParams;
|
||||
#define PTP_DPC_CANON_D007 0xD007
|
||||
#define PTP_DPC_CANON_ImageSize 0xD008
|
||||
#define PTP_DPC_CANON_FlashMode 0xD00A
|
||||
#define PTP_DPC_CANON_TvAvSetting 0xD00C
|
||||
#define PTP_DPC_CANON_ShootingMode 0xD00C
|
||||
#define PTP_DPC_CANON_DriveMode 0xD00E
|
||||
#define PTP_DPC_CANON_MeteringMode 0xD010
|
||||
#define PTP_DPC_CANON_MacroMode 0xD011
|
||||
#define PTP_DPC_CANON_AFDistance 0xD011
|
||||
#define PTP_DPC_CANON_FocusingPoint 0xD012
|
||||
#define PTP_DPC_CANON_WhiteBalance 0xD013
|
||||
#define PTP_DPC_CANON_ISOSpeed 0xD01C
|
||||
#define PTP_DPC_CANON_Aperture 0xD01D
|
||||
#define PTP_DPC_CANON_ShutterSpeed 0xD01E
|
||||
#define PTP_DPC_CANON_ExpCompensation 0xD01F
|
||||
|
||||
/* capture data type (?) */
|
||||
#define PTP_DPC_CANON_D029 0xD029
|
||||
#define PTP_DPC_CANON_Zoom 0xD02A
|
||||
#define PTP_DPC_CANON_SizeQualityMode 0xD02C
|
||||
#define PTP_DPC_CANON_FlashMemory 0xD031
|
||||
#define PTP_DPC_CANON_FirmwareVersion 0xD031
|
||||
#define PTP_DPC_CANON_CameraModel 0xD032
|
||||
#define PTP_DPC_CANON_CameraOwner 0xD033
|
||||
#define PTP_DPC_CANON_UnixTime 0xD034
|
||||
#define PTP_DPC_CANON_RealImageWidth 0xD039
|
||||
#define PTP_DPC_CANON_DZoomMagnification 0xD039
|
||||
#define PTP_DPC_CANON_PhotoEffect 0xD040
|
||||
#define PTP_DPC_CANON_AssistLight 0xD041
|
||||
#define PTP_DPC_CANON_D045 0xD045
|
||||
#define PTP_DPC_CANON_AverageFilesizes 0xD048
|
||||
|
||||
/* Nikon extension device property codes */
|
||||
#define PTP_DPC_NIKON_ShootingBank 0xD010
|
||||
@@ -906,7 +914,9 @@ uint16_t ptp_setdevicepropvalue (PTPParams* params, uint16_t propcode,
|
||||
|
||||
|
||||
/* Eastman Kodak extensions */
|
||||
uint16_t ptp_ek_9009 (PTPParams* params, unsigned char **serial, unsigned int *size);
|
||||
uint16_t ptp_ek_9007 (PTPParams* params, unsigned char **serial, unsigned int *size);
|
||||
uint16_t ptp_ek_9009 (PTPParams* params, uint32_t*, uint32_t*);
|
||||
uint16_t ptp_ek_900c (PTPParams* params, unsigned char **serial, unsigned int *size);
|
||||
uint16_t ptp_ek_getserial (PTPParams* params, unsigned char **serial, unsigned int *size);
|
||||
uint16_t ptp_ek_setserial (PTPParams* params, unsigned char *serial, uint32_t size);
|
||||
uint16_t ptp_ek_settext (PTPParams* params, PTPEKTextParams *text);
|
||||
@@ -917,6 +927,7 @@ uint16_t ptp_ek_sendfileobject (PTPParams* params, unsigned char* object,
|
||||
uint32_t size);
|
||||
|
||||
/* Canon PTP extensions */
|
||||
uint16_t ptp_canon_9012 (PTPParams* params);
|
||||
uint16_t ptp_canon_getobjectsize (PTPParams* params, uint32_t handle,
|
||||
uint32_t p2, uint32_t* size, uint32_t* rp2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user