Added PTP support for Panasonic BGH1
This commit is contained in:
committed by
Marcus Meissner
parent
4602672a02
commit
fac2ae7aa2
@@ -8897,6 +8897,383 @@ struct {
|
||||
{ N_("Automatic Warm"), 0x8015 },
|
||||
};
|
||||
|
||||
static int
|
||||
_put_Panasonic_AdjustGM(CONFIG_PUT_ARGS)
|
||||
{
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
char *xval;
|
||||
uint32_t val;
|
||||
|
||||
CR (gp_widget_get_value(widget, &xval));
|
||||
int16_t adj;
|
||||
sscanf (xval, "%hd", &adj);
|
||||
if (adj < 0) {
|
||||
adj = abs(adj) + 0x8000;
|
||||
}
|
||||
val = adj;
|
||||
|
||||
return translate_ptp_result (ptp_panasonic_setdeviceproperty(params, PTP_DPC_PANASONIC_WhiteBalance_ADJ_GM, (unsigned char*)&val, 2));
|
||||
}
|
||||
|
||||
static int
|
||||
_get_Panasonic_AdjustGM(CONFIG_GET_ARGS) {
|
||||
uint32_t currentVal = 0;
|
||||
char buf[32];
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
GPContext *context = ((PTPData *) params->data)->context;
|
||||
|
||||
uint16_t valsize;
|
||||
C_PTP_REP (ptp_panasonic_getdeviceproperty(params, PTP_DPC_PANASONIC_WhiteBalance_ADJ_GM, &valsize, ¤tVal));
|
||||
|
||||
//printf("retrieved %x with size %x\n", currentVal, valsize);
|
||||
if (currentVal & 0x8000) {
|
||||
currentVal = (currentVal & 0x7FFF) * -1;
|
||||
}
|
||||
sprintf(buf, "%d\n", currentVal);
|
||||
|
||||
gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget);
|
||||
gp_widget_set_name (*widget, menu->name);
|
||||
|
||||
gp_widget_set_value(*widget, &buf);
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
_put_Panasonic_AdjustAB(CONFIG_PUT_ARGS)
|
||||
{
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
char *xval;
|
||||
uint32_t val;
|
||||
|
||||
CR (gp_widget_get_value(widget, &xval));
|
||||
int16_t adj;
|
||||
sscanf (xval, "%hd", &adj);
|
||||
if (adj < 0) {
|
||||
adj = abs(adj) + 0x8000;
|
||||
}
|
||||
val = adj;
|
||||
|
||||
return translate_ptp_result (ptp_panasonic_setdeviceproperty(params, PTP_DPC_PANASONIC_WhiteBalance_ADJ_AB, (unsigned char*)&val, 2));
|
||||
}
|
||||
|
||||
static int
|
||||
_get_Panasonic_AdjustAB(CONFIG_GET_ARGS) {
|
||||
uint32_t currentVal = 0;
|
||||
char buf[32];
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
GPContext *context = ((PTPData *) params->data)->context;
|
||||
|
||||
uint16_t valsize;
|
||||
C_PTP_REP (ptp_panasonic_getdeviceproperty(params, PTP_DPC_PANASONIC_WhiteBalance_ADJ_AB, &valsize, ¤tVal));
|
||||
|
||||
//printf("retrieved %x with size %x\n", currentVal, valsize);
|
||||
if (currentVal & 0x8000) {
|
||||
currentVal = (currentVal & 0x7FFF) * -1;
|
||||
}
|
||||
sprintf(buf, "%d\n", currentVal);
|
||||
|
||||
gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget);
|
||||
gp_widget_set_name (*widget, menu->name);
|
||||
|
||||
gp_widget_set_value(*widget, &buf);
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
_put_Panasonic_ColorTemp(CONFIG_PUT_ARGS)
|
||||
{
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
char *xval;
|
||||
uint32_t val;
|
||||
|
||||
CR (gp_widget_get_value(widget, &xval));
|
||||
uint16_t KSet;;
|
||||
sscanf (xval, "%hd", &KSet);
|
||||
val = KSet;
|
||||
|
||||
return translate_ptp_result (ptp_panasonic_setdeviceproperty(params, PTP_DPC_PANASONIC_WhiteBalance_KSet, (unsigned char*)&val, 2));
|
||||
}
|
||||
|
||||
static int
|
||||
_get_Panasonic_ColorTemp(CONFIG_GET_ARGS) {
|
||||
uint32_t currentVal;
|
||||
uint32_t listCount;
|
||||
uint32_t *list;
|
||||
uint32_t i;
|
||||
int valset = 0;
|
||||
char buf[32];
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
GPContext *context = ((PTPData *) params->data)->context;
|
||||
|
||||
C_PTP_REP (ptp_panasonic_getdevicepropertydesc(params, PTP_DPC_PANASONIC_WhiteBalance_KSet, 2, ¤tVal, &list, &listCount));
|
||||
|
||||
//printf("retrieved %lu property values\n", listCount);
|
||||
|
||||
gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget);
|
||||
gp_widget_set_name (*widget, menu->name);
|
||||
|
||||
for (i = 0; i < listCount; i++) {
|
||||
sprintf(buf,_("%d"), list[i]);
|
||||
if (list[i] == currentVal) {
|
||||
gp_widget_set_value (*widget, buf);
|
||||
valset = 1;
|
||||
}
|
||||
|
||||
gp_widget_add_choice (*widget, buf);
|
||||
}
|
||||
free(list);
|
||||
if (!valset) {
|
||||
sprintf(buf,_("Unknown 0x%04x"), currentVal);
|
||||
gp_widget_set_value (*widget, buf);
|
||||
}
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static
|
||||
struct {
|
||||
char* str;
|
||||
uint16_t val;
|
||||
} panasonic_aftable[] = {
|
||||
{ N_("AF"), 0x0000 },
|
||||
{ N_("AF macro"), 0x0001 },
|
||||
{ N_("AF macro (D)"), 0x0002 },
|
||||
{ N_("MF"), 0x0003 },
|
||||
{ N_("AF_S"), 0x0004 },
|
||||
{ N_("AF_C"), 0x0005 },
|
||||
{ N_("AF_F"), 0x0006 },
|
||||
};
|
||||
|
||||
static int
|
||||
_put_Panasonic_AFMode(CONFIG_PUT_ARGS)
|
||||
{
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
char *xval;
|
||||
uint32_t val;
|
||||
uint32_t i;
|
||||
|
||||
CR (gp_widget_get_value(widget, &xval));
|
||||
|
||||
for (i=0;i<sizeof(panasonic_aftable)/sizeof(panasonic_aftable[0]);i++) {
|
||||
if (!strcmp(panasonic_aftable[i].str, xval)) {
|
||||
val = panasonic_aftable[i].val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return translate_ptp_result (ptp_panasonic_setdeviceproperty(params, PTP_DPC_PANASONIC_AFArea_AFModeParam, (unsigned char*)&val, 2));
|
||||
}
|
||||
|
||||
static int
|
||||
_get_Panasonic_AFMode(CONFIG_GET_ARGS) {
|
||||
uint32_t currentVal;
|
||||
uint32_t listCount;
|
||||
uint32_t *list;
|
||||
uint32_t i, j;
|
||||
int valset = 0;
|
||||
char buf[32];
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
GPContext *context = ((PTPData *) params->data)->context;
|
||||
|
||||
C_PTP_REP (ptp_panasonic_getdevicepropertydesc(params, PTP_DPC_PANASONIC_AFArea_AFModeParam, 2, ¤tVal, &list, &listCount));
|
||||
|
||||
//printf("retrieved %lu property values\n", listCount);
|
||||
|
||||
gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget);
|
||||
gp_widget_set_name (*widget, menu->name);
|
||||
|
||||
for (i = 0; i < listCount; i++) {
|
||||
for (j=0;j<sizeof(panasonic_aftable)/sizeof(panasonic_aftable[0]);j++) {
|
||||
sprintf(buf,_("%d"), list[i]);
|
||||
if ((int)list[i] == (int)currentVal && j == (int)currentVal) {
|
||||
gp_widget_set_value (*widget, panasonic_aftable[j].str);
|
||||
valset = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (j=0;j<sizeof(panasonic_aftable)/sizeof(panasonic_aftable[0]);j++) {
|
||||
gp_widget_add_choice (*widget, panasonic_aftable[j].str);
|
||||
}
|
||||
free(list);
|
||||
if (!valset) {
|
||||
sprintf(buf,_("Unknown 0x%04x"), currentVal);
|
||||
gp_widget_set_value (*widget, buf);
|
||||
}
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static
|
||||
struct {
|
||||
char* str;
|
||||
uint16_t val;
|
||||
} panasonic_mftable[] = {
|
||||
{ N_("Stop"), 0x0000 },
|
||||
{ N_("Far fast"), 0x0001 },
|
||||
{ N_("Far slow"), 0x0002 },
|
||||
{ N_("Near slow"), 0x0003 },
|
||||
{ N_("Near fast"), 0x0004 },
|
||||
};
|
||||
|
||||
static int
|
||||
_put_Panasonic_MFAdjust(CONFIG_PUT_ARGS)
|
||||
{
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
char *xval;
|
||||
uint32_t val = 0;
|
||||
uint32_t i;
|
||||
|
||||
CR (gp_widget_get_value(widget, &xval));
|
||||
for (i=0;i<sizeof(panasonic_mftable)/sizeof(panasonic_mftable[0]);i++) {
|
||||
if(!strcmp(panasonic_mftable[i].str, xval)) {
|
||||
val = panasonic_mftable[i].val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return translate_ptp_result (ptp_panasonic_manualfocusdrive (params, (uint16_t)val));
|
||||
}
|
||||
|
||||
static int
|
||||
_get_Panasonic_MFAdjust(CONFIG_GET_ARGS) {
|
||||
uint32_t i;
|
||||
gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget);
|
||||
gp_widget_set_name (*widget,menu->name);
|
||||
|
||||
for (i=0;i<sizeof(panasonic_mftable)/sizeof(panasonic_mftable[0]);i++) {
|
||||
gp_widget_add_choice (*widget, panasonic_mftable[i].str);
|
||||
}
|
||||
gp_widget_set_value (*widget, _("None"));
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static
|
||||
struct {
|
||||
char* str;
|
||||
uint16_t val;
|
||||
} panasonic_rmodetable[] = {
|
||||
{ N_("P"), 0x0000 },
|
||||
{ N_("A"), 0x0001 },
|
||||
{ N_("S"), 0x0002 },
|
||||
{ N_("M"), 0x0003 },
|
||||
};
|
||||
|
||||
static int
|
||||
_get_Panasonic_ExpMode(CONFIG_GET_ARGS) {
|
||||
|
||||
uint32_t currentVal;
|
||||
uint32_t listCount;
|
||||
uint32_t *list;
|
||||
uint32_t i,j;
|
||||
int valset = 0;
|
||||
char buf[32];
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
GPContext *context = ((PTPData *) params->data)->context;
|
||||
|
||||
C_PTP_REP (ptp_panasonic_getdevicepropertydesc(params, 0x06000011, 2, ¤tVal, &list, &listCount));
|
||||
|
||||
//printf("retrieved %lu property values\n", listCount);
|
||||
|
||||
gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget);
|
||||
gp_widget_set_name (*widget, menu->name);
|
||||
|
||||
for (j=0;j<sizeof(panasonic_rmodetable)/sizeof(panasonic_rmodetable[0]);j++) {
|
||||
gp_widget_add_choice (*widget, panasonic_rmodetable[j].str);
|
||||
}
|
||||
|
||||
for (i = 0; i < listCount; i++) {
|
||||
for (j=0;j<sizeof(panasonic_rmodetable)/sizeof(panasonic_rmodetable[0]);j++) {
|
||||
sprintf(buf,_("%d"), list[i]);
|
||||
if ((int)list[i] == (int)currentVal && j == (int)currentVal) {
|
||||
gp_widget_set_value (*widget, panasonic_rmodetable[j].str);
|
||||
valset = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
free(list);
|
||||
if (!valset) {
|
||||
sprintf(buf,_("Unknown 0x%04x"), currentVal);
|
||||
gp_widget_set_value (*widget, buf);
|
||||
}
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
_put_Panasonic_ExpMode(CONFIG_PUT_ARGS)
|
||||
{
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
char *xval;
|
||||
uint32_t val = 0;
|
||||
uint32_t i;
|
||||
|
||||
CR (gp_widget_get_value(widget, &xval));
|
||||
for (i=0;i<sizeof(panasonic_rmodetable)/sizeof(panasonic_rmodetable[0]);i++) {
|
||||
if(!strcmp(panasonic_rmodetable[i].str, xval)) {
|
||||
val = panasonic_rmodetable[i].val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//printf("val : %d\n", val);
|
||||
return translate_ptp_result (ptp_panasonic_recordmode(params, (uint16_t)val));
|
||||
}
|
||||
static
|
||||
struct {
|
||||
char* str;
|
||||
uint16_t val;
|
||||
} panasonic_recordtable[] = {
|
||||
{ N_("Standby"), 0x0000 },
|
||||
{ N_("Recording"), 0x0001 },
|
||||
{ N_("Playing"), 0x0002 },
|
||||
{ N_("Other process."), 0x0003 },
|
||||
{ N_("Other playing"), 0x0004 },
|
||||
{ N_("Noise reduction"),0x0005 },
|
||||
{ N_("Displaying menu"),0x0006 },
|
||||
{ N_("Streaming"), 0x0007 },
|
||||
};
|
||||
|
||||
static int
|
||||
_get_Panasonic_Recording(CONFIG_GET_ARGS) {
|
||||
uint32_t currentVal = 0;
|
||||
char buf[32];
|
||||
uint32_t i;
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
GPContext *context = ((PTPData *) params->data)->context;
|
||||
|
||||
uint16_t valsize;
|
||||
C_PTP_REP (ptp_panasonic_getrecordingstatus(params, 0x12000013, &valsize, ¤tVal));
|
||||
|
||||
gp_widget_new (GP_WIDGET_RADIO, _(menu->label), widget);
|
||||
gp_widget_set_name (*widget, menu->name);
|
||||
|
||||
for(i = 0; i < sizeof(panasonic_recordtable) / sizeof(panasonic_recordtable[0]); i++) {
|
||||
if (currentVal == panasonic_recordtable[i].val) {
|
||||
strcpy(buf, panasonic_recordtable[i].str);
|
||||
}
|
||||
}
|
||||
|
||||
gp_widget_set_value(*widget, &buf);
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
_put_Panasonic_Recording(CONFIG_PUT_ARGS)
|
||||
{
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
char *xval;
|
||||
uint32_t val = 0;
|
||||
uint32_t i;
|
||||
|
||||
CR (gp_widget_get_value(widget, &xval));
|
||||
if (!strcmp(xval, "start")) {
|
||||
return translate_ptp_result (ptp_panasonic_startrecording(params));
|
||||
} else if (!strcmp(xval, "stop")) {
|
||||
return translate_ptp_result (ptp_panasonic_stoprecording(params));
|
||||
} else {
|
||||
return GP_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_put_Panasonic_Whitebalance(CONFIG_PUT_ARGS)
|
||||
{
|
||||
@@ -8925,7 +9302,7 @@ _put_Panasonic_Whitebalance(CONFIG_PUT_ARGS)
|
||||
}
|
||||
/* free(list); */
|
||||
GP_LOG_D("setting whitebalance to 0x%04x", val);
|
||||
return translate_ptp_result (ptp_panasonic_setdeviceproperty(params, PTP_DPC_PANASONIC_WhiteBalance, (unsigned char*)&val, 2));
|
||||
return translate_ptp_result (ptp_panasonic_setdeviceproperty(params, PTP_DPC_PANASONIC_WhiteBalance_Param, (unsigned char*)&val, 2));
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -8939,7 +9316,7 @@ _get_Panasonic_Whitebalance(CONFIG_GET_ARGS) {
|
||||
PTPParams *params = &(camera->pl->params);
|
||||
GPContext *context = ((PTPData *) params->data)->context;
|
||||
|
||||
C_PTP_REP (ptp_panasonic_getdevicepropertydesc(params, PTP_DPC_PANASONIC_WhiteBalance, 2, ¤tVal, &list, &listCount));
|
||||
C_PTP_REP (ptp_panasonic_getdevicepropertydesc(params, PTP_DPC_PANASONIC_WhiteBalance_Param, 2, ¤tVal, &list, &listCount));
|
||||
|
||||
//printf("retrieved %lu property values\n", listCount);
|
||||
|
||||
@@ -8984,7 +9361,7 @@ _put_Panasonic_Exposure(CONFIG_PUT_ARGS)
|
||||
val = (uint32_t)(0x8000 | (int)(((-f)*3)));
|
||||
else
|
||||
val = (uint32_t) (f*3);
|
||||
return translate_ptp_result (ptp_panasonic_setdeviceproperty(params, PTP_DPC_PANASONIC_Exposure, (unsigned char*)&val, 2));
|
||||
return translate_ptp_result (ptp_panasonic_setdeviceproperty(params, PTP_DPC_PANASONIC_Exposure_Param, (unsigned char*)&val, 2));
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -9011,11 +9388,13 @@ _get_Panasonic_Exposure(CONFIG_GET_ARGS) {
|
||||
val = -(val & 0x7fff);
|
||||
sprintf (buf, "%f", val/3.0);
|
||||
gp_widget_add_choice (*widget, buf);
|
||||
if ((int)list[i] == (int)currentVal) {
|
||||
sprintf (buf, "%f", val/3.0);
|
||||
gp_widget_set_value (*widget, &buf);
|
||||
}
|
||||
}
|
||||
free(list);
|
||||
|
||||
sprintf (buf, "%f", (float)currentVal);
|
||||
gp_widget_set_value (*widget, &buf);
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
@@ -10259,6 +10638,13 @@ static struct submenu capture_settings_menu[] = {
|
||||
{ N_("Exposure Compensation"), "exposurecompensation", PTP_DPC_CANON_EOS_ExpCompensation, PTP_VENDOR_CANON, PTP_DTC_UINT8, _get_Canon_ExpCompensation2, _put_Canon_ExpCompensation2 },
|
||||
{ N_("Exposure Compensation"), "exposurecompensation", 0, PTP_VENDOR_PANASONIC, PTP_DTC_INT32, _get_Panasonic_Exposure, _put_Panasonic_Exposure },
|
||||
{ N_("White Balance"), "whitebalance", 0, PTP_VENDOR_PANASONIC, PTP_DTC_INT32, _get_Panasonic_Whitebalance, _put_Panasonic_Whitebalance },
|
||||
{ N_("Color temperature"), "colortemperature", 0, PTP_VENDOR_PANASONIC, PTP_DTC_INT32, _get_Panasonic_ColorTemp, _put_Panasonic_ColorTemp },
|
||||
{ N_("Adjust A/B"), "whitebalanceadjustab", 0, PTP_VENDOR_PANASONIC, PTP_DTC_INT32, _get_Panasonic_AdjustAB, _put_Panasonic_AdjustAB },
|
||||
{ N_("Adjust G/M"), "whitebalanceadjustgm", 0, PTP_VENDOR_PANASONIC, PTP_DTC_INT32, _get_Panasonic_AdjustGM, _put_Panasonic_AdjustGM },
|
||||
{ N_("AF Mode"), "afmode", 0, PTP_VENDOR_PANASONIC, PTP_DTC_INT32, _get_Panasonic_AFMode, _put_Panasonic_AFMode },
|
||||
{ N_("MF Adjust"), "mfadjust", 0, PTP_VENDOR_PANASONIC, PTP_DTC_INT32, _get_Panasonic_MFAdjust, _put_Panasonic_MFAdjust },
|
||||
{ N_("Exp mode"), "expmode", 0, PTP_VENDOR_PANASONIC, PTP_DTC_INT32, _get_Panasonic_ExpMode, _put_Panasonic_ExpMode },
|
||||
{ N_("Start/Stop recording"), "recording", 0, PTP_VENDOR_PANASONIC, PTP_DTC_INT32, _get_Panasonic_Recording, _put_Panasonic_Recording },
|
||||
/* these cameras also have PTP_DPC_ExposureBiasCompensation, avoid overlap */
|
||||
{ N_("Exposure Compensation"), "exposurecompensation2", PTP_DPC_NIKON_ExposureCompensation, PTP_VENDOR_NIKON, PTP_DTC_UINT8, _get_Nikon_OnOff_UINT8, _put_Nikon_OnOff_UINT8 },
|
||||
{ N_("Flash Compensation"), "flashcompensation", PTP_DPC_CANON_FlashCompensation, PTP_VENDOR_CANON, PTP_DTC_UINT8, _get_Canon_ExpCompensation, _put_Canon_ExpCompensation },
|
||||
|
||||
@@ -1604,6 +1604,55 @@ ptp_panasonic_manualfocusdrive (PTPParams* params, uint16_t mode)
|
||||
return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, sizeof(data), &xdata, NULL);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
ptp_panasonic_recordmode (PTPParams* params, uint16_t mode)
|
||||
{
|
||||
PTPContainer ptp;
|
||||
unsigned char data[10];
|
||||
unsigned char *xdata = data;
|
||||
uint32_t propcode = 0x06000011;
|
||||
uint32_t type = 2;
|
||||
|
||||
htod32a(data, propcode); /* memcpy(data, &propcode, 4); */
|
||||
htod32a(&data[4], type); /* memcpy(&data[4], &type, 4); */
|
||||
htod16a(&data[8], mode); /* memcpy(&data[8], &mode, 2); */
|
||||
|
||||
PTP_CNT_INIT(ptp, PTP_OC_PANASONIC_9409, propcode);
|
||||
return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, sizeof(data), &xdata, NULL);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
ptp_panasonic_startrecording (PTPParams* params)
|
||||
{
|
||||
PTPContainer ptp;
|
||||
unsigned char data[8];
|
||||
unsigned char *xdata = data;
|
||||
uint32_t propcode = 0x07000011;
|
||||
uint32_t type = 0;
|
||||
|
||||
htod32a(data, propcode); /* memcpy(data, &propcode, 4); */
|
||||
htod32a(&data[4], type); /* memcpy(&data[4], &type, 4); */
|
||||
|
||||
PTP_CNT_INIT(ptp, PTP_OC_PANASONIC_MovieRecControl, propcode);
|
||||
return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, sizeof(data), &xdata, NULL);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
ptp_panasonic_stoprecording (PTPParams* params)
|
||||
{
|
||||
PTPContainer ptp;
|
||||
unsigned char data[8];
|
||||
unsigned char *xdata = data;
|
||||
uint32_t propcode = 0x07000012;
|
||||
uint32_t type = 0;
|
||||
|
||||
htod32a(data, propcode); /* memcpy(data, &propcode, 4); */
|
||||
htod32a(&data[4], type); /* memcpy(&data[4], &type, 4); */
|
||||
|
||||
PTP_CNT_INIT(ptp, PTP_OC_PANASONIC_MovieRecControl, propcode);
|
||||
return ptp_transaction(params, &ptp, PTP_DP_SENDDATA, sizeof(data), &xdata, NULL);
|
||||
}
|
||||
|
||||
uint16_t
|
||||
ptp_panasonic_getcapturetarget (PTPParams* params, uint16_t *target)
|
||||
{
|
||||
@@ -1706,6 +1755,34 @@ ptp_panasonic_getdevicepropertydesc (PTPParams *params, uint32_t propcode, uint1
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
ptp_panasonic_getrecordingstatus (PTPParams *params, uint32_t propcode, uint16_t *valuesize, uint32_t *currentValue)
|
||||
{
|
||||
PTPContainer ptp;
|
||||
unsigned char *data = NULL;
|
||||
unsigned int size = 0;
|
||||
uint16_t ret = PTP_RC_OK;
|
||||
|
||||
PTP_CNT_INIT(ptp, PTP_OC_PANASONIC_PollEvents, propcode);
|
||||
CHECK_PTP_RC(ptp_transaction(params, &ptp, PTP_DP_GETDATA, 0, &data, &size));
|
||||
if (!data) return PTP_RC_GeneralError;
|
||||
|
||||
if(size < 8) return PTP_RC_GeneralError;
|
||||
*valuesize = dtoh32a( (data + 4) );
|
||||
|
||||
if(size < 8u + (*valuesize)) return PTP_RC_GeneralError;
|
||||
if(*valuesize == 4) {
|
||||
*currentValue = dtoh32a( (data + 8) );
|
||||
} else if(*valuesize == 2) {
|
||||
*currentValue = (uint32_t) dtoh16a( (data + 8) );
|
||||
} else {
|
||||
return PTP_RC_GeneralError;
|
||||
}
|
||||
//printf("ptp_panasonic_getdeviceproperty: size: %lu, valuesize: %d, currentValue: %lu\n", size, *valuesize, *currentValue);
|
||||
|
||||
free (data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
ptp_panasonic_getdeviceproperty (PTPParams *params, uint32_t propcode, uint16_t *valuesize, uint32_t *currentValue)
|
||||
|
||||
@@ -4792,11 +4792,15 @@ uint16_t ptp_panasonic_liveview_image (PTPParams* params, unsigned char **data,
|
||||
|
||||
uint16_t ptp_panasonic_setdeviceproperty (PTPParams* params, uint32_t propcode, unsigned char *value, uint16_t valuesize);
|
||||
uint16_t ptp_panasonic_getdeviceproperty (PTPParams *params, uint32_t propcode, uint16_t *valuesize, uint32_t *currentValue);
|
||||
uint16_t ptp_panasonic_getrecordingstatus (PTPParams *params, uint32_t propcode, uint16_t *valuesize, uint32_t *currentValue);
|
||||
uint16_t ptp_panasonic_getdevicepropertydesc (PTPParams *params, uint32_t propcode, uint16_t valuesize, uint32_t *currentValue, uint32_t **propertyValueList, uint32_t *propertyValueListLength);
|
||||
uint16_t ptp_panasonic_getdevicepropertysize (PTPParams *params, uint32_t propcode);
|
||||
uint16_t ptp_panasonic_getcapturetarget (PTPParams *params, uint16_t *target);
|
||||
uint16_t ptp_panasonic_setcapturetarget (PTPParams *params, uint16_t target);
|
||||
uint16_t ptp_panasonic_manualfocusdrive (PTPParams* params, uint16_t mode);
|
||||
uint16_t ptp_panasonic_recordmode (PTPParams* params, uint16_t mode);
|
||||
uint16_t ptp_panasonic_startrecording (PTPParams* params);
|
||||
uint16_t ptp_panasonic_stoprecording (PTPParams* params);
|
||||
uint16_t ptp_panasonic_9401 (PTPParams* params, uint32_t x);
|
||||
|
||||
uint16_t ptp_panasonic_9414_0d800012 (PTPParams* params, PanasonicLiveViewSize **liveviewsizes, unsigned int *nrofliveviewsizes);
|
||||
|
||||
Reference in New Issue
Block a user