summary: layout property summary in a more table based look
Also represent type as human readable string instead of hex code and drop the 0x prefix in the hex-representation of the property id. Example: ``` Device Property Summary: [...] SerialNumber (d1af): (ro str) '153022001713' Artist (d1d0): (rw str) '' Copyright (d1d1): (rw str) '' AEB (d1d9): (rw u16) Enumeration [0,3,5,8,11,13,16,19, ... LvAfSystem (d1ba): (ro u32) Enumeration [10,1,5,6,11,12,13,14]... MovieParam5 (d20d): (rw ???) Enumeration [] value: Undefined ```
This commit is contained in:
@@ -7942,13 +7942,9 @@ camera_summary (Camera* camera, CameraText* summary, GPContext *context)
|
||||
unsigned int dpc = pdi.DevicePropertiesSupported[i];
|
||||
const char *propname = ptp_get_property_description (params, dpc);
|
||||
|
||||
if (propname) {
|
||||
/* string registered for i18n in ptp.c. */
|
||||
APPEND_TXT ("%s(0x%04x):", _(propname), dpc);
|
||||
} else {
|
||||
APPEND_TXT ("Property 0x%04x:", dpc);
|
||||
}
|
||||
|
||||
/* string registered for i18n in ptp.c. */
|
||||
APPEND_TXT ("%-25s (%04x): ", propname ? _(propname) : _("[Unknown Property]"), dpc);
|
||||
|
||||
/* Do not read the 0xd201 property (found on Creative Zen series).
|
||||
* It seems to cause hangs.
|
||||
@@ -7970,11 +7966,11 @@ camera_summary (Camera* camera, CameraText* summary, GPContext *context)
|
||||
ret = ptp_generic_getdevicepropdesc (params, dpc, &dpd);
|
||||
if (ret == PTP_RC_OK) {
|
||||
switch (dpd.GetSet) {
|
||||
case PTP_DPGS_Get: APPEND_TXT ("(%s) ", N_("read only")); break;
|
||||
case PTP_DPGS_GetSet: APPEND_TXT ("(%s) ", N_("readwrite")); break;
|
||||
default: APPEND_TXT ("(%s) ", N_("Unknown"));
|
||||
case PTP_DPGS_Get: APPEND_TXT ("(%s ", "ro"); break;
|
||||
case PTP_DPGS_GetSet: APPEND_TXT ("(%s ", "rw"); break;
|
||||
default: APPEND_TXT ("(%s ", "error");
|
||||
}
|
||||
APPEND_TXT ("(type=0x%x) ",dpd.DataType);
|
||||
APPEND_TXT ("%s) ", ptp_data_type_name(params, dpd.DataType));
|
||||
switch (dpd.FormFlag) {
|
||||
case PTP_DPFF_None: break;
|
||||
case PTP_DPFF_Range: {
|
||||
|
||||
@@ -6177,6 +6177,40 @@ ptp_strerror(uint16_t ret, uint16_t vendor)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char*
|
||||
ptp_data_type_name(PTPParams* params, uint32_t dt)
|
||||
{
|
||||
switch (dt)
|
||||
{
|
||||
case PTP_DTC_UNDEF: return "???";
|
||||
case PTP_DTC_STR: return "str";
|
||||
|
||||
case PTP_DTC_INT8: return "i8 ";
|
||||
case PTP_DTC_UINT8: return "u8 ";
|
||||
case PTP_DTC_INT16: return "i16";
|
||||
case PTP_DTC_UINT16: return "u16";
|
||||
case PTP_DTC_INT32: return "i32";
|
||||
case PTP_DTC_UINT32: return "u32";
|
||||
case PTP_DTC_INT64: return "i64";
|
||||
case PTP_DTC_UINT64: return "u64";
|
||||
case PTP_DTC_INT128: return "i128";
|
||||
case PTP_DTC_UINT128: return "u128";
|
||||
|
||||
case PTP_DTC_AINT8: return "[i8 ]";
|
||||
case PTP_DTC_AUINT8: return "[u8 ]";
|
||||
case PTP_DTC_AINT16: return "[i16]";
|
||||
case PTP_DTC_AUINT16: return "[u16]";
|
||||
case PTP_DTC_AINT32: return "[i32]";
|
||||
case PTP_DTC_AUINT32: return "[u32]";
|
||||
case PTP_DTC_AINT64: return "[i64]";
|
||||
case PTP_DTC_AUINT64: return "[u64]";
|
||||
case PTP_DTC_AINT128: return "[i128]";
|
||||
case PTP_DTC_AUINT128: return "[u128]";
|
||||
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
const char*
|
||||
ptp_get_property_description(PTPParams* params, uint32_t dpc)
|
||||
{
|
||||
|
||||
@@ -4835,6 +4835,7 @@ const char* ptp_bytes2str (const uint8_t *data, int data_size, const char *fmt);
|
||||
void ptp_debug_data (PTPParams *params, const uint8_t *data, int size);
|
||||
|
||||
|
||||
const char* ptp_data_type_name(PTPParams* params, uint32_t dt);
|
||||
const char* ptp_get_property_description(PTPParams* params, uint32_t dpc);
|
||||
|
||||
const char* ptp_get_opcode_name(PTPParams* params, uint16_t opcode);
|
||||
|
||||
Reference in New Issue
Block a user