A deviceloader can check if there are available some devices.
431822
function DeviceLoader() {
  var self = this;

  // call super class
  EventEmitter2.call(this, {
    wildcard: true,
    delimiter: ':',
    maxListeners: 1000 // default would be 10!
  });

  if (this.log) {
    this.log = _.wrap(this.log, function(func, msg) {
      func(self.constructor.name + ': ' + msg);
    });
  } else if (DeviceLoader.prototype.log) {
    DeviceLoader.prototype.log = _.wrap(DeviceLoader.prototype.log, function(func, msg) {
      func(self.constructor.name + ': ' + msg);
    });
    this.log = DeviceLoader.prototype.log;
  } else {
    var debug = require('debug')(this.constructor.name);
    this.log = function(msg) {
      debug(msg);
    };
  }

  this.lookupIntervalId = null;
  this.oldDevices = [];

  this.isRunning = false;
}
921688
def has_device_info(self, key):
        """"""
        if _debug: DeviceInfoCache._debug("has_device_info %r", key)

        return key in self.cache
1293553
def deployed_devices(self):
        
        if self._deployed_devices is None:
            self._deployed_devices = DeployedDevices(self)
        return self._deployed_devices
188884
def _check_all_devices_in_sync(self):
        '''
        '''

        if len(self._get_devices_by_failover_status('In Sync')) != \
                len(self.devices):
            msg = "Expected all devices in group to have 'In Sync' status."
            raise UnexpectedDeviceGroupState(msg)
296345
def trusted_devices(self):
        
        request = self.session.get(
            '%s/listDevices' % self._setup_endpoint,
            params=self.params
        )
        return request.json().get('devices')
1301899
function (deviceHandle, functionName, errorCallback) {
			var device = winble.deviceManager.deviceList[deviceHandle];
			if (device == null) {
				var msg = "Could not find the requested device handle '" + deviceHandle + "'";
				winble.logger.logError(functionName, msg);
				errorCallback(winble.DEVICE_NOT_FOUND);
			}
			return (device);
		}
419732
function DetectBada()
   {
      if (stripos($this->useragent, $this->deviceBada) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
1258432
def exists(device=''):
    '''
    
    '''
    if os.path.exists(device):
        dev = os.stat(device).st_mode

        if stat.S_ISBLK(dev):
            return True

    return False
473682
function deviceFound(device)
	{
		// Parse advertisement data record.
		// TODO: Move to startScan.
		evothings.ble.parseAdvertisementData(device)

		// For debugging, print advertisement data.
		//console.log(JSON.stringify(device.advertisementData))

		// Alternative way to identify the device by advertised service UUID.
		/*
		if (device.advertisementData.kCBAdvDataServiceUUIDs.indexOf(
			'0000aa10-0000-1000-8000-00805f9b34fb') > -1)
		{
			showMessage('Found the TI SensorTag!')
		}
		*/

		if (device.advertisementData.kCBAdvDataLocalName == 'CC2650 SensorTag')
		{
			showMessage('Found the TI SensorTag!')

			// Stop scanning.
			evothings.ble.stopScan()

			// Connect.
			connectToDevice(device)
		}
	}
67636
function DetectArchos()
   {
      if (stripos($this->useragent, $this->deviceArchos) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
83322
public Configuration useDevices(@NonNull int... devices) {
        List<Integer> usableDevices = new ArrayList<>();
        for (int device : devices) {
            if (!availableDevices.contains(device)) {
                log.warn("Non-existent device [{}] requested, ignoring...", device);
            } else {
                if (!usableDevices.contains(device))
                    usableDevices.add(device);
            }

        }

        if (usableDevices.size() > 0) {
            availableDevices.clear();
            availableDevices.addAll(usableDevices);
        }

        return this;
    }
113995
def _find_devices():
    
    ret = []

    logger.info('Looking for devices....')

    if pyusb1:
        for d in usb.core.find(idVendor=USB_VID, idProduct=USB_PID, find_all=1,
                               backend=pyusb_backend):
            ret.append(d)
    else:
        busses = usb.busses()
        for bus in busses:
            for device in bus.devices:
                if device.idVendor == USB_VID:
                    if device.idProduct == USB_PID:
                        ret += [device, ]

    return ret
236139
def get_device(self, device_id, refresh=False):
        """"""
        if self._devices is None:
            self.get_devices()
            refresh = False

        device = self._devices.get(device_id)

        if device and refresh:
            device.refresh()

        return device
517299
private void pullDeviceFiles(IDevice device) throws Exception {
    for (String dir : DEVICE_DIRS) {
      pullDirectory(device, dir);
    }
  }
1343397
def _treat_devices_removed(self):
        """"""
        for device in self._removed_ports.copy():
            eventlet.spawn_n(self._process_removed_port, device)
1212394
def trigger(self):
        
        ibsta = self._lib.ibtrg(self._device)
        self._check_status(ibsta)
211411
def async_get_device(self, uid, fields='*'):
        """"""
        return (yield from self._get('/pods/{}'.format(uid),
                                     fields=fields))