CHDK PTP multiple instances - page 9 - General Discussion and Assistance - CHDK Forum supplierdeeply

CHDK PTP multiple instances

  • 180 Replies
  • 35479 Views
Re: CHDK PTP multiple instances
« Reply #80 on: 10 / October / 2013, 16:44:28 »
Advertisements
Does this infer that chdk usbremote and chdkptp were already in co-existence ?
The are both available in CHDK,  but they do not really co-exist peacefully.  If USB remote is enabled then chdkptp will not work.  If USB remote is not enable,  chdkptp works properly.

Quote
If so, what does kbd.c change in this thread:
physw_status[USB_IDX] = physw_status[USB_IDX] | USB_MASK ;  // NEW : make it look like 5V is there no matter what
at http://chdk.setepontos.com/index.php?topic=8769.msg105488#msg105488 achieve in addition ?
If you add this to a CHDK build,  then the camera and chdkptp will think there is a USB cable connected whether there really is or not.   This lets you turn off the 5V signal by opening the red wire in the USB cable so that the USB remote thinks the shooting switch is inactive yet the PTP code thinks the comm port is active.


Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDK PTP multiple instances
« Reply #81 on: 10 / October / 2013, 17:02:07 »
Ah ! thanks waterwingz.

Must have been the fact the prior description [Feb 08 13] did not state that 'remote' must be switched out of manually on the camera before chdkptp would work [only with 5V connected] that I hadn't understood... 
« Last Edit: 10 / October / 2013, 17:06:52 by andrew.stephens.754365 »

Re: CHDK PTP multiple instances
« Reply #82 on: 10 / October / 2013, 17:49:52 »
If you add this to a CHDK build,  then the camera and chdkptp will think there is a USB cable connected whether there really is or not.

does that mean 'get_usb_power()' is no longer useful from a scripting perspective i.e constant hi level always assumed ?

Re: CHDK PTP multiple instances
« Reply #83 on: 10 / October / 2013, 17:57:55 »
If you add this to a CHDK build,  then the camera and chdkptp will think there is a USB cable connected whether there really is or not.

does that mean 'get_usb_power()' is no longer useful from a scripting perspective i.e constant hi level always assumed ?
Not at all.   What the patch does is trick the Canon firmware into thinking there is an active USB cable attached.  The CHDK USB remote code gets the real status of the 5V power pin from the USB connector.

Its not a perfect hack because telling the Canon firmware there is a USB cable plugged in will cause it to go into a "data transfer" mode - makes it useless for normal shooting but perfect for accessing and operating via chdkptp.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: CHDK PTP multiple instances
« Reply #84 on: 11 / October / 2013, 06:39:43 »
Its not a perfect hack because telling the Canon firmware there is a USB cable plugged in will cause it to go into a "data transfer" mode - makes it useless for normal shooting but perfect for accessing and operating via chdkptp.

Perfect, until the bit not struckout. I don't think  I understand/realise the significance of that.

[So, while I don't think there are...] I'm a little concerned about potential negative impact on my use case [described broadly at http://chdk.setepontos.com/index.php?topic=8769.msg106093#msg106093].

Perhaps the following is an unduly broad query ? [and seems strange to you]:

Could you 'shine a light' on where this might negatively impact my use case ? if not, can you give me a general example of where this could / would cause a problem in general use ?

I hope the 'penny drops', this side, soon...
« Last Edit: 11 / October / 2013, 06:53:23 by andrew.stephens.754365 »

Re: CHDK PTP multiple instances
« Reply #85 on: 11 / October / 2013, 08:44:46 »
Could you 'shine a light' on where this might negatively impact my use case ? if not, can you give me a general example of where this could / would cause a problem in general use ?
If you simply implement the hack I posted,  then the camera will permanently thinks it's stuck in PTP mode (at least while CHDK is loaded).   This is fine for the use case posted - ptp plus precision sync.  But it means that if you unplug the USB cable and try to use the camera normally with CHDK, you can't until you either remove CHDK or load a normal version of CHDK.

Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDK PTP multiple instances
« Reply #86 on: 11 / October / 2013, 10:16:37 »
But it means that if you unplug the USB cable and try to use the camera normally with CHDK, you can't until you either remove CHDK or load a normal version of CHDK.

For my use I don't foresee the need to ever remove the USB [between the end of the hub network and camera - i'll just switch the final connection with arduino/optoisolator/FET combi] - but i'm not yet sure if I may (for example) also need to use the 5V line for pulse signalling [along with camera side script that uses get_usb_power()] or perhaps some other camera side script(s) that are initiated by chdkptp OR yet some other 'normal' CHDK operation - and what (if any) restrictions the hack imposes on any of this [although your prior comment re: 'no impact on get_usb_power()' is 'heartening'].

I'm probably too confused [e.g what is 'normal' CHDK operation, in context of this discussion] for comment to help at the moment [although i'll not object  :)].

You've provided a lot of gems to start working on - i'll try and decide on a camera [2 of] and get a 'real case' going. Theory and practice are alternative sides of the aforementioned penny !



Edit: Temp Info Store

Inspect notes for suitable candidates @ http://subversion.assembla.com/svn/chdk/trunk/platform/

http://chdk.setepontos.com/index.php?topic=6972.msg74849#msg74849 
philmoz 23/oct/2011: "Just to clarify I have done the G12, SX30, IXUS310 and helped on the SX130."

http://chdk.setepontos.com/index.php?topic=6972.msg90562#msg90562
waterwingz 10/sep/2012: "The A3300 was ported by somebody with no programming background.  The current notes.txt file says that the USB functions have not been tested.   It seems to be fine but it is probably not the most complete CHDK port."
« Last Edit: 16 / October / 2013, 11:52:28 by andrew.stephens.754365 »

Re: CHDK PTP multiple instances
« Reply #87 on: 09 / November / 2013, 08:35:19 »
Just trying to understand how Multicam.lua works  .. which is difficult if you do not know Lua.

Anyway, you get a pointer to a linked-list of bus structures.
Each of them contain a pointer to a linked-list of devices.

To open a connection to a device we need a bus number and device number.
When opening multiple connections do we need pointers to multiple PTP_USB,PTPParams and usb_device structures ?

« Last Edit: 09 / November / 2013, 10:09:40 by Microfunguy »


*

Offline reyalp

  • ******
  • 12537
Re: CHDK PTP multiple instances
« Reply #88 on: 09 / November / 2013, 16:09:09 »
Just trying to understand how Multicam.lua works  .. which is difficult if you do not know Lua.
The ability to connect to multiple cameras is in the C code, not multcam.lua. multicam.lua is just a framework for performing the same actions across multiple connections.
Quote
To open a connection to a device we need a bus number and device number.
When opening multiple connections do we need pointers to multiple PTP_USB,PTPParams and usb_device structures ?
The chdkptp code packages all these into a "connection" object.  This isn't the only possible way to implement multiple USB connections, it just seemed like the most straightforward way to do it with the existing ptpcam code, since all the functions operate on those structures.

In chdkptp, the connection objects are stored in a table in the lua "registry" (unrelated to the windows registry) indexed by bus and device, so there is one connection for each bus/dev pair. chdk.connection() gets or creates a connection object.
« Last Edit: 09 / November / 2013, 18:02:12 by reyalp »
Don't forget what the H stands for.

Re: CHDK PTP multiple instances
« Reply #89 on: 09 / November / 2013, 17:56:52 »
Thanks, I will continue to play with that.


 

Related Topics