CHDK PTP interface - page 44 - General Discussion and Assistance - CHDK Forum supplierdeeply

CHDK PTP interface

  • 1241 Replies
  • 499882 Views
*

Offline reyalp

  • ******
  • 14087
Re: CHDK PTP interface
« Reply #430 on: 09 / March / 2011, 22:47:20 »
Advertisements
some comments:
TEST 'function usb_msg_table_to_string(arg)':
The function fails is arg not a table.
In my code, this function is called automatically, and only if the argument is a table. See luascript.c lua_create_usb_msg

Users shouldn't need to call it.

Quote
TEST script id and results:
Very good idea, but how much results are from current id and how much from script-id 24?
For example we can use a text 'message' to separate old id from current id?
Code: [Select]
<conn> lua return '1'
<conn> lua return '1\n2'
<conn> lua return '1\n2\n3'
<conn> lua return '1\n2\n3\n4'
<conn> getm
message from unexpected script id 22
1
...
This is one of the features that's mostly intended for the new client, I only put enough in ptpcam to test.

I tried to not change the output to much so I wouldn't break ptpcamgui. If you want to change the output, that's fine with me.

It would be easy to make this more friendly to parse, I suggest:
- output script id when script starts
- output script id and and message type for each message
example (fake ;))
Code: [Select]
<conn> lua return '1'
script:22
<conn> lua return '1\n2'
script:23
<conn> lua write_usb_msg('hi')
script:24
<conn> lua return 2
script:25
<conn> getm

22 return string:"1"
23 return string:"1
2"
24 message string:"hi"
25 return number:1
Of course you should format it whatever way is easiest for you.
Quote
TEST 'lua return'-commands after CHDK-start/reboot
It looks like the luar-problem from CHDK-rev.1032 to 1033. My fast solution at that time 'return(...)' in ptpcam.exe. But I know that is not the real cause. Is it back again? Lua initialisation fails?
Code: [Select]
<conn> reboot
Could not find any device matching given bus/dev numbers, retrying in 1 s...
<conn> lua return usb_msg_table_to_string(get_buildinfo())
<conn> getm
runtime error: :1: attempt to call global 'usb_msg_table_to_string' (a nil value)
Strange, I don't see this on d10 in my build.
Quote
To witch time is ptp-handler destroyed. I'm looking for a solution to switch the powersavemode for ptp-duration to 'always'.
If you mean stop the camera from going to sleep when PTP is connected, I want this too :)
Don't forget what the H stands for.

*

Offline achillies

  • ***
  • 227
  • SX130IS
Re: CHDK PTP interface
« Reply #431 on: 10 / March / 2011, 02:34:26 »
I know you guys are working on MUCH larger things, so I will try to keep this short.

I don't know how other cameras function, but on the SX130is, if I use os.remove to delete the picture/file that is displayed on the Camera LCD screen, the display does not change even though the file was deleted.

How can I refresh the LCD so that it doesn't still show the deleted picture (which no longer exists)?  Rebooting works, but it seems like there is a better way.
Don't let the sands of time get in your lunch.

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: CHDK PTP interface
« Reply #432 on: 10 / March / 2011, 05:54:26 »
@achillies

Reboot is the only way to refresh the display. The Canon OS does not notice, if you have deleted a picture file with CHDK. But you can program a keyboard sequence to delete a picture.

msl
CHDK-DE:  CHDK-DE links

*

Offline rudi

  • ***
  • 129
  • A590IS_101B, SX260HS_100B
Re: CHDK PTP interface
« Reply #433 on: 10 / March / 2011, 07:04:30 »
In my code, this function is called automatically, and only if the argument is a table. See luascript.c lua_create_usb_msg

Users shouldn't need to call it.
Yes, I see. That's my fault. On first time use I get this error message. On this time I don't know, that the reason is on a other part and not the table.
Code: [Select]
<conn> reboot
Could not find any device matching given bus/dev numbers, retrying in 1 s...
<conn> lua return get_buildinfo()
<conn> getm
attempt to call a nil value
<conn> lua return get_buildinfo()
<conn> getm
platformid      12662
platform        a590
version CHDK
platsub 101b
build_number    0.9.9-1083
os      dryos
build_date      Mar  9 2011
build_time      12:56:47

I tried to not change the output to much so I wouldn't break ptpcamgui. If you want to change the output, that's fine with me.
The ptpcamGUI command routines need to rewrite for version 1.0 in any cases. It would be better to make all necessary changes for simply parse the messages.

