todo check for different devices
967276
private static boolean isNookDevice() {
        String brand = Build.BRAND;
        String manufacturer = System.getProperty("ro.nook.manufacturer");
        return ((brand != null && brand.equalsIgnoreCase("nook")) ||
                manufacturer != null && manufacturer.equalsIgnoreCase("nook"));
    }
789920
private void checkIfUseDb(final DeviceProxy deviceProxy, final String origin) throws DevFailed {
        if (!deviceProxy.url.use_db) {
            Except.throw_non_db_exception("Api_NonDatabaseDevice", "Device " + name(deviceProxy)
                + " do not use database", "DeviceProxy(" + name(deviceProxy) + ")." + origin);
        }
    }
133392
public static function detectDevice(){
		if($_COOKIE['v']=='m'){
			self::$devicetype=DEVICE_TYPE_MPHONE;
			}
		elseif($_COOKIE['v']=='d'){
			self::$devicetype=DEVICE_TYPE_OTHER;
			}
		if(self::$devicetype==DEVICE_TYPE_UNKNOWN){
			self::$devicetype=self::isMobile()?(self::isTablet()?DEVICE_TYPE_TABLET:DEVICE_TYPE_MPHONE):DEVICE_TYPE_OTHER;
			}
		if(empty($_COOKIE['v'])){
			if(self::$devicetype==DEVICE_TYPE_MPHONE||self::$devicetype==DEVICE_TYPE_TABLET){
				$v='m';
				}
			elseif(self::$devicetype==DEVICE_TYPE_OTHER){
				$v='d';
				}
			$expire=time()+2592000;//30 days
			setcookie('v',$v,$expire,'/',BHOSTNAME);
			}
		return self::$devicetype;
		}
951114
public boolean detectAndroidTablet() {

        //First, let's make sure we're on an Android device.
        if (!detectAndroid()) {
            return false;
        }

        //Special check for Android devices with Opera Mobile/Mini. They should NOT report here.
        if (detectOperaMobile()) {
            return false;
        }

        //Otherwise, if it's Android and does NOT have 'mobile' in it, Google says it's a tablet.
        if ((userAgent.indexOf(mobile) > -1)) {
            return false;
        } else {
            return true;
        }
    }
603437
function DetectNintendo()
   {
      if (stripos($this->useragent, $this->deviceNintendo) > -1 || 
           stripos($this->useragent, $this->deviceWii) > -1 ||
           stripos($this->useragent, $this->deviceNintendoDs) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
27033
def _check_devices(self):
        ""
        for i in range(1, len(self.poses)):
            pose = self.poses[i]
            if not pose.bDeviceIsConnected:
                continue
            if not pose.bPoseIsValid:
                continue
            if self.show_controllers_only:
                device_class = openvr.VRSystem().getTrackedDeviceClass(i)
                if not device_class == openvr.TrackedDeviceClass_Controller:
                    continue
            model_name = openvr.VRSystem().getStringTrackedDeviceProperty(i, openvr.Prop_RenderModelName_String)
            # Create a new mesh object, if necessary
            if model_name not in self.meshes:
                self.meshes[model_name] = TrackedDeviceMesh(model_name)
249487
def devices(self):
        ''''''
        out = self.run_cmd('devices') #subprocess.check_output([self.adb_path(), 'devices']).decode("utf-8")
        if 'adb server is out of date' in out:
            out = self.run_cmd('devices')
        match = "List of devices attached"
        index = out.find(match)
        if index < 0:
            raise EnvironmentError("adb is not working.")
        return dict(re.findall(r'([^\s]+)\t(\w+)', out))
53155
function(callback) {
    sp.list(function(err, ports) {
      if (err && !err.name) {
        err = new Error(err);
      }
      if (err && callback) { return callback(err); }

      async.forEach(subscribers, function(s, callback) {
        if (s) {
          var resPorts = s.filter(ports);

          var devices = _.map(resPorts, function(p) {
            var found = _.find(s.oldDevices, function(dev) {
              return dev.get('portName') && p.comName && dev.get('portName').toLowerCase() === p.comName.toLowerCase();
            });
            if (found) {
              return found;
            } else {
              var newDev = new s.Device(p.comName);
              newDev.set(p);
              return newDev;
            }
          }) || [];

          s.newDevices = devices;
        }

        callback(null);
      }, function(err) {
        if (err && !err.name) {
          err = new Error(err);
        }
        if (callback) { return callback(err); }
      });
    });
  }
1192464
def _request_devices(self, url, _type):
        """"""
        res = self._request(url)
        return res.get(_type) if res else {}
64944
function searchForBondedDevice(params)
{
	console.log('Searching for bonded device')
	evothings.ble.getBondedDevices(
		// Success function.
		function(devices)
		{
			for (var i in devices)
			{
				var device = devices[i]
				if (device.name == params.name)
				{
					console.log('Found bonded device: ' + device.name)
					params.onFound(device)
					return // bonded device found
				}
			}
			params.onNotFound()
		},
		// Error function.
		function(error)
		{
			params.onNotFound()
		},
		{ serviceUUIDs: params.serviceUUIDs })
}
1321370
def compare_config(self):
        """"""
        diff = self.device.cu.diff()

        if diff is None:
            return ''
        else:
            return diff.strip()
419732
function DetectBada()
   {
      if (stripos($this->useragent, $this->deviceBada) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
1129368
def devices(self):
        ''''''
        out = self.raw_cmd("devices").communicate()[0].decode("utf-8")
        match = "List of devices attached"
        index = out.find(match)
        if index < 0:
            raise EnvironmentError("adb is not working.")
        return dict([s.split("\t") for s in out[index + len(match):].strip().splitlines() if s.strip()])
1150131
private static boolean checkPlayServices(OrtcClient ortcClient) {
        int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(ortcClient.appContext);
        if (resultCode != ConnectionResult.SUCCESS) {
        	/*
        	if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
                GooglePlayServicesUtil.getErrorDialog(resultCode, (Activity) ortcClient.appContext, PLAY_SERVICES_RESOLUTION_REQUEST).show();
            } else {
            	ortcClient.raiseOrtcEvent(EventEnum.OnException, ortcClient, new OrtcGcmException("The device is not supported!"));                
            }*/
            return false;
        }
        return true;
    }
215305
function() {
            return fritz.getDevice(thermostat).then(function(device) {
              console.log("[" + thermostat + "] " + device.name);
            });       
          }
272675
def _find_devices_win(self):
        """"""
        self._find_xinput()
        self._detect_gamepads()
        self._count_devices()
        if self._raw_device_counts['keyboards'] > 0:
            self.keyboards.append(Keyboard(
                self,
                "/dev/input/by-id/usb-A_Nice_Keyboard-event-kbd"))

        if self._raw_device_counts['mice'] > 0:
            self.mice.append(Mouse(
                self,
                "/dev/input/by-id/usb-A_Nice_Mouse_called_Arthur-event-mouse"))
233367
def _check_devices_active_licensed(self):
        '''
        '''

        if len(self._get_devices_by_activation_state('active')) != \
                len(self.devices):
            msg = "One or more devices not in 'Active' and licensed state."
            raise UnexpectedDeviceGroupState(msg)