Merge "Clean up USB configuration switching logic and beef up error handling"