halevt-dev
[Top][All Lists]
Advanced

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

Re: [Halevt-dev] Using parent values in exec attribute


From: Marcus Habermehl
Subject: Re: [Halevt-dev] Using parent values in exec attribute
Date: Tue, 23 Mar 2010 13:20:58 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100319 Thunderbird/3.0.3

Am 23.03.2010 11:47, schrieb Patrice Dumas:
On Sun, Mar 21, 2010 at 05:01:59PM +0100, Marcus Habermehl wrote:
Hi.

Is it possible to use the values of parent devices in an exec attribute?

This should be ready, now, in git. I haven't tested the parent
expansion in exec, though, only that it worked for me, so, please
test!

On insertion it is working now. But not on removal.

This is a part of my configuration.

<!-- Printer -->
<halevt:Device match="hal.usb.interface.class = 07">
<halevt:Insertion exec="notify-send -i gnome-dev-printer &quot;USB Printer attached&quot; &quot;USB Printer $hal.info.parent.hal.info.vendor$ $hal.info.parent.hal.info.product$ was attached.&quot;"/>
</halevt:Device>
<halevt:Device match="hal.usb.interface.class = 7">
<halevt:Removal exec="notify-send -i gnome-dev-printer &quot;USB Printer removed&quot; &quot;USB Printer $hal.info.parent.hal.info.vendor$ $hal.info.parent.hal.info.product$ was removed.&quot;"/>
</halevt:Device>

(Independent of expansion. As you can see I have two match tags for hal.usb.interface.class. This is because 07 and 7 is working on insertion. But only 7 on removal.)

lshal -m on inserting the printer:

13:11:07.535: usb_device_4f9_222_BROM9F131604 added
13:11:07.537: usb_device_4f9_222_BROM9F131604_if2 added
13:11:07.539: usb_device_4f9_222_BROM9F131604_if2_scsi_host added
13:11:07.542: usb_device_4f9_222_BROM9F131604_if1 added
13:11:07.554: usb_device_4f9_222_BROM9F131604_if0 added
13:11:12.543: usb_device_4f9_222_BROM9F131604_if2_scsi_host_0 added
13:11:12.543: usb_device_4f9_222_BROM9F131604_if2_scsi_host_0_scsi_device_lun0 added 13:11:12.545: usb_device_4f9_222_BROM9F131604_if2_scsi_host_0_scsi_device_lun0_scsi_generic added
13:11:12.815: storage_serial_Brother_DCP_195C_BROM9F131604_0_0 added
13:11:12.829: storage_serial_Brother_DCP_195C_BROM9F131604_0_0 property info.interfaces = {'org.freedesktop.Hal.Device.Storage.Removable'} (new) 13:11:15.082: storage_serial_Brother_DCP_195C_BROM9F131604_0_0 property storage.partitioning_scheme = '' (new)

Output of notify-send:

hal_interface.c:480 (halevt_run_command) Running: notify-send -i gnome-dev-printer "USB Printer attached" "USB Printer Brother Industries, Ltd DCP-195C was attached."

lshal -m on removal the printer:

13:12:32.905: usb_device_4f9_222_BROM9F131604_if0 removed
13:12:32.906: usb_device_4f9_222_BROM9F131604_if1 removed
13:12:32.910: usb_device_4f9_222_BROM9F131604_if2_scsi_host_0_scsi_device_lun0_scsi_generic removed
13:12:32.912: storage_serial_Brother_DCP_195C_BROM9F131604_0_0 removed
13:12:32.912: usb_device_4f9_222_BROM9F131604_if2_scsi_host removed
13:12:32.914: usb_device_4f9_222_BROM9F131604_if2_scsi_host_0_scsi_device_lun0 removed
13:12:32.915: usb_device_4f9_222_BROM9F131604_if2_scsi_host_0 removed
13:12:32.915: usb_device_4f9_222_BROM9F131604_if2 removed
13:12:32.930: usb_device_4f9_222_BROM9F131604 removed

Output of notify-send:

hal_interface.c:443 (halevt_run_command) Hal property info.parent->info.vendor in command 'notify-send -i gnome-dev-printer "USB Printer removed" "USB Printer $hal.info.parent.hal.info.vendor$ $hal.info.parent.hal.info.product$ was removed."' not found (or OOM) hal_interface.c:480 (halevt_run_command) Running: notify-send -i gnome-dev-printer "USB Printer removed" "USB Printer UNKNOWN USB Printer Interface was removed."

Output of lshal -u for the printer UDIs:

udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604'
  info.linux.driver = 'usb'  (string)
