added USB detection and resetting functions