Finally got a chance to look at this.
First, thanks a lot for working on it. This is all good stuff to have, and you've obviously put a lot of work into it. One way or another, all or most of this should go into the trunk.
In general, I much prefer multiple patches for things that can be separated out. It makes it much easier to understand whats going on, both while I'm trying to review and merge it, and later down the road if something breaks. One giant patch like this is very hard to review, and requires a single, big chunk of time.
Things that are easy to understand and isolated can be added quickly. If there's something that I don't like, that one part can be sent back to you without rejecting everything.
From what I've looked at so far, this could be split into
- unrelated changes like adding ptp to sx20, the filereader conf bug etc.
- refactor console out of script
- rename various things ubasic->camera
- rename/refactor script stack
- non-script badpixel
- ifdefs for ubasic/lua
I know this is somewhat annoying to do with SVN, since dependent patches basically require you to wait for the earlier ones to be committed before you can make the later ones, or to do non-svn diffs between trees. For independent ones, you can just use different working copies, or save the changes off in a patch, revert, and do the next one.
I'm not asking you to split everything up for this one. If you can break out the stuff that's really independent, that would help.
On the script stack, I'd suggest not calling it task_stack because task already means something quite different, and OS tasks also have stacks. action_stack maybe ? automation_stack ?
On PTP:
The "minimal proposal" PTP currently in the trunk basically assumes everything will be done in lua. Without lua, you pretty much only have file copy and reboot. Both are still useful, so that's OK, but it's something to think about. Also, the protocol should probably indicate whether lua is available somehow.