device detection function added, pi config almost complete