Check if device can be added with ``auto_add``.
559996
def is_addable(self, device, automount=True):
        """"""
        if not self.is_automount(device, automount):
            return False
        if device.is_filesystem:
            return not device.is_mounted
        if device.is_crypto:
            return self._prompt and not device.is_unlocked
        if device.is_partition_table:
            return any(self.is_addable(dev)
                       for dev in self.get_all_handleable()
                       if dev.partition_slave == device)
        return False
956167
def force_auto(service, _type):
    
    storable = service.byPythonType(_type, istype=True)
    version = max(handler.version[0] for handler in storable.handlers) + 1
    _storable = default_storable(_type, version=(version, ))
    storable.handlers.append(_storable.handlers[0])
240183
def device_changed(self, old_state, new_state):
        """"""
        # udisks2 sometimes adds empty devices and later updates them - which
        # makes is_external become true at a time later than device_added:
        if (self._mounter.is_addable(new_state)
                and not self._mounter.is_addable(old_state)
                and not self._mounter.is_removable(old_state)):
            self.auto_add(new_state)
965868
def add_device():
    
    req = request.get_json()
    success = False
    if 'device_id' in req and 'host' in req:
        success = add(req['device_id'], req['host'], req.get('adbkey', ''), req.get('adb_server_ip', ''), req.get('adb_server_port', 5037))
    return jsonify(success=success)
968055
def get_device_category(self, cat):
        """"""
        if cat in self.device_categories:
            return self.device_categories[cat]
        else:
            return False
1288549
def add_device_callback(self, callback):
        """"""
        _LOGGER.debug('Added new callback %s ', callback)
        self._cb_new_device.append(callback)
1010585
def auto():
	""""""
	try:
		Style.enabled = False
		Style.enabled = sys.stdout.isatty()
	except (AttributeError, TypeError):
		pass
1373815
def has_saved(self, addr):
        """"""
        saved = False
        if self._saved_devices.get(addr, None) is not None:
            saved = True
        return saved
1350630
def add_device(self, path):
        ""
        if self.__get_control_socket():
            self.sock.sendall("+%s\r\n\x00" % path)
            self.sock.recv(12)
            self.sock.close()
168119
def add_device_override(self, addr, cat, subcat, firmware=None):
        """"""
        self.plm.devices.add_override(addr, 'cat', cat)
        self.plm.devices.add_override(addr, 'subcat', subcat)
        if firmware:
            self.plm.devices.add_override(addr, 'firmware', firmware)
488436
def detectNintendo(self):
        
        return UAgentInfo.deviceNintendo in self.__userAgent \
            or UAgentInfo.deviceNintendo in self.__userAgent \
            or UAgentInfo.deviceNintendo in self.__userAgent
304293
def is_up(self):
        '''  '''

        # Get existing device flags
        ifreq = struct.pack('16sh', self.name, 0)
        flags = struct.unpack('16sh', fcntl.ioctl(sockfd, SIOCGIFFLAGS, ifreq))[1]

        # Set new flags
        if flags & IFF_UP:
            return True
        else:
            return False
56713
def add_known_devices(self, plm):
        """"""
        from insteonplm.devices import ALDBStatus
        for addr in self._saved_devices:
            if not self._devices.get(addr):
                saved_device = self._saved_devices.get(Address(addr).id, {})
                cat = saved_device.get('cat')
                subcat = saved_device.get('subcat')
                product_key = saved_device.get('firmware')
                product_key = saved_device.get('product_key', product_key)
                device = self.create_device_from_category(
                    plm, addr, cat, subcat, product_key)
                if device:
                    _LOGGER.debug('Device with id %s added to device list '
                                  'from saved device data.', addr)
                    aldb_status = saved_device.get('aldb_status', 0)
                    device.aldb.status = ALDBStatus(aldb_status)
                    aldb = saved_device.get('aldb', {})
                    device.aldb.load_saved_records(aldb_status, aldb)
                    self[addr] = device
        for addr in self._overrides:
            if not self._devices.get(addr):
                device_override = self._overrides.get(Address(addr).id, {})
                cat = device_override.get('cat')
                subcat = device_override.get('subcat')
                product_key = device_override.get('firmware')
                product_key = device_override.get('product_key', product_key)
                device = self.create_device_from_category(
                    plm, addr, cat, subcat, product_key)
                if device:
                    _LOGGER.debug('Device with id %s added to device list '
                                  'from device override data.', addr)
                    self[addr] = device
1258432
def exists(device=''):
    '''
    
    '''
    if os.path.exists(device):
        dev = os.stat(device).st_mode

        if stat.S_ISBLK(dev):
            return True

    return False
750031
def request_device?(device)
      (request.user_agent.to_s.downcase =~ (Mobylette.devices.device(device) || %r{not_to_be_matched_please}) ? true : false)
    end
810150
def canAdd(self, filename):
        
        try:
            result = self.run(['add', '-n', '-t', 'text', filename])[0]
        except errors.CommandError as err:
            LOGGER.debug(err)
            return False

        if result.get('code') not in ('error', 'info'):
            return True

        LOGGER.warn('Unable to add {}: {}'.format(filename, result['data']))

        return False
172000
def newDevice(deviceJson, lupusec):
    """"""
    type_tag = deviceJson.get('type')

    if not type_tag:
        _LOGGER.info('Device has no type')

    if type_tag in CONST.TYPE_OPENING:
        return LupusecBinarySensor(deviceJson, lupusec)
    elif type_tag in CONST.TYPE_SENSOR:
        return LupusecBinarySensor(deviceJson, lupusec)
    elif type_tag in CONST.TYPE_SWITCH:
        return LupusecSwitch(deviceJson, lupusec)
    else:
        _LOGGER.info('Device is not known')
    return None