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

📄 readme

📁 USB Host 开发中支持数码相机的源码。即Picture To Picture协议的完整实现
💻
📖 第 1 页 / 共 3 页
字号:
libptp2 (c)2001-2004 Mariusz Woloszyn <emsi@ipartners.pl>ptpcam  (c)2001-2004 Mariusz Woloszyn <emsi@ipartners.pl>=====================*About this software*=====================You may find new versions of this software at:http://sf.net/projects/libptpThis folder contains following code:ptp.c		- the main libptp2 codeptp.h		- libptp2 header filesptp-pack.c	- this file is included into ptp.c (internal code)ptpcam.c	- the software to manipulate PTP cameras		  (currently get/set properties); it does things that		  you can't do with gphoto2The libptp2 library is under development yet, but is considered to befunctional and quite stable.It was written to be used with gphoto2, but can be easily used with any othersoftware.==============*Requirements*==============Currently this package requires libusb to build ptpcam.The libptp2 library itself is transport layer independent and does not requirelibusb, however no other transport layer has been tested due to lackof PTP non-USB devices.You can obtain libusb at http://libusb.sf.net/If you want to build this library (for test purposes) on a box withoutlibusb pass --disable-ptpcam option to configure script.==================*What is libptp2?*==================libptp2 is a library used to communicate with PTP devices like stillimaging cameras or MP3 players (KODAK mc3).At the current stage if you want to download your pictures from your PTPcamera all you need is libgphoto2 (which contains libptp2 code) and gphoto2frontend (visit http://www.gphoto.org). This package contains only thedevelopers version of libptp2 and the ptpcam program used for tweakingPTP camera properties.===================*Supported Cameras*===================NOTE that if your camera is not on the list it DOES NOT mean that it is notsupported! Most of USB cameras designed after 2002 are PTP or USB MassStorage. In both cases the camera is supported under Linux!Below the list of cameras explicitly supported by gphoto2 ptp driver:(THIS TABLE IS OUTDATED!!! Maintaining the constantly growing list ofsupported cameras is harder than developing the driver ;)=============================================+Model			|Vendor ID|Product ID|========================|=========|==========|Kodak DC240 (PTP)	| 0x040a  |  0x0121  |Kodak DC4800		| 0x040a  |  0x0160  |Kodak DX3215		| 0x040a  |  0x0525  |Kodak DX3500		| 0x040a  |  0x0500  |Kodak DX3600		| 0x040a  |  0x0510  |Kodak DX3700		| 0x040a  |  0x0530  |Kodak DX3900		| 0x040a  |  0x0170  |Kodak DX4330		| 0x040a  |  0x0555  |Kodak DX4900		| 0x040a  |  0x0550  |Kodak MC3		| 0x040a  |  0x0400  |Kodak LS420		| 0x040a  |  0x0540  |Kodak LS443		| 0x040a  |  0x0568  |Kodak CX4200		| 0x040a  |  0x0560  |Kodak CX4210		| 0x040a  |  0x0560  |Kodak CX4230		| 0x040a  |  0x0535  |Kodak CX4300		| 0x040a  |  0x0566  |------------------------+---------+----------+HP PhotoSmart 120	| 0x03f0  |  0x6502  |HP PhotoSmart 318	| 0x03f0  |  0x6302  |HP PhotoSmart 320	| 0x03f0  |  0x6602  |HP PhotoSmart 612	| 0x03f0  |  0x6302  |HP PhotoSmart 620	| 0x03f0  |  0x6802  |HP PhotoSmart 715	| 0x03f0  |  0x6402  |HP PhotoSmart 720	| 0x03f0  |  0x6702  |HP PhotoSmart 735	| 0x03f0  |  0x6a02  |HP PhotoSmart 812	| 0x03f0  |  0x4202  |HP PhotoSmart 850	| 0x03f0  |  0x4302  |------------------------+---------+----------+Sony DSC-CD300		| 0x054c  |  0x004e  |Sony DSC-F505		| 0x054c  |  0x004e  |Sony DSC-F505V		| 0x054c  |  0x004e  |Sony DSC-F707		| 0x054c  |  0x004e  |Sony DSC-F707V		| 0x054c  |  0x004e  |Sony DSC-P5		| 0x054c  |  0x004e  |Sony DSC-P30		| 0x054c  |  0x004e  |Sony DSC-P50		| 0x054c  |  0x004e  |Sony DSC-P71		| 0x054c  |  0x004e  |Sony DSC-S75		| 0x054c  |  0x004e  |Sony DSC-S85		| 0x054c  |  0x004e  |Sony MVC-CD300		| 0x054c  |  0x004e  |------------------------+---------+----------+Nikon DSC D100		| 0x04b0  |  0x0402  |Nikon Coolpix 2000	| 0x04b0  |  0x0302  |Nikon Coolpix SQ	| 0x04b0  |  0x0202  |Nikon Coolpix 2500	| 0x04b0  |  0x0109  |Nikon Coolpix 4500	| 0x04b0  |  0x010b  |Nikon Coolpix 5700	| 0x04b0  |  0x010d  |Nikon Coolpix 4300	| 0x04b0  |  0x010f  |Nikon Coolpix 885	| 0x04b0  |  0x0112  |Nikon Coolpix 5400	| 0x04b0  |  0x0119  |------------------------+---------+----------+Canon PowerShot S45	| 0x04a9  |  0x306d  |Canon PowerShot G3	| 0x04a9  |  0x306f  |Canon PowerShot S230	| 0x04a9  |  0x3071  |Canon Digital IXUS v3	| 0x04a9  |  0x3071  |Canon PowerShot A70	| 0x04a9  |  0x3073  |==============================================Note that for some HP, Nikon, Canon and Sony cameras you have to switchthem to PTP mode as in most cases the camera is dual mode:PTP and USB Mass Storage or PTP and native.For some cameras it even changes the Product ID number, so don't panic ifit does not match the one listed above, just switch the mode.Don't ask me how to do it. Refer to camera documentation.=============*Quick Start*=============First of all you need kernel USB support. Please refer to your OSdocumentation for more info!For Linux users you need "Preliminary USB device filesystem" and "USB HostController" (the one for your hardware: EHCI, OHCI or UHCI) support in yourkernel.CAUTION: there was a bug in Linux Kernel 2.4.18 UHCI driver so make sure youuse more recent kernel!If you got a kernel support, make sure that your usbdevfs is mounted under/proc/bus/usb. In my case the fstab entry looks like this:usb     /proc/bus/usb   usbdevfs        defaults,user 0 0(NO, the entry in fstab isn't enough, you have to type: mount /proc/bus/usb).If you want to run ptpcam as regular user read this:http://gphoto.sourceforge.net/doc/manual/permissions-usb.htmlalthough I suggest performing all tests as root unless you're securityparanoid.If you have a PTP camera connected to your computer it should be detected byinvoking "ptpcam --list-devices".In my case the output looks like this:root@emsi(chroot):~# ptpcam --list-devicesListing devices...bus/dev vendorID/prodID device model002/035 0x040A/0x0400   Kodak mc3002/036 0x040A/0x0500   DX3500 Digital Camera001/027 0x040A/0x0160   DC4800 Zoom Digital CameraIf you get something like this:emsi@emsi(chroot):~> ptpcam --list-devicesListing devices...bus/dev vendorID/prodID device modelERROR: Could not open session!Try to reset the camera.it means that you did not read carefully what I wrote above about runningptpcam as regular user or your camera has stalled (needs reset).If you need some more debug try --verbose or --verbose=2 thus increasing theverbose level.What if you get "Found no PTP devices"?If you're sure that your camera is a PTP camera please check your OS usbconfig. In case of Linux make sure that you have usbdevfs mounted under/proc/bus/usb. If so read the output of 'cat /proc/bus/usb/devices' and checkif your camera is listed there.It might be that your camera is not in PTP mode. To verify so, issue:cat /proc/bus/usb/devices | grep "Cls=06"If you find something like this:I:  If#= 0 Alt= 0 #EPs= 3 Cls=06(still) Sub=01 Prot=01 Driver=(none)                          ^^^^^^^^^^^^^that means that your camera is in PTP mode and should be detected.If there is no interface of Class 6 refer to camera documentation to findhow to switch it into PTP mode.You may also try to use --force option while listing cameras or talking toit, but don't use it unless you really know what you are doing!!!--force forces ptpcam to talk to non PTP devices [which makes sense only incase of PTP device with interface class other than 6 (PTP), like Kodak DC240with PTP firmware]. BE AWARE that talking PTPish to non PTP devices maycause harmful damage!!!============*What next?*============I guess that you'd like to tweak camera properties? ;)Use "ptpcam --list-properties" to list all available camera properties.Unfortunately if you have bought a high-end camera or a very expensive PTPcamera it DOES NOT mean that it supports setting any properties. The problemis that manufacturers do not specify in documentation what properties oroperations are supported by the given camera. In most cases you never knowuntil you buy the camera. [I'll try to provide a list of supported cameraproperties and operations on libptp.sf.net]If ptpcam detects more than one camera you need to pass --bus=BUS-NUMBER and,or --dev=DEV-NUMBER arguments otherwise ptpcam tries to talk to first detectedcamera. If you specify only bus or dev number ptpcam talks to first matchingcamera.Let's say that you get something like this:root@emsi(chroot):~# ptpcam --list-propertiesListing properties...Querying: DX3500 Digital Camera0x5001 : Battery LevelIt means that your camera (in this case DX3500 Digital Camera) supports onlyone property, which is "Battery Level" (property number 0x5001). Not much,but you still can try to list its value:root@emsi(chroot):~# ptpcam --show-property=5001Camera: DX3500 Digital CameraProperty 'Battery Level'Data type is 0x0002Current value is 100Factory default value is 100The property is read only, enumerated. Allowed values are:010100As you can see --show-property argument does not require 0x, that's for yourconvenience. ;)The output of this command is quite verbose. It tells you about the Datatype (in this case 0x0002 means UINT8, if you want to know what are thosenumbers read ptp.h and look for PTP_DTC_* defines), current value, factorydefault value and the property type. The property type may vary amongdifferent cameras! In this camera 'Battery Level' is read only andenumerated. Allowed values are 0, 10 and 100 which (more or less) means:0 - low battery lever (may shut down immediately), 10 - medium batterylevel, 100 - full battery level. However for a different camera thisproperty may be defined as range of 1 to 100 with step of 1.That's just an example.Now let's look at the list of properties of another camera:root@emsi(chroot):~# ptpcam --list-propertiesListing properties...Querying: DC4800 Zoom Digital Camera0x5001 : Battery Level0x5003 : Image Size0x5004 : Compression Setting0x5005 : White Balance0x5006 : RGB Gain0x5007 : F-Number0x5008 : Focal Length0x5009 : Focus Distance0x500a : Focus Mode0x500b : Exposure Metering Mode0x500c : Flash Mode0x500d : Exposure Time0x500e : Exposure Program Mode0x500f : Exposure Index (film speed ISO)0x5010 : Exposure Bias Compensation0x5011 : Date Time0x5013 : Still Capture Mode0x5015 : Sharpness0x5016 : Digital Zoom0x5017 : Effect Mode0x5018 : Burst Number0x501c : Focus Metering Mode0xd001 : EK Color Temperature0xd002 : EK Date Time Stamp Format0xd003 : EK Beep Mode0xd004 : EK Video Out0xd005 : EK Power Saving0xd006 : EK UI LanguageAll properties of numbers starting with 0x50 are standard PTP properties,although for many of them the type (enumerated or range) and value meaningare NOT specified by the PTP standard and may vary among different cameras!The properties starting with 0xd0 are PTP extension (in this case EK meansEastman Kodak extension) and in most cases are not known to public at all.

⌨️ 快捷键说明

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