Unmount a Device if mounted.

        :param device: device object, block device path or mount path
        :returns: whether the device is unmounted
160728
async def unmount(self, device):
        
        device = self._find_device(device)
        if not self.is_handleable(device) or not device.is_filesystem:
            self._log.warn(_('not unmounting {0}: unhandled device', device))
            return False
        if not device.is_mounted:
            self._log.info(_('not unmounting {0}: not mounted', device))
            return True
        self._log.debug(_('unmounting {0}', device))
        await device.unmount()
        self._log.info(_('unmounted {0}', device))
        return True
380684
async def add(self, device, recursive=None):
        
        device, created = await self._find_device_losetup(device)
        if created and recursive is False:
            return device
        if device.is_filesystem:
            success = await self.mount(device)
        elif device.is_crypto:
            success = await self.unlock(device)
            if success and recursive:
                await self.udisks._sync()
                device = self.udisks[device.object_path]
                success = await self.add(
                    device.luks_cleartext_holder,
                    recursive=True)
        elif (recursive
              and device.is_partition_table
              and self.is_handleable(device)):
            tasks = [
                self.add(dev, recursive=True)
                for dev in self.get_all_handleable()
                if dev.is_partition and dev.partition_slave == device
            ]
            results = await gather(*tasks)
            success = all(results)
        else:
            self._log.info(_('not adding {0}: unhandled device', device))
            return False
        return success
248092
def umount(self, forced=True):
        
        if self.is_mounted():
            if is_osx():
                cmd = ["/usr/sbin/diskutil", "unmount",
                       self.connection["mount_point"]]
                if forced:
                    cmd.insert(2, "force")
                subprocess.check_call(cmd)
            else:
                cmd = ["umount", self.connection["mount_point"]]
                if forced:
                    cmd.insert(1, "-f")
                subprocess.check_call(cmd)
727007
def delete_device(self, device_id):
        
        api = self._get_api(device_directory.DefaultApi)
        return api.device_destroy(id=device_id)
384083
async def async_delete_device(self, device_id: int) -> None:
        

        # Lookup device using zone to obtain an accurate index, which is
        # needed to perform the delete command
        device = self._devices[device_id]
        response = await self._protocol.async_execute(
            GetDeviceCommand(device.category, device.group_number, device.unit_number))
        if isinstance(response, DeviceInfoResponse):
            response = await self._protocol.async_execute(
                DeleteDeviceCommand(device.category, response.index))
            if isinstance(response, DeviceDeletedResponse):
                self._devices._delete(device) # pylint: disable=protected-access
                if self._on_device_deleted:
                    try:
                        self._on_device_deleted(self, device)  # pylint: disable=protected-access
                    except Exception: # pylint: disable=broad-except
                        _LOGGER.error(
                            "Unhandled exception in on_device_deleted callback",
                            exc_info=True)
        if isinstance(response, DeviceNotFoundResponse):
            raise ValueError("Device to be deleted was not found")
20435
function onUnmount( instance ) {
  store.deleteInstance( instance );
  if ( store.isEmpty() ) {
    listeners.unbindClicks( _onClick );
    listeners.unbindKeys( _onKeyDown );
  }
}
779306
def device_locked(self, device):
        """"""
        if not self._mounter.is_handleable(device):
            return
        self._show_notification(
            'device_locked',
            _('Device locked'),
            _('{0.device_presentation} locked', device),
            device.icon_name)
1234605
def get_device_address(device):
    
    if device is None:
        return None
    command = ['ip', 'route', 'list', 'dev', device]
    ip_routes = subprocess.check_output(command).strip()
    for line in ip_routes.split('\n'):
        seen = ''
        for a in line.split():
            if seen == 'src':
                return a
            seen = a
    return None
601057
async def delete(self, device, remove=True):
        
        device = self._find_device(device)
        if not self.is_handleable(device) or not device.is_loop:
            self._log.warn(_('not deleting {0}: unhandled device', device))
            return False
        if remove:
            await self.auto_remove(device, force=True)
        self._log.debug(_('deleting {0}', device))
        await device.delete()
        self._log.info(_('deleted {0}', device))
        return True
1354625
def unmount_path(path, force=False):
        
        r = util.subp(['umount', path])
        if not force:
            if r.return_code != 0:
                raise ValueError(r.stderr)
1020209
def delete_device(self, rid):
        
        headers = {
                'User-Agent': self.user_agent(),
                'Content-Type': self.content_type()
            }
        headers.update(self.headers())
        r = requests.delete(    self.portals_url()+'/devices/'+rid, 
                                headers=headers,
                                auth=self.auth())
        if HTTP_STATUS.NO_CONTENT == r.status_code:
            print("Successfully deleted device with rid: {0}".format(rid))
            return True
        else:
            print("Something went wrong: <{0}>: {1}".format(
                        r.status_code, r.reason))
            r.raise_for_status()
            return False
30723
async def lock(self, device):
        
        device = self._find_device(device)
        if not self.is_handleable(device) or not device.is_crypto:
            self._log.warn(_('not locking {0}: unhandled device', device))
            return False
        if not device.is_unlocked:
            self._log.info(_('not locking {0}: not unlocked', device))
            return True
        self._log.debug(_('locking {0}', device))
        await device.lock()
        self._log.info(_('locked {0}', device))
        return True
130890
def is_device(obj):
    
    return isinstance(obj, type) and issubclass(
        obj, DeviceBase) and obj.__module__ not in ('lewis.devices', 'lewis.core.devices')
344879
def unmount
      return nil unless mounted?
      if system "/sbin/umount '#{@mountpoint}'"
        sleep 1 # the umount takes time.
        @mountpoint.rmdir if @mountpoint.directory? and (not @mountpoint.mountpoint?)
        @mounted = false
      else
        raise  JSS::FileServiceError ,"There was a problem unmounting #{@mountpoint}"
      end
      nil
    end
1299878
def RemoveDevice(self, object_path):
    ''' '''

    adapter = mockobject.objects[self.path]
    adapter.EmitSignal(ADAPTER_IFACE, 'DeviceRemoved',
                       'o', [object_path])
904058
async def terminal(self, device):
        
        device = self._find_device(device)
        if not device.is_mounted:
            self._log.error(_("not opening terminal {0}: not mounted", device))
            return False
        if not self._terminal:
            self._log.error(_("not opening terminal {0}: no program", device))
            return False
        self._log.debug(_('opening {0} on {0.mount_paths[0]}', device))
        self._terminal(device.mount_paths[0])
        self._log.info(_('opened {0} on {0.mount_paths[0]}', device))
        return True
295083
def close(self):
        
        if self._is_open:
            self._is_open = False
            hidapi.hid_close(self._device)