chdkptp - alternative ptp client - page 58 - General Discussion and Assistance - CHDK Forum  

chdkptp - alternative ptp client

  • 1106 Replies
  • 513107 Views
Re: alternative ptp client
« Reply #570 on: 25 / February / 2014, 08:01:46 »
Advertisements
Hi
I just install chdkptp and it work great with a A1400.
Shoot, download jpg and raw, live view ok.

There are some problems left: (build chdkptp-r468-win32.zip )

- The Zoom+ and Zoom- buttons don't work, sometimes they work after Read Mode, but not always and very slowly.

- I plan to use chdkptp gui in live-view while sending commands with a custom application. (win32)
I tried to open another instance in console mode but It deconnect the first instance

Is there a solution to send commands to chdkptp in gui mode ?
For windows it could be a com server or pipe ou messages.
Keystrokes send by another application would do the trick too, as suggested by bigboss97
http://chdk.setepontos.com/index.php?topic=6231.msg108950#msg108950

I have tried to modify gui_user.lua but the shorcuts don't seems to work.
I was thinking of write the command in a file, then send a keystroke to chdkptp gui with additional lua code to read the file and send the cli command.

According to http://www.tecgraf.puc-rio.br/iup/en/elem/iupbutton.html, this is supported by 3.0 and up
(mnemonic support since 3.0)
Do you use a lower version of iup or is it iup related ?

*

Offline reyalp

  • ******
  • 14079
Re: alternative ptp client
« Reply #571 on: 25 / February / 2014, 22:47:06 »
- The Zoom+ and Zoom- buttons don't work, sometimes they work after Read Mode, but not always and very slowly.
The zoom buttons just send click('zoom_in') or click('zoom_out')

Quote
- I plan to use chdkptp gui in live-view while sending commands with a custom application. (win32)
I tried to open another instance in console mode but It deconnect the first instance
The camera can only handle one PTP connection at a time.
Quote
Is there a solution to send commands to chdkptp in gui mode ?
There isn't currently any mechanism designed to do this. Of course, you could add your own code to read from a pipe or something. Both the GUI and the USB communication are single threaded, so you'd want something you could poll from a timer or something.

Quote
I have tried to modify gui_user.lua but the shorcuts don't seems to work.
According to http://www.tecgraf.puc-rio.br/iup/en/elem/iupbutton.html, this is supported by 3.0 and up
(mnemonic support since 3.0)
Do you use a lower version of iup or is it iup related ?
The windows build I post are currently built with IUP 3.5
Your issue might have to do with what has focus.
Don't forget what the H stands for.

Re: alternative ptp client
« Reply #572 on: 04 / March / 2014, 09:32:28 »
Thanks for quick response.

I can not make shortcuts buttons function.
I don't think it is focus related.

They don't work (Win32), even in the main ui (Try to change the button text 'Execute' by 'E&xecute')
I don't know why (Iup or the way it is integrated ?)

----

However I discovered that the menus shorcuts works.
So I make a single top level menu with name '&Command'
and add code to execute a command in the clipboard

This is the code modifications in gui.lua for those interested.

Code: [Select]
-- file gui.lua

-- Main Menu Definition.
menu = {}
menu.mnuMain = iup.menu
{
    iup.item{title="&Command", action="execute_clipboard()"}
}

-- Additionnal function to call cli
function execute_clipboard()
    local clipboard = iup:clipboard()
    local cmd = ''
    if clipboard.textavailable then
        cmd = clipboard.text
    else
        iup.Message ("Warning", "Command not found in Clipboard")
        return
    end
   add_status(cli:execute(cmd))
end

-- Modify line 504 in original gui.lua to show menu
-- menu = menu,
  menu = menu.mnuMain,

I call this from my application by filling the clipboard with a command, activating chdkptp windows with AppActivate and sending Alt-C keystroke.

This code work but may be enhanced because that I have no skill in lua nor in iup :)
(Perhaps it's better to use a global variable for clipboard ?, clipboard must be distroyed ? )

I must admit that modfying the ui in lua is awesome !

Re: alternative ptp client
« Reply #573 on: 04 / March / 2014, 09:34:28 »
I would like to rotate the live view (+/- 90°).
Can you tell me if it's possible to do that in gui_live.lua (probably slow) or may I have to modify liveimg.c and use CD functions  (and recompile application ?)



*

Offline reyalp

  • ******
  • 14079
Re: alternative ptp client
« Reply #574 on: 05 / March / 2014, 00:01:06 »
I would like to rotate the live view (+/- 90°).
Can you tell me if it's possible to do that in gui_live.lua (probably slow) or may I have to modify liveimg.c and use CD functions  (and recompile application ?)
See Coordinate System->Transform under http://www.tecgraf.puc-rio.br/cd/

!gui.live.icnv.dccnv:TransformRotate(10)

seems to work for me, but the origin isn't in the middle of the screen, so 90 rotates it off the screen.

Transform can likely also be used to mirror to as bigboss97 requested earlier..

edit:
Regarding key shortcuts / accelerators, you can also add your own key handlers to controls or the main dialog. See gui.lua inputtext:k_any() for an example.

edit:
If you are mucking with transforms and want to reset, use !gui.live.icnv.dccnv:Transform(nil)
To mirror, you can use
Code: [Select]
!width=gui.live.icnv.dccnv:GetSize();gui.live.icnv.dccnv:TransformScale(-1,1);gui.live.icnv.dccnv:TransformTranslate(-width,0)
« Last Edit: 05 / March / 2014, 00:18:31 by reyalp »
Don't forget what the H stands for.

*

Offline lyzby

  • **
  • 52
Re: alternative ptp client
« Reply #575 on: 08 / March / 2014, 20:54:35 »
Any hope for being able to download the LCD image as a jpg?

*

Offline reyalp

  • ******
  • 14079
Re: alternative ptp client
« Reply #576 on: 08 / March / 2014, 21:30:17 »
Any hope for being able to download the LCD image as a jpg?
Maybe eventually, but it's easy enough to convert netbpm netpbm formats if you want.
« Last Edit: 09 / March / 2014, 16:56:45 by reyalp »
Don't forget what the H stands for.

Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline lyzby

  • **
  • 52
Re: alternative ptp client
« Reply #578 on: 09 / March / 2014, 14:03:13 »
Ok, so it's netpbm not netbmp?

What would the process be:  chdkptp -c -e" ? ? ?"

What format? dng?

And then postprocess with netpbm or perhaps imagemagick?

*

Offline reyalp

  • ******
  • 14079
Re: alternative ptp client
« Reply #579 on: 09 / March / 2014, 16:59:10 »
Ok, so it's netpbm not netbmp?

What would the process be:  chdkptp -c -e" ? ? ?"

What format? dng?

And then postprocess with netpbm or perhaps imagemagick?
See this post: http://chdk.setepontos.com/index.php?topic=6231.msg110306#msg110306

I hope to clean this up a bit and put out a new build today. We'll see how far I get. the netpbm dump will probably go into a separate command from dumpframes.
Don't forget what the H stands for.

 

Related Topics