Hello all,
I have been wrestling with this problem for three days now before I finally got a solution. Check all of the following as any of these can be culprits:
1. USB cables: Try different cables. I got mine working on both a standard cheap cable off ebay and an official Motorola cable but apparently it can make a difference.
2. USB debug off/on: Try both while your phone is powered up and running. If this doesnt work, try debug off then reboot into download mode and see if odin can detect it. If not, debug on, try again. Try a few times, unplug cable, plug back into phone, unplug from pc, plug back into different usb port.
3. Flash a new rom through rom manager. Try all of the above again.
4. Uninstall kies. Use CCleaner to remove odd bits of reg no longer in use. Go back into Samsung folder (program files x86 or program files) and find the folder for the usb drivers and click uninstall. Kies will not remove these drivers as part of its uninstall. After that go to device manager and uninstall the driver for android device. Reboot pc. reInstall kies. Go into samsung folder and install smartphone usb drivers manually. Check device manager, refresh, and make sure Galaxy S2 driver is not in the list of drivers not found. This may take a while and another reboot.
5. If odin is still not detecting the phone while powered on, reboot and try again in download mode. As before, try with debug on and debug off. Switch cables, etc etc.
Lots of time to be wasted, very frustrating, but if it works then you have your phone back.
From what I could see this was principally a case of corrupt drivers on Windows after I flashed to CM7. Not sure how this happened. If nothing is working then suspect the drivers. Its hard to clean the system of all the drivers and get the correct set of drivers reinstalled. Keep trying.
Best of luck.