Device query function.