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

CHDK PTP interface

  • 1227 Replies
  • 266867 Views
*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: CHDK PTP interface
« Reply #60 on: 29 / October / 2009, 05:57:00 »
Advertisements
Started with testing, playback connection is ok, ~ 4 to 5 fps.
This depends on computer speed and camera model (I have 12 fps for SX10 and 7 fps for A710 with overlays) - GDI drawing is not too fast.

Quote
BTW: atm i use an unmodified libusb-win32-filter-bin-0.1.12.2 package; are the patches from mweerden still needed ?
No, libusb and ptpcam are different things. To recompile libusb-win32, DDK is required.

And hint: use numeric keypad (with numlock=on) to walk camera menus (when camera in record mode).

*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: CHDK PTP interface
« Reply #61 on: 29 / October / 2009, 15:23:39 »
Thrilling! Don't quite get though how the numeric keypad is supposed to work, but maybe I just patched wrong. Then again, I don't have any numeric keypad on the laptop.
   And how nice! With ReyalP's levents I can even run
Code: [Select]
set_levent_script_mode(1)
post_levent_to_ui("PressRecButton")
post_levent_to_ui("UnpressRecButton")
sleep(2000)
post_levent_to_ui("ModeDialToP")
set_levent_script_mode(0)
in the script box, which switches to "manual" mode, and then take a shot with the "Shoot" button!
   It feels like the ultimate unlimited power, MU-HA-HA!
Well, almost... Has anyone succeeded in switching to movie without disconnecting PTP?

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: CHDK PTP interface
« Reply #62 on: 29 / October / 2009, 15:26:43 »
On a570 play->rec->play switching works from mweerden's PTP interface if I do this:

1) boot up cam to play mode without USB cable
2) call DisableNotificationPTP() from a script (I set it to autostart). Without this call the camera would on USB cable attach go to a mode where it powers off the LCD, retracts the lens if it's open and prevent switching to REC mode until powered off.
3) attach USB cable
4) <conn> lua PB2Rec()

and we're in REC mode.

'lua Rec2PB()' then works too for REC->PLAY switching, and 'lua shoot()' works as well.

It's not a good idea to call PB2Rec() while in REC mode (cam crashes, need to wait for watchdog or remove batteries). Calling Rec2PB in PLAY mode does not seem to be that bad, but should be prevented as well of course -- doing that from an autorun script in PLAY mode I did manage to get the cam to a mode where it and CHDK seem to work, but power button and rec switch have no effect.

The a570 100e stubs I used:
NHSTUB(DisableNotificationPTP, 0xffd8df04)
NHSTUB(PB2Rec, 0xffc119b8)
NHSTUB(Rec2PB, 0xffc119f8)


Further, looks like it's also possible to do this stuff without having to touch the USB cable:

1) boot up cam to REC mode with USB cable already attached.
2) run script that calls DisableNotificationPTP() and Rec2PB() -- maybe for this one the event stuff would work in place of Rec2PB since PTP isn't active until we're in PLAY mode...but I didn't try it.
3) from PTP interface, we can now call stuff like 'lua PB2Rec(); sleep(1000); shoot()'

This way the PLAY/REC switch is physically in correct position for REC mode and probably shouldn't confuse CHDK quite as much for shooting related stuff as when booting to PLAY mode (basically we need to go to PLAY mode once while the USB cable is plugged in to get Canon FW to fire up all its PTP stuff...maybe it's would be possible to make that happen without PLAY mode too, but I suppose that's not necessary).

If that little script is set autostart, things work pretty smoothly (as long as you never want to boot to PLAY mode). It may even be possible to fully remote control the cam with the mechanically-prevent-power-button-from-getting-unpressed-and-then-switch-power-with-external-PSU hack (the controlling PC will of course need some simple custom electronics to switch the external PSU at will).

I gave this a quick try and I think it works as long as the camera is shut down cleanly with lua post_levent_to_ui("PressPowerButton")... I first tried just switching to play mode and then disconnecting the PSU, but after that the autostart script failed to switch to PLAY mode and thus PTP stuff never started. My finger got tired pressing the power button before I could test it ehough :haha.


*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: CHDK PTP interface
« Reply #63 on: 29 / October / 2009, 16:54:09 »
Has anyone succeeded in switching to movie without disconnecting PTP?

May be post_levent_to_ui("ModeLeverMovieRec") ?


*

Offline reyalp

  • ******
  • 12148
Re: CHDK PTP interface
« Reply #64 on: 29 / October / 2009, 17:19:55 »
Has anyone succeeded in switching to movie without disconnecting PTP?

May be post_levent_to_ui("ModeLeverMovieRec") ?
Or maybe exec_event_proc("UIFS_SetDialMovieRec")

(you probably have to exec_event_proc("UI_RegistDebugEventProc") first)
Don't forget what the H stands for.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: CHDK PTP interface
« Reply #65 on: 29 / October / 2009, 17:32:04 »
May be post_levent_to_ui("ModeLeverMovieRec") ?

edit: oops, misread that one...ModeLeverMovieRec has no effect. post_levent_to_ui("ModeDialToMovie") is what works for me (but only if...)

That works for me, but only if the camera was booted to PLAY mode. When camera was booted to REC mode, I can't get any mode change (including movie) to stick (camera announces the change on LCD, but then it changes back to whatever it was). In the mode dial thread http://chdk.setepontos.com/index.php/topic,3228.45.html reyalp's solution for this particular problem is to set set_levent_script_mode(1) first but it doesn't seem to help when PTP is active.

(in both cases DisableNotificationPTP() and and PB2Rec() were called, in REC mode boot also Rec2PB() as described in my previous post).
« Last Edit: 29 / October / 2009, 17:36:34 by fudgey »

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: CHDK PTP interface
« Reply #66 on: 29 / October / 2009, 21:09:43 »
Program for PC is updated: added focus slider and 9 buttons for your favorite scripts.

*

Offline reyalp

  • ******
  • 12148
Re: CHDK PTP interface
« Reply #67 on: 29 / October / 2009, 22:54:27 »
When camera was booted to REC mode, I can't get any mode change (including movie) to stick (camera announces the change on LCD, but then it changes back to whatever it was). In the mode dial thread http://chdk.setepontos.com/index.php/topic,3228.45.html reyalp's solution for this particular problem is to set set_levent_script_mode(1) first but it doesn't seem to help when PTP is active.
set_levent_script_mode() is only half the solution. The other half is set_levent_active("ModeDailTo...",false) on all the mode dial position events *except* the one you want to use, and  set_levent_active("ModeDailToMovie",true)
Don't forget what the H stands for.


*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: CHDK PTP interface
« Reply #68 on: 30 / October / 2009, 03:45:48 »
Has anyone succeeded in switching to movie without disconnecting PTP?
May be post_levent_to_ui("ModeLeverMovieRec") ?
Or maybe exec_event_proc("UIFS_SetDialMovieRec")
(you probably have to exec_event_proc("UI_RegistDebugEventProc") first)
post_levent_to_ui("ModeLeverMovieRec") is ignored.

UIFS_SetDialMovieRec in the sequence exec_event_proc("UI_RegistDebugEventProc"); exec_event_proc("UIFS_SetDialMovieRec") half-crashes (turns off) the cam.

ModeDialToMovie in the sequence such as set_levent_script_mode(1); post_levent_to_ui("PressRecButton"); post_levent_to_ui("UnpressRecButton"); sleep(2000); post_levent_to_ui("ModeDialToMovie"); set_levent_script_mode(0) changes the mode and disconnects. While fudgey's stays connected in this circumstance, as far as I understand. Also, the Ixus950 connects at all only if started in play mode.

Almost every camera is somehow different in this respect, it seems. Funny. Why would they bother to change the logic every time?

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: CHDK PTP interface
« Reply #69 on: 30 / October / 2009, 05:21:41 »
Almost every camera is somehow different in this respect, it seems. Funny. Why would they bother to change the logic every time?

A large part of this comes from actual differences in the camera UI... e.g. some cameras have a separate rec/play switch, most use buttons.. some cameras have a video button, while most have video on the mode dial.

 

Related Topics