Added a separate function to test if a device is active