Default [Q] htc one m7 problem - urgent help

hi i am using a htc one m7 SPRINT version on a custom rom with cwm recovery. i have been using the phone for well over a year but suddenly there are connection problems and i cannot connect the phone to my computer. i tried downloading the htc sync manager but even that is not helping. basically when i connect the charger it says the "usb host cable is plugged in device cannot charge" except when i reboot it with the charger connected and then the device starts charging , but as i remove the charger while the device is ON the problem comes back. i wanted to install a new rom but cannot use it in FASTBOOT USB mode to install twrp. even when i am connected to my pc it will only charge and not be recognized for file transfer.