I've seen many people who had similar issues with HTC Desire S. Battery charging works when the USB cable is connected, but the device (or the computer) does not see the USB cable as being connected. The solution is simple, disassemble the phone and pull the USB ribbon cable, and attach it again. Apparently the ribbon cable gets loose easily.
You do not have to disassemble the phone completely, it's actually quite easy. You only need to remove the battery, then remove 5 screws from the lower plastic 'cradle' where the battery lock is located. 4 torx head screws as well as one philips head screw. Then remove the plastic and it will reveal an almost square USB ribbon connector (near the USB connector).
See http://www.formymobile.co.uk/htcdesiresdisassembly.php#.VHHYN3Wc3NM for details, but don't follow all the instructions, you don't need to remove the upper body, or the complete frame to fix your USB connector.
Once the ribbon is put back into place, insert the plastic 'cradle' and simply put the 5 screws back into their original position (be careful to use the exact screws, as the 4 torx head screws consist of 2 different types). Put the battery back in and boot the device. You'll see that the USB connection now works as before. Hope this helps !