Reorganized code relating to hardware detection per platform.