Using multiple cameras with chdkptp - General Help and Assistance on using CHDK stable releases - CHDK Forum

Using multiple cameras with chdkptp

  • 1 Replies
Using multiple cameras with chdkptp
« on: 16 / September / 2011, 15:57:51 »
I'm currently working on some remote control functionality over USB using chdkptp ( Everything with that seems to be working fine enough. However, there's a problem if there are multiple ptp devices connected to your computer. Example:

$ ./chdkptp -i
___> list
1: Canon PowerShot SX100 IS 002/014 vendor:4a9 pid:315e
2: Canon PowerShot S95 002/013 vendor:4a9 pid:3212

There doesn't seem to be a way to specify which camera you want to connect to ... or is there and I'm just missing it? Please let me know if there is some way to specify which camera to connect to via the chdkptp command "connect" or if this has yet to be implemented.


Offline reyalp

  • ******
  • 12944
Re: Using multiple cameras with chdkptp
« Reply #1 on: 16 / September / 2011, 23:09:14 »
This hasn't been implemented in the CLI commands.

Using the latest code (not the binaries in the files section), it is possible to do from lua. The cli stores it connection in a global called 'con'. You are free to create other connections.

See cli.lua and chdku.lua for details. This isn't really finished, both the C API and lua libraries are subject to change.

If you want to connect the cli commands to a particular camera, you can just use con:connect(<camera>) where <camera> is obtained from the camera list as shown in the example below.

Here's an example. Note that the returns in ! commands are just to print out the values.
Code: [Select]
$ ./chdkptp -i
___> !devs=chdk.list_devices();return devs
  model="Canon PowerShot A540",
  model="Canon PowerShot D10",
___> !a540=chdku.connection()
___> !return a540:connect(devs[1])
___> !d10=chdku.connection()
___> !return d10:connect(devs[2])
___> !return a540:execwait('return get_buildinfo()')
 build_date="Aug 28 2011",
___> !return d10:execwait('return get_buildinfo()')
 build_date="Sep  5 2011",
Don't forget what the H stands for.


Related Topics