2009/9/11 Stefan Leichter <stefan.leich...@camline.com>: > Am Friday 11 September 2009 12:30:01 schrieb Christian Gmeiner: >> Hi Stefan, >> >> I like the idea of adding more registry keys for hardware components. >> I want some registry keys for usb devices >> so I had a look at your patch. I don't like the mess with the added >> goto serial. If in future there will be support >> for usb and the whole source will be quite hard to follow. The usb >> registry keys are needed e.g. for this [1]. >> So i like to propose my idea how it could look like. >> >> In function new_device( LibHalContext *ctx, const char *udi ) we could >> readout the info.subsystem setting of the newly added device and add a >> if for info.subsystem strings like >> block - block devices >> tty - serial >> usb_devices/usb - usb >> >> could look like >> >> /* HAL callback for new device */ >> static void new_device( LibHalContext *ctx, const char *udi ) >> { >> DBusError error; >> char *subsystem = NULL; >> >> p_dbus_error_init( &error ); >> >> if (!(subsystem = p_libhal_device_get_property_string( ctx, udi, >> "info.subsystem", &error ))) >> goto done; >> >> if (strcmp(subsystem == "block") == 0) >> block_device( ctx, udi, &error ); >> else if (strcmp(subsystem == "usb_device") == 0) >> usb_device( ctx, udi, &error ); >> else if (strcmp(subsystem == "tty") == 0) >> serial_device( ctx, udi, &error ); >> >> p_dbus_error_free( &error ); >> } >> > > Hi Christian, > > i like your idea, but a short test shows that "info.subsystem" is not > available for drives. But "info.category" can be used.
with drives you mean CD and DVD drives? lshal gives me this: udi = '/org/freedesktop/Hal/devices/pci_10de_37f_1_scsi_host_scsi_device_lun0' info.linux.driver = 'sr' (string) info.parent = '/org/freedesktop/Hal/devices/pci_10de_37f_1_scsi_host' (string) info.product = 'SCSI Device' (string) info.subsystem = 'scsi' (string) info.udi = '/org/freedesktop/Hal/devices/pci_10de_37f_1_scsi_host_scsi_device_lun0' (string) linux.hotplug_type = 2 (0x2) (int) linux.subsystem = 'scsi' (string) linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:0d.2/host4/target4:0:0/4:0:0:0' (string) scsi.bus = 0 (0x0) (int) scsi.host = 4 (0x4) (int) scsi.lun = 0 (0x0) (int) scsi.model = 'CD/DVDW SH-S183L' (string) scsi.target = 0 (0x0) (int) scsi.type = 'cdrom' (string) scsi.vendor = 'TSSTcorp' (string) udi = '/org/freedesktop/Hal/devices/storage_model_CD_DVDW_SH_S183L' block.device = '/dev/sr0' (string) block.is_volume = false (bool) block.major = 11 (0xb) (int) block.minor = 0 (0x0) (int) block.storage_device = '/org/freedesktop/Hal/devices/storage_model_CD_DVDW_SH_S183L' (string) info.addons = {'hald-addon-storage'} (string list) info.capabilities = {'storage', 'block', 'storage.cdrom'} (string list) info.category = 'storage' (string) info.interfaces = {'org.freedesktop.Hal.Device.Storage', 'org.freedesktop.Hal.Device.Storage', 'org.freedesktop.Hal.Device.Storage.Removable'} (string list) info.parent = '/org/freedesktop/Hal/devices/pci_10de_37f_1_scsi_host_scsi_device_lun0' (string) info.product = 'CD/DVDW SH-S183L' (string) info.udi = '/org/freedesktop/Hal/devices/storage_model_CD_DVDW_SH_S183L' (string) info.vendor = 'TSSTcorp' (string) linux.hotplug_type = 3 (0x3) (int) linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:0d.2/host4/target4:0:0/4:0:0:0/block/sr0' (string) org.freedesktop.Hal.Device.Storage.method_argnames = {'extra_options', 'extra_options'} (string list) org.freedesktop.Hal.Device.Storage.method_execpaths = {'hal-storage-eject', 'hal-storage-closetray'} (string list) org.freedesktop.Hal.Device.Storage.method_names = {'Eject', 'CloseTray'} (string list) org.freedesktop.Hal.Device.Storage.method_signatures = {'as', 'as'} (string list) storage.automount_enabled_hint = true (bool) storage.bus = 'pci' (string) storage.cdrom.bd = false (bool) storage.cdrom.bdr = false (bool) storage.cdrom.bdre = false (bool) storage.cdrom.cdr = true (bool) storage.cdrom.cdrw = true (bool) storage.cdrom.dvd = true (bool) storage.cdrom.dvdplusr = true (bool) storage.cdrom.dvdplusrdl = true (bool) storage.cdrom.dvdplusrw = true (bool) storage.cdrom.dvdplusrwdl = false (bool) storage.cdrom.dvdr = true (bool) storage.cdrom.dvdram = true (bool) storage.cdrom.dvdrdl = true (bool) storage.cdrom.dvdrw = true (bool) storage.cdrom.hddvd = false (bool) storage.cdrom.hddvdr = false (bool) storage.cdrom.hddvdrw = false (bool) storage.cdrom.mo = false (bool) storage.cdrom.mrw = true (bool) storage.cdrom.mrw_w = true (bool) storage.cdrom.read_speed = 16620 (0x40ec) (int) storage.cdrom.support_media_changed = true (bool) storage.cdrom.support_multisession = true (bool) storage.cdrom.write_speed = 11080 (0x2b48) (int) storage.cdrom.write_speeds = {'11080', '5540'} (string list) storage.drive_type = 'cdrom' (string) storage.firmware_version = 'SB01' (string) storage.hotpluggable = false (bool) storage.lun = 0 (0x0) (int) storage.media_check_enabled = true (bool) storage.model = 'CD/DVDW SH-S183L' (string) storage.no_partitions_hint = true (bool) storage.originating_device = '/org/freedesktop/Hal/devices/computer' (string) storage.removable = true (bool) storage.removable.media_available = true (bool) storage.removable.media_size = 2717777920 (0xa1fe0000) (uint64) storage.removable.support_async_notification = false (bool) storage.requires_eject = true (bool) storage.size = 0 (0x0) (uint64) storage.vendor = 'TSSTcorp' (string) So it would be info.subsystem = 'scsi' -- Christian Gmeiner, B.Sc.