Add device to the list of known ones
550921
def _add_device(self, scs_id, ha_id, name):
        
        if scs_id in self._devices:
            return

        self._devices[scs_id] = {
            'name': name,
            'ha_id': ha_id
        }
215553
def update_device_info(self, device_id, display_name):
        
        content = {
            "display_name": display_name
        }
        return self._send("PUT", "/devices/%s" % device_id, content=content)
1034983
def obtain_all_devices(my_devices):
    """"""
    new_devices = {}
    for device_name, device_or_group in my_devices.items():
        # Skip any groups
        if not isinstance(device_or_group, list):
            new_devices[device_name] = device_or_group
    return new_devices
141896
def show_devices(verbose=False, **kwargs):
    
    kwargs["find_all"] = True
    devices = find(**kwargs)
    strings = ""
    for device in devices:
        if not verbose:
            strings +=  "%s, %s\n" % (device._str(), _try_lookup(
                _lu.device_classes, device.bDeviceClass))
        else:
            strings += "%s\n\n" % str(device)

    return _DescriptorInfo(strings)
334422
def pick_device

      devices = AdbExtended::Adb.devices

      if devices.size == 0
        puts 'No devices found'
        exit 1
      end

      if devices.size == 1
        return devices[0][:serial]
      end

      table = Terminal::Table.new do |t|
        header_row = %w(# Model Serial)

        t << header_row
        t << :separator
        devices.each_with_index {|value, index|
          row = [index + 1, value[:model], value[:serial]]
          t.add_row row
        }
      end

      puts table

      accepted_inputs = *(1..devices.size).map {|i| i.to_s}
      index = ask("Select a device (1 - #{devices.size}):", :limited_to => accepted_inputs).to_i - 1
      devices[index][:serial]
    end
1157394
def init_device(self):
        """"""
        Device.init_device(self)

        # Add anything here that has to be done before the device is set to
        # its ON state.

        self._set_master_state('on')
        self._devProxy = DeviceProxy(self.get_name())
175607
def add_device(self, device, container):
        
        # There is a size tag which the JSS manages for us, so we can
        # ignore it.
        if self.findtext("is_smart") == "false":
            self.add_object_to_path(device, container)
        else:
            # Technically this isn't true. It will strangely accept
            # them, and they even show up as members of the group!
            raise ValueError("Devices may not be added to smart groups.")
932231
def _add_device_to_device_group(self, device):
        '''
        '''

        device_name = get_device_info(device).name
        dg = pollster(self._get_device_group)(device)
        dg.devices_s.devices.create(name=device_name, partition=self.partition)
        pollster(self._check_device_exists_in_device_group)(device_name)
995551
def _on_device_update(self, devid):
        """"""
        if isinstance(devid, (tuple, list)):
            devid = devid[0]

        if devid is None:
            _LOGGER.warning("Device update with no device id.")
            return

        _LOGGER.debug("Device update event for device ID: %s", devid)

        device = self._abode.get_device(devid, True)

        if not device:
            _LOGGER.debug("Got device update for unknown device: %s", devid)
            return

        for callback in self._device_callbacks.get(device.device_id, ()):
            _execute_callback(callback, device)
1037906
private void updateConnectedDevices(final List<USBStorageDevice> currentConnectedDevices) {
        final List<USBStorageDevice> removedDevices = new ArrayList<>();

        synchronized (this) {
            final Iterator<USBStorageDevice> itConnectedDevices = connectedDevices.iterator();

            while (itConnectedDevices.hasNext()) {
                final USBStorageDevice device = itConnectedDevices.next();

                if (currentConnectedDevices.contains(device)) {
                    currentConnectedDevices.remove(device);
                } else {
                    removedDevices.add(device);

                    itConnectedDevices.remove();
                }
            }

            connectedDevices.addAll(currentConnectedDevices);
        }

        currentConnectedDevices.forEach(device ->
                sendEventToListeners(new USBStorageEvent(device, DeviceEventType.CONNECTED)));

        removedDevices.forEach(device ->
                sendEventToListeners(new USBStorageEvent(device, DeviceEventType.REMOVED)));
    }
867347
def _find_devices_mac(self):
        """"""
        self.keyboards.append(Keyboard(self))
        self.mice.append(MightyMouse(self))
        self.mice.append(Mouse(self))
875384
def add(self, plm, device, stateType, stateName, group, defaultValue=None):
        """"""
        self._stateList[group] = stateType(plm, device, stateName, group,
                                           defaultValue=defaultValue)
981190
def ListDevices(self):
    '''
    '''
    devices = []

    for obj in mockobject.objects.keys():
        if obj.startswith('/org/bluez/') and 'dev_' in obj:
            devices.append(dbus.ObjectPath(obj, variant_level=1))

    return dbus.Array(devices, variant_level=1)
307491
function DeviceInfo (deviceIndex, deviceName, deviceType) {
    this.index = deviceIndex;
    this.name = deviceName;
    this.type = deviceType;
}
634570
def _add_trustee(self, device):
        '''
        '''

        device_name = get_device_info(device).name
        if device_name in self.domain:
            msg = 'Device: %r is already in this trust domain.' % device_name
            raise DeviceAlreadyInTrustDomain(msg)
        self._modify_trust(self.devices[0], self._get_add_trustee_cmd, device)
1298180
def add_device_items(self, item, device):
        
        if item in ('aux', 'console'):
            self.node['properties'][item] = device[item]
        elif item.startswith('slot'):
            # if self.device_info['model'] == 'c7200':
            #     if item != 'slot0':
            #         self.node['properties'][item] = device[item]
            # else:
            self.node['properties'][item] = device[item]
        elif item == 'connections':
            self.connections = device[item]
        elif INTERFACE_RE.search(item) or VBQ_INT_RE.search(item):
            self.interfaces.append({'from': item,
                                    'to': device[item]})
        elif NUMBER_RE.search(item):
            if self.device_info['type'] == 'EthernetSwitch':
                self.calc_ethsw_port(item, device[item])
            elif self.device_info['type'] == 'FrameRelaySwitch':
                self.calc_frsw_port(item, device[item])
        elif MAPINT_RE.search(item):
            self.add_mapping((item, device[item]))
        elif item == 'cnfg':
            new_config = os.path.join('configs', 'i%s_startup-config.cfg' %
                                      self.node['id'])
            self.node['properties']['startup_config'] = new_config

            self.config.append({'old': fix_path(device[item]),
                                'new': new_config})
        elif item.startswith('wic'):
            self.add_wic(item, device[item])
        elif item == 'symbol':
            self.set_symbol(device[item])
        elif item == 'nics':
            self.node['properties']['adapters'] = device[item]
        elif item == 'image':
            self.node['properties']['vmname'] = device[item]
        elif item == 'vbox_id' or item == 'qemu_id':
            self.node[item] = device[item]
669280
def set_device_name(self, newname):
        
        return self.write(request.SetDeviceName(self.seq, *self.prep_str(newname)))