Querying for devices