added formatstore function.
fixed iconv for interesting operating systems. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@9163 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2006-09-13 Marcus Meissner <marcus@jet.franken.de>
|
||||
|
||||
* ptp.[ch]: formatstore function (from libmtp).
|
||||
* library.c: fixed iconv() usage for non glibc etc (from libmtp).
|
||||
|
||||
2006-09-11 Marcus Meissner <marcus@jet.franken.de>
|
||||
|
||||
* library.c: Added iRIver T10 2GB model.
|
||||
|
||||
@@ -50,6 +50,23 @@
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On MacOS (Darwin) and *BSD we're not using glibc, but libiconv.
|
||||
* glibc knows that UCS-2 is to be in the local machine endianness,
|
||||
* whereas libiconv does not. So we construct this macro to get
|
||||
* things right. Reportedly, glibc 2.1.3 has a bug so that UCS-2
|
||||
* is always bigendian though, we would need to work around that
|
||||
* too...
|
||||
*/
|
||||
#ifndef __GLIBC__
|
||||
#define UCS_2_INTERNAL "UCS-2-INTERNAL"
|
||||
#else
|
||||
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1 )
|
||||
#error "Too old glibc. This versions iconv() implementation cannot be trusted."
|
||||
#endif
|
||||
#define UCS_2_INTERNAL "UCS-2"
|
||||
#endif
|
||||
|
||||
#include "ptp.h"
|
||||
#include "ptp-bugs.h"
|
||||
#include "ptp-private.h"
|
||||
@@ -3469,8 +3486,8 @@ camera_init (Camera *camera, GPContext *context)
|
||||
|
||||
curloc = nl_langinfo (CODESET);
|
||||
if (!curloc) curloc="UTF-8";
|
||||
camera->pl->params.cd_ucs2_to_locale = iconv_open(curloc, "UCS-2");
|
||||
camera->pl->params.cd_locale_to_ucs2 = iconv_open("UCS-2", curloc);
|
||||
camera->pl->params.cd_ucs2_to_locale = iconv_open(curloc, UCS_2_INTERNAL);
|
||||
camera->pl->params.cd_locale_to_ucs2 = iconv_open(UCS_2_INTERNAL, curloc);
|
||||
if ((camera->pl->params.cd_ucs2_to_locale == (iconv_t) -1) ||
|
||||
(camera->pl->params.cd_locale_to_ucs2 == (iconv_t) -1)) {
|
||||
gp_log (GP_LOG_ERROR, "iconv", "Failed to create iconv converter.\n");
|
||||
|
||||
@@ -679,6 +679,28 @@ ptp_getstorageinfo (PTPParams* params, uint32_t storageid,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ptp_formatstore:
|
||||
* params: PTPParams*
|
||||
* storageid - StorageID
|
||||
*
|
||||
* Formats the storage on the device.
|
||||
*
|
||||
* Return values: Some PTP_RC_* code.
|
||||
**/
|
||||
uint16_t
|
||||
ptp_formatstore (PTPParams* params, uint32_t storageid)
|
||||
{
|
||||
PTPContainer ptp;
|
||||
|
||||
PTP_CNT_INIT(ptp);
|
||||
ptp.Code=PTP_OC_FormatStore;
|
||||
ptp.Param1=storageid;
|
||||
ptp.Param2=PTP_FST_Undefined;
|
||||
ptp.Nparam=2;
|
||||
return ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* ptp_getobjecthandles:
|
||||
* params: PTPParams*
|
||||
|
||||
@@ -1145,6 +1145,7 @@ uint16_t ptp_closesession (PTPParams *params);
|
||||
uint16_t ptp_getstorageids (PTPParams* params, PTPStorageIDs* storageids);
|
||||
uint16_t ptp_getstorageinfo (PTPParams* params, uint32_t storageid,
|
||||
PTPStorageInfo* storageinfo);
|
||||
uint16_t ptp_formatstore (PTPParams* params, uint32_t storageid);
|
||||
|
||||
uint16_t ptp_getobjecthandles (PTPParams* params, uint32_t storage,
|
||||
uint32_t objectformatcode,
|
||||
|
||||
Reference in New Issue
Block a user