⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptp.h

📁 Media transfer protocol implementation on POSIX. Have detailed readme on how to move to windows
💻 H
📖 第 1 页 / 共 4 页
字号:
/* ptp.h * * Copyright (C) 2001 Mariusz Woloszyn <emsi@ipartners.pl> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */#ifndef __PTP_H__#define __PTP_H__#include <stdarg.h>#include <time.h>#include <iconv.h>#include "gphoto2-endian.h"/* PTP datalayer byteorder */#define PTP_DL_BE			0xF0#define	PTP_DL_LE			0x0F/* PTP request/response/event general PTP container (transport independent) */struct _PTPContainer {	uint16_t Code;	uint32_t SessionID;	uint32_t Transaction_ID;	/* params  may be of any type of size less or equal to uint32_t */	uint32_t Param1;	uint32_t Param2;	uint32_t Param3;	/* events can only have three parameters */	uint32_t Param4;	uint32_t Param5;	/* the number of meaningfull parameters */	uint8_t	 Nparam;};typedef struct _PTPContainer PTPContainer;/* PTP USB Bulk-Pipe container *//* USB bulk max packet length for high speed endpoints *//* I have changed this from 512 to 4096 now. The spec says * "end of data transfers are signaled by short packets or NULL * packets". It never says anything about 512. * So it should work like this and the MTP folks will be happier... * -Marcus */#define PTP_USB_BULK_HS_MAX_PACKET_LEN	4096#define PTP_USB_BULK_HDR_LEN		(2*sizeof(uint32_t)+2*sizeof(uint16_t))#define PTP_USB_BULK_PAYLOAD_LEN	(PTP_USB_BULK_HS_MAX_PACKET_LEN-PTP_USB_BULK_HDR_LEN)#define PTP_USB_BULK_REQ_LEN	(PTP_USB_BULK_HDR_LEN+5*sizeof(uint32_t))struct _PTPUSBBulkContainer {	uint32_t length;	uint16_t type;	uint16_t code;	uint32_t trans_id;	union {		struct {			uint32_t param1;			uint32_t param2;			uint32_t param3;			uint32_t param4;			uint32_t param5;		} params;		unsigned char data[PTP_USB_BULK_PAYLOAD_LEN];	} payload;};typedef struct _PTPUSBBulkContainer PTPUSBBulkContainer;/* PTP USB Asynchronous Event Interrupt Data Format */struct _PTPUSBEventContainer {	uint32_t length;	uint16_t type;	uint16_t code;	uint32_t trans_id;	uint32_t param1;	uint32_t param2;	uint32_t param3;};typedef struct _PTPUSBEventContainer PTPUSBEventContainer;struct _PTPCanon_directtransfer_entry {	uint32_t	oid;	char		*str;};typedef struct _PTPCanon_directtransfer_entry PTPCanon_directtransfer_entry;/* USB container types */#define PTP_USB_CONTAINER_UNDEFINED		0x0000#define PTP_USB_CONTAINER_COMMAND		0x0001#define PTP_USB_CONTAINER_DATA			0x0002#define PTP_USB_CONTAINER_RESPONSE		0x0003#define PTP_USB_CONTAINER_EVENT			0x0004/* PTP/IP definitions */#define PTPIP_INIT_COMMAND_REQUEST	1#define PTPIP_INIT_COMMAND_ACK		2#define PTPIP_INIT_EVENT_REQUEST	3#define PTPIP_INIT_EVENT_ACK		4#define PTPIP_INIT_FAIL			5#define PTPIP_CMD_REQUEST		6#define PTPIP_CMD_RESPONSE		7#define PTPIP_EVENT			8#define PTPIP_START_DATA_PACKET		9#define PTPIP_DATA_PACKET		10#define PTPIP_CANCEL_TRANSACTION	11#define PTPIP_END_DATA_PACKET		12#define PTPIP_PING			13#define PTPIP_PONG			14struct _PTPIPHeader {	uint32_t	length;	uint32_t	type;};typedef struct _PTPIPHeader PTPIPHeader;/* Vendor IDs */#define PTP_VENDOR_EASTMAN_KODAK	0x00000001#define PTP_VENDOR_SEIKO_EPSON		0x00000002#define PTP_VENDOR_AGILENT		0x00000003#define PTP_VENDOR_POLAROID		0x00000004#define PTP_VENDOR_AGFA_GEVAERT		0x00000005#define PTP_VENDOR_MICROSOFT		0x00000006#define PTP_VENDOR_EQUINOX		0x00000007#define PTP_VENDOR_VIEWQUEST		0x00000008#define PTP_VENDOR_STMICROELECTRONICS	0x00000009#define PTP_VENDOR_NIKON		0x0000000A#define PTP_VENDOR_CANON		0x0000000B/* Operation Codes */#define PTP_OC_Undefined                0x1000#define PTP_OC_GetDeviceInfo            0x1001#define PTP_OC_OpenSession              0x1002#define PTP_OC_CloseSession             0x1003#define PTP_OC_GetStorageIDs            0x1004#define PTP_OC_GetStorageInfo           0x1005#define PTP_OC_GetNumObjects            0x1006#define PTP_OC_GetObjectHandles         0x1007#define PTP_OC_GetObjectInfo            0x1008#define PTP_OC_GetObject                0x1009#define PTP_OC_GetThumb                 0x100A#define PTP_OC_DeleteObject             0x100B#define PTP_OC_SendObjectInfo           0x100C#define PTP_OC_SendObject               0x100D#define PTP_OC_InitiateCapture          0x100E#define PTP_OC_FormatStore              0x100F#define PTP_OC_ResetDevice              0x1010#define PTP_OC_SelfTest                 0x1011#define PTP_OC_SetObjectProtection      0x1012#define PTP_OC_PowerDown                0x1013#define PTP_OC_GetDevicePropDesc        0x1014#define PTP_OC_GetDevicePropValue       0x1015#define PTP_OC_SetDevicePropValue       0x1016#define PTP_OC_ResetDevicePropValue     0x1017#define PTP_OC_TerminateOpenCapture     0x1018#define PTP_OC_MoveObject               0x1019#define PTP_OC_CopyObject               0x101A#define PTP_OC_GetPartialObject         0x101B#define PTP_OC_InitiateOpenCapture      0x101C/* Eastman Kodak extension Operation Codes */#define PTP_OC_EK_GetSerial		0x9003#define PTP_OC_EK_SetSerial		0x9004#define PTP_OC_EK_SendFileObjectInfo	0x9005#define PTP_OC_EK_SendFileObject	0x9006#define PTP_OC_EK_SetText		0x9008/* Canon extension Operation Codes */#define PTP_OC_CANON_GetPartialObjectInfo	0x9001#define PTP_OC_CANON_SetObjectArchive		0x9002/* 9002 - sends 2 uint32, nothing back  */#define PTP_OC_CANON_9003			0x9003/* 9003 - sends nothing, nothing back  *//* no 9004 observed yet *//* no 9005 observed yet */#define PTP_OC_CANON_GetObjectHandleByName	0x9006/* no 9007 observed yet */#define PTP_OC_CANON_StartShootingMode		0x9008#define PTP_OC_CANON_EndShootingMode		0x9009/* 900a - sends nothing, nothing back */#define PTP_OC_CANON_900a			0x900A#define PTP_OC_CANON_ViewfinderOn		0x900B#define PTP_OC_CANON_ViewfinderOff		0x900C#define PTP_OC_CANON_DoAeAfAwb			0x900D/* 900e - send nothing, gets 5 uint16t in 32bit entities back in 20byte datablob */#define PTP_OC_CANON_GetCustomizeSpec		0x900E#define PTP_OC_CANON_GetCustomizeItemInfo	0x900F#define PTP_OC_CANON_GetCustomizeData		0x9010#define PTP_OC_CANON_SetCustomizeData		0x9011/* initiate movie capture:   9010 startmoviecapture?   9003 stopmoviecapture?*/#define PTP_OC_CANON_CheckEvent			0x9013#define PTP_OC_CANON_FocusLock			0x9014#define PTP_OC_CANON_FocusUnlock		0x9015#define PTP_OC_CANON_InitiateCaptureInMemory	0x901A#define PTP_OC_CANON_GetPartialObjectEx		0x901B#define PTP_OC_CANON_SetObjectTime		0x901C#define PTP_OC_CANON_GetViewfinderImage		0x901D#define PTP_OC_CANON_ChangeUSBProtocol		0x901F#define PTP_OC_CANON_GetChanges			0x9020#define PTP_OC_CANON_GetObjectInfoEx		0x9021#define PTP_OC_CANON_TerminateDirectTransfer 	0x9023#define PTP_OC_CANON_InitiateDirectTransferEx2 	0x9028#define PTP_OC_CANON_GetTargetHandles 		0x9029#define PTP_OC_CANON_NotifyProgress 		0x902A#define PTP_OC_CANON_NotifyCancelAccepted	0x902B/* 902c: no parms, read 3 uint32 in data, no response parms */#define PTP_OC_CANON_902C			0x902C#define PTP_OC_CANON_GetDirectory		0x902D#define PTP_OC_CANON_SetPairingInfo		0x9030#define PTP_OC_CANON_GetPairingInfo		0x9031#define PTP_OC_CANON_DeletePairingInfo		0x9032#define PTP_OC_CANON_GetMACAddress		0x9033/* 9034: 1 param, no parms returned */#define PTP_OC_CANON_SetDisplayMonitor		0x9034#define PTP_OC_CANON_PairingComplete		0x9035#define PTP_OC_CANON_GetWirelessMAXChannel	0x9036/* Nikon extension Operation Codes */#define PTP_OC_NIKON_GetProfileAllData	0x9006#define PTP_OC_NIKON_SendProfileData	0x9007#define PTP_OC_NIKON_DeleteProfile	0x9008#define PTP_OC_NIKON_SetProfileData	0x9009#define PTP_OC_NIKON_AdvancedTransfer	0x9010#define PTP_OC_NIKON_GetFileInfoInBlock	0x9011#define PTP_OC_NIKON_Capture		0x90C0#define PTP_OC_NIKON_SetControlMode	0x90C2#define PTP_OC_NIKON_CurveDownload	0x90C5#define PTP_OC_NIKON_CurveUpload	0x90C6#define PTP_OC_NIKON_CheckEvent		0x90C7#define PTP_OC_NIKON_DeviceReady	0x90C8#define PTP_OC_NIKON_GetDevicePTPIPInfo	0x90E0/* Microsoft / MTP extension codes */#define PTP_OC_MTP_GetSecureTimeChallenge	0x9101#define PTP_OC_MTP_GetSecureTimeResponse	0x9102#define PTP_OC_MTP_SetLicenseResponse		0x9103#define PTP_OC_MTP_GetSyncList			0x9104#define PTP_OC_MTP_SendMeterChallengeQuery	0x9105#define PTP_OC_MTP_GetMeterChallenge		0x9106#define PTP_OC_MTP_SetMeterResponse		0x9107#define PTP_OC_MTP_CleanDataStore		0x9108#define PTP_OC_MTP_GetLicenseState		0x9109#define PTP_OC_MTP_GetObjectPropsSupported	0x9801#define PTP_OC_MTP_GetObjectPropDesc		0x9802#define PTP_OC_MTP_GetObjectPropValue		0x9803#define PTP_OC_MTP_SetObjectPropValue		0x9804#define PTP_OC_MTP_GetObjPropList		0x9805#define PTP_OC_MTP_SetObjPropList		0x9806#define PTP_OC_MTP_GetInterdependendPropdesc	0x9807#define PTP_OC_MTP_SendObjectPropList		0x9808#define PTP_OC_MTP_GetObjectReferences		0x9810#define PTP_OC_MTP_SetObjectReferences		0x9811#define PTP_OC_MTP_UpdateDeviceFirmware		0x9812#define PTP_OC_MTP_Skip				0x9820/* Proprietary vendor extension operations mask */#define PTP_OC_EXTENSION_MASK           0xF000#define PTP_OC_EXTENSION                0x9000/* Response Codes */#define PTP_RC_Undefined                0x2000#define PTP_RC_OK                       0x2001#define PTP_RC_GeneralError             0x2002#define PTP_RC_SessionNotOpen           0x2003#define PTP_RC_InvalidTransactionID	0x2004#define PTP_RC_OperationNotSupported    0x2005#define PTP_RC_ParameterNotSupported    0x2006#define PTP_RC_IncompleteTransfer       0x2007#define PTP_RC_InvalidStorageId         0x2008#define PTP_RC_InvalidObjectHandle      0x2009#define PTP_RC_DevicePropNotSupported   0x200A#define PTP_RC_InvalidObjectFormatCode  0x200B#define PTP_RC_StoreFull                0x200C#define PTP_RC_ObjectWriteProtected     0x200D#define PTP_RC_StoreReadOnly            0x200E#define PTP_RC_AccessDenied             0x200F#define PTP_RC_NoThumbnailPresent       0x2010#define PTP_RC_SelfTestFailed           0x2011#define PTP_RC_PartialDeletion          0x2012#define PTP_RC_StoreNotAvailable        0x2013#define PTP_RC_SpecificationByFormatUnsupported         0x2014#define PTP_RC_NoValidObjectInfo        0x2015#define PTP_RC_InvalidCodeFormat        0x2016#define PTP_RC_UnknownVendorCode        0x2017#define PTP_RC_CaptureAlreadyTerminated 0x2018#define PTP_RC_DeviceBusy               0x2019#define PTP_RC_InvalidParentObject      0x201A#define PTP_RC_InvalidDevicePropFormat  0x201B#define PTP_RC_InvalidDevicePropValue   0x201C#define PTP_RC_InvalidParameter         0x201D#define PTP_RC_SessionAlreadyOpened     0x201E#define PTP_RC_TransactionCanceled      0x201F#define PTP_RC_SpecificationOfDestinationUnsupported            0x2020/* Eastman Kodak extension Response Codes */#define PTP_RC_EK_FilenameRequired	0xA001#define PTP_RC_EK_FilenameConflicts	0xA002#define PTP_RC_EK_FilenameInvalid	0xA003/* Nikon specific response codes */#define PTP_RC_NIKON_AdvancedTransferCancel 0xA022/* Microsoft/MTP specific codes */#define PTP_RC_MTP_Undefined			0xA800#define PTP_RC_MTP_Invalid_ObjectPropCode	0xA801#define PTP_RC_MTP_Invalid_ObjectProp_Format	0xA802#define PTP_RC_MTP_Invalid_ObjectProp_Value	0xA803#define PTP_RC_MTP_Invalid_ObjectReference	0xA804#define PTP_RC_MTP_Invalid_Dataset		0xA806#define PTP_RC_MTP_Specification_By_Group_Unsupported		0xA808#define PTP_RC_MTP_Object_Too_Large		0xA809

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -