chdkptp - alternative ptp client - General Discussion and Assistance - CHDK Forum  

chdkptp - alternative ptp client

  • 1106 Replies
  • 517346 Views
*

Offline reyalp

  • ******
  • 14082
chdkptp - alternative ptp client
« on: 27 / March / 2011, 20:47:24 »
Advertisements
Edit 2017-03-5:
There's a lot of old discussion in this thread, see https://app.assembla.com/spaces/chdkptp/wiki/Home for chdkptp documentation and builds

---
I've started an assembla space for my alternative PTP client. https://www.assembla.com/code/chdkptp/subversion/nodes

I've put this in it's own space because it's not really part of CHDK. Any chdk or chdkde developers interested in working on this, please add yourself as a watcher and let me know. I'm happy to give anyone who wants to work on it commit access. If you want to do major reorganization/rewriting, either discuss it first here or make a branch.

This is in a very early stage still, so it isn't a replacement for ptpcamgui. It is functional enough replace ptpcam cli (and is much more convenient for a lot of things)
Overview can be found in https://www.assembla.com/code/chdkptp/subversion/nodes/trunk/README
Usage information can be found in https://www.assembla.com/code/chdkptp/subversion/nodes/trunk/USAGE.TXT

Documentation is minimal, I suggest looking at cli.lua and chdkptp.c

The low level USB/PTP part is based on the ptpcam code, but I'm cutting out the stuff that isn't related to CHDK. The entire CLI and GUI are written in lua. A lua API is provided for CHDK PTP functions.  The current GUI is mostly just proof of concept.

Goals
- GUI. Eventually should have camera control, live view like chdkcam, file browsing/transfer etc. GUI is based on IUP http://www.tecgraf.puc-rio.br/iup/
- Cross platform. I haven't built on linux yet, but all the parts are very portable.
- Flexible, extensible. Users can easily interact with the PC side lua, extend the lua code, script interaction between pc lua and camera lua, or replace it with their own custom code.

A windows build of the current version is available from the files section: https://www.assembla.com/spaces/chdkptp/documents
« Last Edit: 05 / March / 2017, 14:35:15 by reyalp »
Don't forget what the H stands for.

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: alternative ptp client
« Reply #1 on: 28 / March / 2011, 06:48:11 »
That's a very nice new project.

I tested all basic functions with the current CHDK-DE version. The connection is very fast. Everything works as expected.

I think for the general users is the GUI the most important part. The interface should include the following functions:

- upload CHDK related files (maybe with download from autobuild servers)
- download all media files
- camera control, remote functions
- some usefull elementary applications (time lapse, bracketing ...)
- a multiline script console (for script testing)
- optional other gui languages (maybe dependent from camera language)
- live view (difficult to realize for all the cameras)

For more feedback should be the ptp interface enabled for all cameras in trunk like in CHDK-DE.

msl
CHDK-DE:  CHDK-DE links

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: alternative ptp client
« Reply #2 on: 28 / March / 2011, 17:28:55 »
Great :)

I gave it a quick try on Ubuntu. Some changes were needed to Makefile and libptp-endian.h for it to build (using libusb-1.0-0-dev libusb-1.0-0 liblua5.1-0-dev liblua5.1-0), diff attached. I couldn't get the gui part to work in a minute, but the interactive cli seems to connect and up/download properly. My Makefile modifications are especially quick and dirty, but here's a diff anyway in case someone finds it useful...

Re: alternative ptp client
« Reply #3 on: 02 / April / 2011, 19:50:14 »
hi fudgey,

unfortunately I'm only an ubuntu user  - no experience with compilation of code.
Could you pls help me with step by step instructions. 

I'd like to capture pics from my A430 on the PC.
The A430 works fine with ptpcam.exe on windows but I would prefer to run a script on linux. gphoto2 was also working fine with my cam, but here is no support for capturing.

thx
Gerhard
A430
chdk-de: a430-100b-1.1.0-full_BETA_rev_911 + Patch
chdk-internat: a430-100b-1.0.0-full rev. 1527-120104


*

Offline reyalp

  • ******
  • 14082
Re: alternative ptp client
« Reply #4 on: 02 / April / 2011, 20:06:59 »
MSL, thanks for the feedback. All good suggestions.

I've started adding the stuff to the planner http://www.assembla.com/spaces/chdkptp/tickets/agile_planner?id=chdkptp

This is just a way to collect/organize all the things that are wanted or needed, don't take the milestones seriously.

I've also added most the developers I recognize from the watcher list as editors. You are welcome to hack the code or add / change stuff in the tickets and planner.  

I realize it's a bit of a mess now, and probably not clear where things are going. Hopefully I'll get it to a state where it's a bit more useful and well organized so others will be motivated to hack on it. :)

Fudgey:
Good to know. I'll try to get basic linux support in the makefile, and see if I can get IUP working.
« Last Edit: 02 / April / 2011, 20:09:40 by reyalp »
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14082
Re: alternative ptp client
« Reply #5 on: 02 / April / 2011, 23:45:14 »
hi fudgey,

unfortunately I'm only an ubuntu user  - no experience with compilation of code.
Could you pls help me with step by step instructions. 
I've updated the Makefiles to work a bit better for cross platform builds, and update the readme to describe how to set it up.  Rough instructions
Install the required packages. At a minimum, you will need
* subversion
* gcc
* libusb-1.0
* libusb-dev (may be called something like libusb-1.0-dev)
* liblua-5.1
* liblua-5.1-dev

check out the source using subversion:
$ svn co http://subversion.assembla.com/svn/chdkptp/trunk chdkptp

copy config-sample-linux.mk to config.mk

build it with
$ make

If it works, you will end up with a file called chdkptp

When you run it, you probably need to adjust LUA_PATH so it will pick up the .lua files.
Assuming you are starting in the source directory,  Something like this should work:
$ LUA_PATH="./lua/?.lua" ./chdkptp -i

If you are using ubuntu 64 bit (or possibly other 64 bit distros), you may also try the binary I built, which can be found in http://www.assembla.com/spaces/chdkptp/documents

You will still need to install the library packages (libusb-1.0, liblua5.1). You shouldn't need the -dev variants.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14082
Re: alternative ptp client
« Reply #6 on: 03 / April / 2011, 00:38:17 »
I've managed to build it with IUP support on linux, instructions added to readme.
Don't forget what the H stands for.

*

Offline zeno

  • *****
  • 891
Re: alternative ptp client
« Reply #7 on: 03 / April / 2011, 07:03:00 »
I'd dearly love to get this working under OSX on a Mac, but I think may not be possible because the OSX version of libusb has problems claiming a usb device (because OSX gets exclusive control as soon as you plug a USB device in). This is certainly true for some devices (e.g. mass storage devices like disks and cards, as well as HID's) does anyone know if it's untrue for cameras?
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit


*

Offline reyalp

  • ******
  • 14082
Re: alternative ptp client
« Reply #8 on: 03 / April / 2011, 12:41:08 »
I'd dearly love to get this working under OSX on a Mac, but I think may not be possible because the OSX version of libusb has problems claiming a usb device (because OSX gets exclusive control as soon as you plug a USB device in). This is certainly true for some devices (e.g. mass storage devices like disks and cards, as well as HID's) does anyone know if it's untrue for cameras?
The libusb page says
Quote
Darwin (Mac OS X) implementation has one limitation. If the OS has an interface driver that matches the characteristics of a device, it will seize the interface and the kernel driver cannot easily be detached. So libusb will not be able to use that interface. This is a particular problem with generic HID devices. For HID device,  HIDAPI is recommended.
No idea if this applies to PTP devices. If so, maybe a higher level API you can use for PTP commands ? In the long term, I hope to make things modular enough that you could change the underlying communication layer to something other than libusb. You'd expect that there should be some mechanism for camera vendors to support their PTP extensions in their own apps. It looks like there are remote capture apps for Mac (e.g. for Canon cameras that can do remote capture using the Canon SDK), so you might look into how those work.

IUP also does not have native support for OSX. I don't know if it runs under X11. Native OSX support is on their TODO list.
Don't forget what the H stands for.

*

Offline zeno

  • *****
  • 891
Re: alternative ptp client
« Reply #9 on: 04 / April / 2011, 07:00:35 »
Thanks for that Reyalp. I've already read that page about Darwin (after I'd spent several hours trying (and failing) to get a simple libusb program to turn off the bright white led on my Seagate FreeAgent external drive!).

I've also used the OSX IOKit framework to write a simple app to transfer photos. That worked, but it requires extensive delving into the Objective-C libraries to do anything like PTP and so far I've resisted making the effort to get to grips with that. I guess I'll either have to bite the bullet or live with Windows.
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

 

Related Topics