info.parent = '/org/freedesktop/Hal/devices/usb_device_1d6b_1_0000_00_12_0' (string)
  info.product = 'DCP-195C'  (string)
  info.subsystem = 'usb_device'  (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604' (string)
  info.vendor = 'Brother Industries, Ltd'  (string)
  linux.device_file = '/dev/bus/usb/003/013'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'usb'  (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2' (string)
  usb_device.bus_number = 3  (0x3)  (int)
  usb_device.can_wake_up = false  (bool)
  usb_device.configuration_value = 1  (0x1)  (int)
  usb_device.device_class = 0  (0x0)  (int)
  usb_device.device_protocol = 0  (0x0)  (int)
  usb_device.device_revision_bcd = 256  (0x100)  (int)
  usb_device.device_subclass = 0  (0x0)  (int)
  usb_device.is_self_powered = true  (bool)
  usb_device.linux.device_number = 13  (0xd)  (int)
usb_device.linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2' (string)
  usb_device.max_power = 2  (0x2)  (int)
  usb_device.num_configurations = 1  (0x1)  (int)
  usb_device.num_interfaces = 3  (0x3)  (int)
  usb_device.num_ports = 0  (0x0)  (int)
  usb_device.product = 'DCP-195C'  (string)
  usb_device.product_id = 546  (0x222)  (int)
  usb_device.serial = 'BROM9F131604'  (string)
  usb_device.speed = 12.0 (12) (double)
  usb_device.vendor = 'Brother Industries, Ltd'  (string)
  usb_device.vendor_id = 1273  (0x4f9)  (int)
  usb_device.version = 1.0 (1) (double)

udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2'
  info.linux.driver = 'usb-storage'  (string)
info.parent = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604' (string)
  info.product = 'USB Mass Storage Interface'  (string)
  info.subsystem = 'usb'  (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2' (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'usb'  (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.2' (string)
  usb.bus_number = 3  (0x3)  (int)
  usb.can_wake_up = false  (bool)
  usb.configuration_value = 1  (0x1)  (int)
  usb.device_class = 0  (0x0)  (int)
  usb.device_protocol = 0  (0x0)  (int)
  usb.device_revision_bcd = 256  (0x100)  (int)
  usb.device_subclass = 0  (0x0)  (int)
  usb.interface.class = 8  (0x8)  (int)
  usb.interface.number = 2  (0x2)  (int)
  usb.interface.protocol = 80  (0x50)  (int)
  usb.interface.subclass = 6  (0x6)  (int)
  usb.is_self_powered = true  (bool)
  usb.linux.device_number = 13  (0xd)  (int)
usb.linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.2' (string)
  usb.max_power = 2  (0x2)  (int)
  usb.num_configurations = 1  (0x1)  (int)
  usb.num_interfaces = 3  (0x3)  (int)
  usb.num_ports = 0  (0x0)  (int)
  usb.product = 'USB Mass Storage Interface'  (string)
  usb.product_id = 546  (0x222)  (int)
  usb.serial = 'BROM9F131604'  (string)
  usb.speed = 12.0 (12) (double)
  usb.vendor = 'Brother Industries, Ltd'  (string)
  usb.vendor_id = 1273  (0x4f9)  (int)
  usb.version = 1.0 (1) (double)

udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2_scsi_host'
  info.capabilities = {'scsi_host'} (string list)
  info.category = 'scsi_host'  (string)
info.parent = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2' (string)
  info.product = 'SCSI Host Adapter'  (string)
  info.subsystem = 'scsi_host'  (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2_scsi_host' (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'scsi_host'  (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.2/host24/scsi_host/host24' (string)
  scsi_host.host = 24  (0x18)  (int)

udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if1'
info.parent = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604' (string)
  info.product = 'USB Vendor Specific Interface'  (string)
  info.subsystem = 'usb'  (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if1' (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'usb'  (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.1' (string)
  usb.bus_number = 3  (0x3)  (int)
  usb.can_wake_up = false  (bool)
  usb.configuration_value = 1  (0x1)  (int)
  usb.device_class = 0  (0x0)  (int)
  usb.device_protocol = 0  (0x0)  (int)
  usb.device_revision_bcd = 256  (0x100)  (int)
  usb.device_subclass = 0  (0x0)  (int)
  usb.interface.class = 255  (0xff)  (int)
  usb.interface.number = 1  (0x1)  (int)
  usb.interface.protocol = 255  (0xff)  (int)
  usb.interface.subclass = 255  (0xff)  (int)
  usb.is_self_powered = true  (bool)
  usb.linux.device_number = 13  (0xd)  (int)
usb.linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.1' (string)
  usb.max_power = 2  (0x2)  (int)
  usb.num_configurations = 1  (0x1)  (int)
  usb.num_interfaces = 3  (0x3)  (int)
  usb.num_ports = 0  (0x0)  (int)
  usb.product = 'USB Vendor Specific Interface'  (string)
  usb.product_id = 546  (0x222)  (int)
  usb.serial = 'BROM9F131604'  (string)
  usb.speed = 12.0 (12) (double)
  usb.vendor = 'Brother Industries, Ltd'  (string)
  usb.vendor_id = 1273  (0x4f9)  (int)
  usb.version = 1.0 (1) (double)

udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if0'
info.parent = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604' (string)
  info.product = 'USB Printer Interface'  (string)
  info.subsystem = 'usb'  (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if0' (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'usb'  (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.0' (string)
  usb.bus_number = 3  (0x3)  (int)
  usb.can_wake_up = false  (bool)
  usb.configuration_value = 1  (0x1)  (int)
  usb.device_class = 0  (0x0)  (int)
  usb.device_protocol = 0  (0x0)  (int)
  usb.device_revision_bcd = 256  (0x100)  (int)
  usb.device_subclass = 0  (0x0)  (int)
  usb.interface.class = 7  (0x7)  (int)
  usb.interface.number = 0  (0x0)  (int)
  usb.interface.protocol = 2  (0x2)  (int)
  usb.interface.subclass = 1  (0x1)  (int)
  usb.is_self_powered = true  (bool)
  usb.linux.device_number = 13  (0xd)  (int)
usb.linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.0' (string)
  usb.max_power = 2  (0x2)  (int)
  usb.num_configurations = 1  (0x1)  (int)
  usb.num_interfaces = 3  (0x3)  (int)
  usb.num_ports = 0  (0x0)  (int)
  usb.product = 'USB Printer Interface'  (string)
  usb.product_id = 546  (0x222)  (int)
  usb.serial = 'BROM9F131604'  (string)
  usb.speed = 12.0 (12) (double)
  usb.vendor = 'Brother Industries, Ltd'  (string)
  usb.vendor_id = 1273  (0x4f9)  (int)
  usb.version = 1.0 (1) (double)

udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2_scsi_host_0'
  info.capabilities = {'scsi_host'} (string list)
  info.category = 'scsi_host'  (string)
info.parent = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2' (string)
  info.product = 'SCSI Host Adapter'  (string)
  info.subsystem = 'scsi_host'  (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2_scsi_host_0' (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'scsi_host'  (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.2/host24' (string)
  scsi_host.host = 24  (0x18)  (int)

udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2_scsi_host_0_scsi_device_lun0'
  info.linux.driver = 'sd'  (string)
info.parent = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2_scsi_host_0' (string)
  info.product = 'SCSI Device'  (string)
  info.subsystem = 'scsi'  (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2_scsi_host_0_scsi_device_lun0' (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'scsi'  (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.2/host24/target24:0:0/24:0:0:0' (string)
  scsi.bus = 0  (0x0)  (int)
  scsi.host = 24  (0x18)  (int)
  scsi.lun = 0  (0x0)  (int)
  scsi.model = 'DCP-195C'  (string)
  scsi.target = 0  (0x0)  (int)
  scsi.type = 'disk'  (string)
  scsi.vendor = 'Brother'  (string)

udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2_scsi_host_0_scsi_device_lun0_scsi_generic'
  info.capabilities = {'scsi_generic'} (string list)
  info.category = 'scsi_generic'  (string)
info.parent = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2_scsi_host_0_scsi_device_lun0' (string)
  info.product = 'SCSI Generic Interface'  (string)
  info.subsystem = 'scsi_generic'  (string)
info.udi = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2_scsi_host_0_scsi_device_lun0_scsi_generic' (string)
  linux.device_file = '/dev/sg6'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'scsi_generic'  (string)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.2/host24/target24:0:0/24:0:0:0/scsi_generic/sg6' (string)
  scsi_generic.device = '/dev/sg6'  (string)

udi = '/org/freedesktop/Hal/devices/storage_serial_Brother_DCP_195C_BROM9F131604_0_0'
  block.device = '/dev/sdf'  (string)
  block.is_volume = false  (bool)
  block.major = 8  (0x8)  (int)
  block.minor = 80  (0x50)  (int)
block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_Brother_DCP_195C_BROM9F131604_0_0' (string)
  info.addons = {'hald-addon-storage'} (string list)
  info.capabilities = {'storage', 'block'} (string list)
  info.category = 'storage'  (string)
info.interfaces = {'org.freedesktop.Hal.Device.Storage.Removable'} (string list) info.parent = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2_scsi_host_0_scsi_device_lun0' (string)
  info.product = 'DCP-195C'  (string)
info.udi = '/org/freedesktop/Hal/devices/storage_serial_Brother_DCP_195C_BROM9F131604_0_0' (string)
  info.vendor = 'Brother'  (string)
  linux.hotplug_type = 3  (0x3)  (int)
linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.2/host24/target24:0:0/24:0:0:0/block/sdf' (string)
  storage.automount_enabled_hint = true  (bool)
  storage.bus = 'usb'  (string)
  storage.drive_type = 'disk'  (string)
  storage.firmware_version = '1.00'  (string)
  storage.hotpluggable = true  (bool)
  storage.lun = 0  (0x0)  (int)
  storage.media_check_enabled = true  (bool)
  storage.model = 'DCP-195C'  (string)
  storage.no_partitions_hint = false  (bool)
storage.originating_device = '/org/freedesktop/Hal/devices/usb_device_4f9_222_BROM9F131604_if2' (string)
  storage.partitioning_scheme = ''  (string)
  storage.removable = true  (bool)
  storage.removable.media_available = false  (bool)
  storage.removable.support_async_notification = false  (bool)
  storage.requires_eject = false  (bool)
  storage.serial = 'Brother_DCP-195C_BROM9F131604-0:0'  (string)
  storage.size = 0  (0x0)  (uint64)
  storage.vendor = 'Brother'  (string)

Greetings
Marcus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]