supplierdeeply

CHDK PTP interface

  • 1136 Replies
  • 151470 Views
*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: CHDK PTP interface
« Reply #280 on: 19 / October / 2010, 17:15:07 »
Advertisements
Hmm I had somehow skipped mweerden's windows version source (had it on hdd but never tried it), it builds fine. But it -- just like my own build and reyalp's -- doesn't find ptp devices.

I guess my driver install was and still is the problem. I previously installed the non-filter one after reading the win32-libusb pages for a while and I suppose that did no good. So I now ran the filter version exe installer instead and let its filter wizard install a filter for my camera. Still no good, the camera has a yellow exlamation mark next to it in device manager, a closer look reveals error 10 (driver tab mentions libusb0.sys 1.2.2.0).

AFAIK, there are no Canon tools to disable on that computer, reboot didn't help.

*

Offline reyalp

  • ******
  • 10069
Re: CHDK PTP interface
« Reply #281 on: 19 / October / 2010, 17:27:58 »
It appears to me that if you plug the camera into different USB ports, you have to set up the filter once for each one.

I also had trouble if I didn't set the action when the camera is connected to "none". This again has to be set for each port.

All of the above is on XP.
Don't forget what the H stands for.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: CHDK PTP interface
« Reply #282 on: 19 / October / 2010, 17:53:19 »
It appears to me that if you plug the camera into different USB ports, you have to set up the filter once for each one.
I also had trouble if I didn't set the action when the camera is connected to "none". This again has to be set for each port.

I used the same exact USB connector each time after installing the filter, and action was none even before installing the filter.

*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: CHDK PTP interface
« Reply #283 on: 20 / October / 2010, 12:44:27 »
A little observation on the function calls over PTP:
   PTP_CHDK_CallFunction in ptp.c just plunges into the foreign code like this:
Code: [Select]
ptp.param1=((int(*)(int,int,int,int,int,int,int,int,int,int))buf[0])(buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7],buf[8],buf[9],buf[10])
This will work with the functions that nicely return with "BX LR" or similar, but will likely crash at the often encountered MOV PC,LR, failing to return to thumb. Also, vararg functions cannot be called this way.

There used to be reyalp's call_vararg_func(), which could be used here like this:
   ptp.param1 = call_vararg_func(buf[0], &buf[1], 4);  // limit to 4 args, to save some hassle,
but I don't find it in the current trunk.

Has it changed, or is there a better way?

Edit 1: damn arm asm...

Edit 2: thanks, reyalp
« Last Edit: 20 / October / 2010, 13:07:11 by whoever »


*

Offline reyalp

  • ******
  • 10069
Re: CHDK PTP interface
« Reply #284 on: 20 / October / 2010, 12:50:09 »
Yeah, this is something was going to change eventually. You can just use regular call_func_ptr

When I first started working on the native call stuff, I was under the mistaken impression that vararg calls used a different calling convention on arm, but on CHDK cameras at least, they do not.

If buff is big enough, you should be able to safely send extra args without any issue, they'll just end up on the stack and be ignored.
Don't forget what the H stands for.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: CHDK PTP interface
« Reply #285 on: 20 / October / 2010, 14:53:54 »
Does PTP really need its own native calls interface separate from Lua?

*

Offline reyalp

  • ******
  • 10069
Re: CHDK PTP interface
« Reply #286 on: 20 / October / 2010, 15:57:07 »
Does PTP really need its own native calls interface separate from Lua?
Good question. There are currently a couple of differences
- PTP direct calls will be executed immediately in the context of the PTP task.
- PTP calls are currently always available whether or not native calls are enabled. I'm not sure if this is desirable.
- for development, it may be desirable to have direct calls, so you can use it before lua is fully functional.
Don't forget what the H stands for.

*

Offline hwntw

  • ***
  • 132
Re: CHDK PTP interface
« Reply #287 on: 20 / October / 2010, 17:03:55 »
Hej,
Well it's great news, except I couldn't make it work on my A540. :/
I compiled it with the option enabled and got the tool from ewrar website, I also needed some libusb but not sure if I got it right, anyway nothing happens when I start CHDKcam. :(
I feel kinda left-handed with all that, please someone could sum up again the steps to make it work, thanks.
Hello,
Install the USB driver (with install-filter.exe or wininstall-filter, whatever) without the cam booted to CHDK. That way, the correct driver (digital still camera) is available for installation.
After I do this, I can run ptpcam on my Ixus 95 CHDK-DE-443 home-brew and do some basic ptp commands:
e.g.
... >ptpcam.exe -i

Camera information
==================
Model: Canon DIGITAL IXUS 95 IS
  manufacturer: Canon Inc.
  serial number: '62DE4C8DB76749DC8CA5AA0CA74A0465'
  device version: 1-6.0.1.0
  extension ID: 0x00000006
  extension description: (null)
  extension version: 0x0064

What does not happen, is any response after I run ptpcam --chdk. The commands execute but no useful result ensues.
CHDKCAM does communicate with my Ixus 95, but only to power it down immediately.
Don't forget, the Ixus 95 is one of the cameras Canon removed remote capabilities from: so all of the preceding is actually great progress (by others- not me)!

Colin
Ixus 300HS S100 G9


Windows XP SP3


*

Offline reyalp

  • ******
  • 10069
Re: CHDK PTP interface
« Reply #288 on: 20 / October / 2010, 22:05:20 »
I'm not sure what's currently in CHDK-DE. In the trunk, PTP is not enabled for this camera, but just defining CAM_CHDK_PTP for it in camera.h should be enough if the functions were detected correctly.

Keep in mind that the version of ptpcam you are using much match the protocol implemented in your version of CHDK. The one I posted works the the code in the trunk (mweerden proposal protocol).
Don't forget what the H stands for.

*

Offline msl

  • *****
  • 1187
  • A720 IS, SX220 HS 1.01a
    • CHDK inside
Re: CHDK PTP interface
« Reply #289 on: 21 / October / 2010, 03:52:01 »
There is no PTP function for ixus95 in CHDK-DE trunk. The included functions are dummy functions (especially reboot_fw_update) for compiling of the autobuild. We are still looking for the right function for this camera (also for the SX120). Also the defining in camera.h in the ixus95 section is missing.

CHDK for the ixus95 in CHDK-DE is only a test version.

The CHDK PTP interface is a difficult topic. I think the mainstream users probably need an easy-to-use (Windows) GUI like ewavr's solution.
German CHDK pages:  CHDK forum | CHDK inside | CHDK Twitter News by msl | Download CHDK-DE (Autobuild)
Note: SDM violates the GPL rules!

 

Related Topics