It seems to me that i've found a "magic" number for the set_focus() command: 5836.
Still not sure if it sets focus to infinite on ixus 125 because now i can test only indoor (nighttime here).
At least focus seems to be forward than previous tests.
EDIT ...
sadly
A bit more testing with all room lights on and i can report that 5836 is not the real infinity value.
There is not any percepible difference in focus among the series. Focus stays locked at a short distance in all shots.
Working with a member of the KAP forum (link posted above), I've confirmed that the S100 has the same issue with set_focus() as the ixus125.
Update : I am no longer convinced this is a CHDK problem.
I was able to get access to an S100 and run the focus.lua script from this thread. It dutifully walked the focus out from about 1' to infinity over a sequence of 20 shots. Everything I tried worked, even with different AF and IS settings.
So I contacted Dave Mitchell (zeno) who has both an S100 and an ixus127 (same camera as the ixus125). He ran the focus script today on both cameras and discovered the same thing. Everything works exactly as expected.
Which leaves us with a mystery about the focus failure reports for the S100 and ixus125 ( two cameras only). It seems like there is maybe something wrong mechanically with both? Or some Canon settings is somehow causing problems? I've asked the S100 owners to use the Canon menu factory reset option and then rerun the script. I did the same with the S100 I was using and it focussed exactly as requested. I should hear back from him this weekend.
@fabri22 : meanwhile the script attached here will take a picture in Autofocus mode, read back the subject distance, switch to MF, set the focus to the subject distance from the previous shot, and shoot again. It then releases the MF and takes a third shot in AF mode. Try running that with different subject distances (near, mid, far) and see if all three pictures match each time ?