jhfelectric
The chdkptp CLI only supports one active connection at a time, but using the local Lua (! command) you can manipulate the con variable to switch between multiple connections.
How would one do that ? can you help ?
Thanks in advance.
Two cameras
$ chdkptp -i
___> list
-1:Canon PowerShot D10 b=bus-0 d=\\.\libusb0-0001--0x04a9-0x31bc v=0x4a9 p=0x31bc s=...
-2:Canon PowerShot A540 b=bus-0 d=\\.\libusb0-0002--0x04a9-0x311b v=0x4a9 p=0x311b s=nil
Make connections:
___> !con1=chdku.connection{dev='\\\\.\\libusb0-0001--0x04a9-0x31bc',bus='bus-0'} return con1:connect()
=true
___> !con2=chdku.connection{dev='\\\\.\\libusb0-0002--0x04a9-0x311b',bus='bus-0'} return con2:connect()
=true
The 'return' tells you if the connection succeeded. The extra \\ are for windows device names, on linux you won't need them.
___> list
+1:Canon PowerShot D10 b=bus-0 d=\\.\libusb0-0001--0x04a9-0x31bc v=0x4a9 p=0x31bc s=...
+2:Canon PowerShot A540 b=bus-0 d=\\.\libusb0-0002--0x04a9-0x311b v=0x4a9 p=0x311b s=nil
The '+' shows that the connections are connected, but not currently associated with the cli con variable.
Now to switch between them, you just do something like
___> !con=con1
con> list
*1:Canon PowerShot D10 b=bus-0 d=\\.\libusb0-0001--0x04a9-0x31bc v=0x4a9 p=0x31bc s=...
+2:Canon PowerShot A540 b=bus-0 d=\\.\libusb0-0002--0x04a9-0x311b v=0x4a9 p=0x311b s=nil
The * shows that camera 1 is now connected to the cli, so a download command will download from that camera.
You could also write the whole download process in lua, something like
___> !for i,dev in ipairs(chdk.list_usb_devices()) do local lcon=chdku.connection(dev) lcon:connect() lcon:download('A/DISKBOOT.BIN',i..'_DISKBOOT.BIN') lcon:disconnect() end
obviously substitute your own filename for diskboot.bin, and possibly add some error checking.