device: Refactor check for device type