Some further thoughts:
The defines will have a big effect on the results, and are almost certainly wrong for many cameras.
We need to clarify which defines need to be set for cameras with particular characteristics. The reason elph130 crashed is that I assumed CAM_CAN_SD_OVER_NOT_IN_MF applied, since the camera does not have MF at all but it ends up making the camera try to sd override when not in AF_LOCK.
Once we get this somewhat sorted out, the script should be added to http://chdk.wikia.com/wiki/Testing
with information about which combinations of defines should be tested for a new port.
shooting_can_focus desperately needs to be cleaned up.
set_focus could return whether or not it is able to set focus in the current settings. For cameras that require af_lock, it might also be possible to set it when needed.
Setting the AF_LOCK propcase for when using set_aflock seems like a good idea. There is some risk it could have unexpected side effects, but the whole thing is currently so unreliable I'm not convinced that matters.
Currently, in MF mode overrides are applied with SET_NOW when set_focus is called. This would also probably work when AF_LOCK is engaged. This might be useful because you can see the effect immediately.
There's a bunch of stuff in shooting_can_focus related to movie mode. I have not investigated this, if anyone knows the history please post.