Quote
TEST 'lua return'-commands after CHDK-start/reboot
Strange, I don't see this on d10 in my build.
We had here a test for this problem, but not a final solution. I know, you written "an older gcc3 is a way", but all build-server use gcc4.

rudi


*

Offline achillies

  • ***
  • 227
  • SX130IS
Re: CHDK PTP interface
« Reply #434 on: 10 / March / 2011, 09:31:29 »
@msl - Once again, Thank you.  It saves alot of time not trying to do things I can't do!

deleted.
« Last Edit: 12 / March / 2011, 19:47:54 by achillies »
Don't let the sands of time get in your lunch.

*

Offline reyalp

  • ******
  • 14087
Re: CHDK PTP interface
« Reply #435 on: 12 / March / 2011, 22:24:52 »
We had here a test for this problem, but not a final solution. I know, you written "an older gcc3 is a way", but all build-server use gcc4.
Oh, I thought the cause of this problem was found and fully fixed. I think I understand a little better now, fix stopped syntax error from crashing, but syntax error happens when it shouldn't.

Older gcc is not a real solution either :(
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14087
Re: CHDK PTP interface
« Reply #436 on: 13 / March / 2011, 01:48:11 »
I added modified ptpcam in reyalp-ptp branch. Output easier to parse. Running a script prints script id, message/return/error always starts with script id.

String values are quoted with ''

Note that it would be easy to make lua strings that look like other return values.
Code: [Select]
<conn> lua return 1
script:1
<conn> lua return 'hi'
script:2
<conn> lua write_usb_msg('a message');  return true
script:3
<conn> lua return 'one',2,{a='a',b='b'},nil,false
script:4
<conn> getm
1:ret:1 (1)
2:ret:'hi'
3:msg:'a message'
3:ret:true
4:ret:'one'
4:ret:2 (2)
4:ret:'a        a
b       b
'
4:ret:nil
4:ret:false
<conn> lua 'a bad script
script:5
5:syntax error: :1: unfinished string near '<eof>'
execution failed!
<conn> lua bad()
script:6
<conn> getm
6:runtime error: :1: attempt to call global 'bad' (a nil value)
<conn>
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14087
Re: CHDK PTP interface
« Reply #437 on: 14 / March / 2011, 00:37:12 »
return strangeness:
gcc3
Code: [Select]
<conn> lua return 1
script:1
<conn> getm
1:ret:1 (1)
gcc4
Code: [Select]
<conn> lua return 1
script:1
1:syntax error: :1: malformed number near '1 '
execution failed!
<conn>
If I put a space after the 1, it works. (note error message above shows space, but there isn't one in my command!)

The malformed number error does come from some code that was hacked up to make lua work in chdk (lib/lua/llex.c trydecpoint)

but
Code: [Select]
<conn> lua n=1; return n
script:2
2:syntax error: :1: '<eof>' expected
execution failed!
<conn> lua n=1; return n
script:3
<conn>
Again, works with space after n, works on gcc3

on gcc 4, usb_msg_table_to_string doesn't seem to get defined.

 :-[

edit:
usb_msg_table_to_string problem is related, adding a \n at the end fixes. This is not needed in gcc3 build....
« Last Edit: 14 / March / 2011, 01:44:28 by reyalp »
Don't forget what the H stands for.


*

Offline achillies

  • ***
  • 227
  • SX130IS
Re: CHDK PTP interface
« Reply #438 on: 14 / March / 2011, 01:28:28 »
Was anyone else having a problem with stopping the timelapse in ptpcamgui?  If I clicked on the stop button whle using ptpcamgui's timelapse, it caused the ptpcamgui interface to stop responding, and then I couldn't exit without killing it.

I changed some lines and now that doesn't happen.  And Again.. the stuff for deleting after download is in here too (because I use it all the time).  Based on build 82.  (obfuscated?  I dunno, but here they are *NEW CHANGES IN FOLLOWING POST*).  Two weeks ago I had never heard of AutoIt.. and you all probably wish I still hadn't!   ;)

Attachments removed to avoid confusion.
« Last Edit: 19 / March / 2011, 16:27:50 by achillies »
Don't let the sands of time get in your lunch.

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: CHDK PTP interface
« Reply #439 on: 14 / March / 2011, 06:19:42 »
@achillies

Timelapse was fix in rev. 83, thank you for correction.

The delete function is a other thing. We have currently enough other options to delete files with CHDK. Later with an improved ptp interface it may be safe enough to delete image files.

msl
CHDK-DE:  CHDK-DE links

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal