CHDK PTP interface - page 30 - General Discussion and Assistance - CHDK Forum  

CHDK PTP interface

  • 1244 Replies
  • 529503 Views
*

Offline pixeldoc2000

  • ****
  • 356
  • IXUS900Ti 1.00C, IXUS300HS 1.00D
    • pixel::doc homebase
Re: CHDK PTP interface
« Reply #290 on: 22 / October / 2010, 23:16:22 »
Advertisements
I've added PTP stuff to my sd4000 port based on current trunk.
add_ptp_handler and reboot_fw_update sigfinder addresses are correct.

Installed libusb-win32 v1.2.2.0 driver for the camera on Windows 7 with inf-wizard.exe and used reyalp compiled ptpcam version.

Connection is fine. Most commands work (like memory, reboot)
looks like shutdown-hard does crash camera.
shutdown-soft does not work.
mode 1 does not work.

Is the patched ptpcam source available somewhere (didn't find anything besides original ptpcam source) ?
ptpcam execute some commands (like mode) as lua script. I want to look whats ptpcam actually does (or should do) to debug whats wrong (setrec and setmode scripts do work).

SD4000
Code: (c) [Select]
NHSTUB(get_ptp_handler, 0xFFA4EC7C)
//NHSTUB(add_ptp_handler, 0xFFA4EABC)                // sigfinder address ok
NHSTUB(remove_ptp_handler, 0xFFA4EBB0)
NHSTUB(PB2Rec, 0xFF898B40)                           // search String "AC:PB2Rec"
NHSTUB(Rec2PB, 0xFF897590)                           // search String "AC:Rec2PB"
NHSTUB(set_control_event, 0xFF8955C4)                // via eventproc_export_IsControlEventActive (last call), levent_table contains control event id's (Logical Event Table)
//NHSTUB(reboot_fw_update, 0xffa9b228)               // sigfinder address ok
« Last Edit: 22 / October / 2010, 23:20:29 by pixeldoc2000 »

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: CHDK PTP interface
« Reply #291 on: 23 / October / 2010, 03:38:13 »
Is the patched ptpcam source available somewhere (didn't find anything besides original ptpcam source) ?
You can find chdk-ptpcam source in mweerden's proposal CHDK patch, it goes in trunk/tools/ptpcam:
http://chdk.setepontos.com/index.php/topic,4338.msg52984.html#msg52984

I've done some changes to that (connection retries and a command line interface to the CHDK features), source here:
http://drop.io/a570_chdk_ptp,
in ptpcam-climod-2.zip

For windows, the easiest route is this one (I'm not 100% sure if this matches proposal patch version functionally):
http://www.mweerden.net/download/chdk-ptp/libptp2-chdk-win32.zip


edit: added attachment now that drop.io is dead
« Last Edit: 21 / September / 2011, 14:54:08 by fudgey »

Re: CHDK PTP interface
« Reply #292 on: 01 / November / 2010, 18:25:47 »
Actualy there is no need for additional libraries/drivers to work with PTP on windows, it can be done using IWiaItemExtras::Escape function from Windows Image Acquisition API.

*

Offline rudi

  • ***
  • 129
  • A590IS_101B, SX260HS_100B
Re: CHDK PTP interface
« Reply #293 on: 04 / November / 2010, 14:38:18 »
Hello,

thanks for your good work on  PTP.

I have tested ptpcam with my A590. It works good, but sometimes there are fails on communication, but ptpcam.exe don't crash.

So, here my changes for PTP-comunication:
- disable "shutdown-hard" (I think we don't need it.)
- change helptext from "shutdown-soft" to "shutdown"
- add error handling for "lua(r)" syntax errors and others
- add result methode via a global var named "ptp_result" for "lua" command
- lua command also wait for script end (so you can't try to start a 2nd script)
- a solution for 5s-communications-timeout (try "lua sleep(20000)")

patches based on trunk 964
ptp-patch: for PTP-communication (ptpcam-folder on trunk/tools/ptpcam)
A590-patch: add only A590 PTP-functions (with mode-command)

rudi


*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: CHDK PTP interface
« Reply #294 on: 05 / November / 2010, 14:09:56 »
A590-patch: add only A590 PTP-functions (with mode-command)

Added this one to trunk, rev 965.

*

Offline rudi

  • ***
  • 129
  • A590IS_101B, SX260HS_100B
Re: CHDK PTP interface
« Reply #295 on: 24 / November / 2010, 06:47:04 »
Hi,

I would to rewrite my "ptp_result"-version. I detect a problem on use eg. large for-loops (runtime over 5 sec.) without any sleep-command inside the loop. The timeout error come back. I think that the lua_script_wait()-routine in kbd.c works only on sleep comands and my timeout-code is not working. That's bad.

In current version I don't know is lua-script finished or not and I can't get a result eg. for read dir- or filenames.

Have anyone a solution?

rudi

*

Offline ultimA

  • ***
  • 137
Re: CHDK PTP interface
« Reply #296 on: 24 / November / 2010, 10:56:58 »
In current version I don't know is lua-script finished or not

I have a solution for that. It is part of my next patch in a series to disable scripting in CHDK. Will be posting it soon.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: CHDK PTP interface
« Reply #297 on: 24 / November / 2010, 14:10:26 »
I detect a problem on use eg. large for-loops (runtime over 5 sec.) without any sleep-command inside the loop. The timeout error come back.

On the other hand, isn't writing Lua code that doesn't yield regularly and often strongly discouraged anyway because it could cause odd behavior in the camera (or CHDK) because some other task might expect to get its turn to do something more lengthy or processor intensive regularly but doesn't because Lua hogs the CPU?


*

Offline rudi

  • ***
  • 129
  • A590IS_101B, SX260HS_100B
Re: CHDK PTP interface
« Reply #298 on: 25 / November / 2010, 06:19:28 »
@ fudgey
It is possible that not the script is the cause. Maybe the bus-timeout is only the effect of to many jobs for CPU. A sleep() give other processes more time for execute.

An other concept for ptp-console is "lua" runs without wait und I can get a "is finished" and "get_last_lua_result" (equal to "getLastError" on Windows-systems) for lua-script results or error messages.

I have a solution for that. It is part of my next patch in a series to disable scripting in CHDK. Will be posting it soon.
Thanks, that sounds good. I'm waiting for.

rudi

*

Offline rudi

  • ***
  • 129
  • A590IS_101B, SX260HS_100B
Re: CHDK PTP interface
« Reply #299 on: 29 / November / 2010, 01:42:38 »
Hi,

if we want get success from switch_mode_usb() in luaCB_switch_mode_usb() (core/luascript.c) I think we need this code on line 1193.

Code: [Select]
 lua_pushnumber(L, switch_mode_usb(mode));  //success to stack
  return 1;                                  //count of return value on stack

rudi
« Last Edit: 29 / November / 2010, 01:47:24 by rudi »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal