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

Using multiple cameras with chdkptp

  • 1 Replies
  • 4351 Views
Using multiple cameras with chdkptp
« on: 16 / September / 2011, 15:57:51 »
Advertisements
I'm currently working on some remote control functionality over USB using chdkptp (http://www.assembla.com/wiki/show/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

  • ******
  • 14117
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
={
 [1]={
  dev="\\\\.\\libusb0-0001--0x04a9-0x311b",
  bus="bus-0",
  vendor_id=1193,
  model="Canon PowerShot A540",
  product_id=12571,
 },
 [2]={
  dev="\\\\.\\libusb0-0002--0x04a9-0x31bc",
  bus="bus-0",
  vendor_id=1193,
  model="Canon PowerShot D10",
  product_id=12732,
 },
}
___> !a540=chdku.connection()
___> !return a540:connect(devs[1])
=true
___> !d10=chdku.connection()
___> !return d10:connect(devs[2])
=true
___> !return a540:execwait('return get_buildinfo()')
=true,{
 platsub="100b",
 platform="a540",
 version="CHDK",
 platformid=12571,
 build_number="0.9.9",
 build_date="Aug 28 2011",
 os="vxworks",
 build_time="22:12:55",
}
___> !return d10:execwait('return get_buildinfo()')
=true,{
 platsub="100a",
 platform="d10",
 version="CHDK",
 platformid=12732,
 build_number="0.9.9",
 build_date="Sep  5 2011",
 os="dryos",
 build_time="16:45:05",
}
___>
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal