[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: HAL, монтирование флешек



On Sat, Feb 07, 2009 at 11:15:42AM +0300, Stanislav Maslovski wrote:
> Эксперимент с попыткой подружиться с гномом на ноуте закончился неудачей,
> и его там больше нет. Собственно, интересует сабж. Могу сделать
> по-старинке, на связке autofs + udev, c ivman + hal тоже могу, но
> хочется странного: монтировать только средствами hal. Это возможно?

При воткнутой флешке имеем:
# hal-find-by-property --key block.device --string /dev/sdb1         
/org/freedesktop/Hal/devices/volume_uuid_2481_E524
lshal -l --show /org/freedesktop/Hal/devices/volume_uuid_2481_E524
udi = '/org/freedesktop/Hal/devices/volume_uuid_2481_E524'
  block.device = '/dev/sdb1'  (string)
  block.is_volume = true  (bool)
  block.major = 8  (0x8)  (int)
  block.minor = 17  (0x11)  (int)
  block.storage_device =
'/org/freedesktop/Hal/devices/storage_serial_JetFlash_TS2GJFV33_GFD99DRV_0_0'
 (string)
  info.capabilities = {'volume', 'block'} (string list)
  info.category = 'volume'  (string)
  info.interfaces = {'org.freedesktop.Hal.Device.Volume'} (string list)
  info.parent =
'/org/freedesktop/Hal/devices/storage_serial_JetFlash_TS2GJFV33_GFD99DRV_0_0'
 (string)
  info.product = 'Volume (vfat)'  (string)
  info.udi = '/org/freedesktop/Hal/devices/volume_uuid_2481_E524'
(string)
  linux.hotplug_type = 3  (0x3)  (int)
  linux.sysfs_path = '/sys/block/sdb/sdb1'  (string)
  org.freedesktop.Hal.Device.Volume.method_argnames = {'mount_point
fstype extra_options', 'extra_options', 'extra_options'} (string list)
  org.freedesktop.Hal.Device.Volume.method_execpaths =
{'hal-storage-mount', 'hal-storage-unmount', 'hal-storage-eject'}
(string list)
  org.freedesktop.Hal.Device.Volume.method_names = {'Mount',
'Unmount', 'Eject'} (string list)
  org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as',
'as'} (string list)
  storage.model = ''  (string)
  volume.block_size = 512  (0x200)  (int)
  volume.fstype = 'vfat'  (string)
  volume.fsusage = 'filesystem'  (string)
  volume.fsversion = 'FAT16'  (string)
  volume.ignore = false  (bool)
  volume.is_disc = false  (bool)
  volume.is_mounted = false  (bool)
  volume.is_mounted_read_only = false  (bool)
  volume.is_partition = true  (bool)
  volume.label = ''  (string)
  volume.linux.is_device_mapper = false  (bool)
  volume.mount.valid_options = {'ro', 'sync', 'dirsync', 'noatime',
'nodiratime', 'noexec', 'quiet', 'remount', 'exec', 'utf8',
'shortname=', 'codepage=', 'iocharset=', 'umask=', 'dmask=', 'fmask=',
'uid=', 'flush'} (string list)
  volume.mount_point = ''  (string)
  volume.num_blocks = 4005856  (0x3d1fe0)  (int)
  volume.partition.flags = {} (string list)
  volume.partition.label = ''  (string)
  volume.partition.media_size = 2051014656  (0x7a400000)  (uint64)
  volume.partition.number = 1  (0x1)  (int)
  volume.partition.scheme = 'mbr'  (string)
  volume.partition.start = 16384  (0x4000)  (uint64)
  volume.partition.type = '0x06'  (string)
  volume.partition.uuid = ''  (string)
  volume.size = 2050998272  (0x7a3fc000)  (uint64)
  volume.unmount.valid_options = {'lazy'} (string list)
  volume.uuid = '2481-E524'  (string)

т.е., видим, что нужные методы у нас есть:
------------------------------------------------------------------
  org.freedesktop.Hal.Device.Volume.method_execpaths =
{'hal-storage-mount', 'hal-storage-unmount', 'hal-storage-eject'}  
------------------------------------------------------------------

Вызвать их можно через dbus, из скрипта. Вопрос в том, можно ли как-то
заставить hald запустить такой скриптик в нужный момент. Или
обязательно нужен лишний демон, опрашивающий HAL?

-- 
Stanislav


Reply to: