Same problem here. The sx40 won't manually focus at infinity at 35x zoom. To me this is happening independently from CHDK it really seems a limitation of the camera manual focus system, at least of my camera hardware + firmware (1.00i).
I even tried to lock focus at infinity (autofocus on the Moon and halfpress+left to lock focus) and memorize it to a preset (e.g. C1). When recalling the preset the MF indicator shows infinity but the resulting image is blurred, the lens system just won't return at the same exact position.
Physically the lens can reach a position where it can focus infinity (in fact AF works) but something is preventing to reach that position in MF (including setting focus distance via CHDK scripts).
Maybe it's just the section of the system that translates the focus distance into lens position. Would it be possible to use CHDK to control directly the lens system at a lower level (I know this might be risky...)?
Thanks