Bug 5558 - ignores USB DVD drive ("no parent")
Summary: ignores USB DVD drive ("no parent")
Status: RESOLVED FIXED
Alias: None
Product: hal
Classification: Unclassified
Component: hald (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: David Zeuthen (not reading bugmail)
QA Contact:
URL: https://launchpad.net/products/hal/+b...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-10 03:48 UTC by Martin Pitt
Modified: 2008-01-03 17:41 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
hack to fix it (862 bytes, patch)
2006-08-23 06:11 UTC, Martin Pitt
Details | Splinter Review

Description Martin Pitt 2006-01-10 03:48:50 UTC
I have several reports about firewire drives not working with hal 0.5.5.1 (udev
079, dbus 0.60, kernel 2.6.15). The device is recognized, but hal does not add
nodes for volumes:

13:27:52.857 [I] osspec.c:203: SEQNUM=2453, ACTION=add, SUBSYS=block,
SYSFSPATH=/block/sda, DEVNAME=/dev/sda, IFINDEX=-1
13:27:52.858 [I] blockdev.c:566: block_add: sysfs_path=/sys/block/sda
dev=/dev/sda is_part=0, parent=0x08089570
13:27:52.858 [I] blockdev.c:781: parent_bus is scsi
13:27:53.088 [I] osspec.c:203: SEQNUM=2454, ACTION=add, SUBSYS=block,
SYSFSPATH=/block/sda/sda1, DEVNAME=/dev/sda1, IFINDEX=-1
13:27:53.088 [I] blockdev.c:566: block_add: sysfs_path=/sys/block/sda/sda1
dev=/dev/sda1 is_part=1, parent=0x00000000
13:27:53.088 [I] blockdev.c:477: get_luks_uuid: device_file=/dev/sda1
13:27:53.088 [I] blockdev.c:602: Ignoring hotplug event - no parent

so parent is indeed NULL for /dev/sda1, although it is valid for /dev/sda (and
the order looks fine, too). 

The original bug report https://bugzilla.ubuntu.com/show_bug.cgi?id=20564 has
full details and logs.

Can this be related to #5403?

Thanks in advance!
Comment 1 David Zeuthen (not reading bugmail) 2006-08-02 17:24:13 UTC
Is this still an issue with 0.5.7.1 or later and recent udev versions? Or can I
close this as FIXED?
Comment 2 Daniel Holbach 2006-08-03 08:03:43 UTC
The Ubuntu user reports it as fixed. Closing the bug.
Comment 3 Martin Pitt 2006-08-23 02:09:59 UTC
This bug just reappeared for USB DVD drives, and seems to happen fairly
consistently: See https://launchpad.net/bugs/56484.

11:01:20.396 [I] osspec.c:232: SEQNUM=2636, ACTION=add, SUBSYSTEM=scsi_device,
DEVPATH=/sys/class/scsi_device/11:0:0:0, DEVNAME=, IFINDEX=0
11:01:20.397 [I] hotplug.c:205: /sys/class/scsi_device/11:0:0:0 is a class
device (devpath)
11:01:20.397 [I] classdev.c:1378: class_add: subsys=scsi_device
sysfs_path=/sys/class/scsi_device/11:0:0:0 dev= physdev=0x100c86c8
11:01:20.617 [I] osspec.c:232: SEQNUM=2637, ACTION=add, SUBSYSTEM=scsi_generic,
DEVPATH=/sys/class/scsi_generic/sg0, DEVNAME=/dev/sg0, IFINDEX=0
11:01:20.619 [I] hotplug.c:205: /sys/class/scsi_generic/sg0 is a class device
(devpath)
11:01:20.619 [I] classdev.c:1378: class_add: subsys=scsi_generic
sysfs_path=/sys/class/scsi_generic/sg0 dev=/dev/sg0 physdev=0x100c86c8
11:01:20.633 [I] classdev.c:1241: Add callouts completed
udi=/org/freedesktop/Hal/devices/usb_device_409_56_000000000001_if0_scsi_host_scsi_device_lun0_scsi_generic
11:01:20.633 [I] hald.c:82: Added device to GDL;
udi=/org/freedesktop/Hal/devices/usb_device_409_56_000000000001_if0_scsi_host_scsi_device_lun0_scsi_generic

Message from syslogd@localhost at Wed Aug 23 11:01:20 2006 ...
localhost kernel: [33867.200668] sr0: scsi3-mmc drive: 8x/48x writer cd/rw
xa/form2 cdda tray
11:01:27.329 [I] osspec.c:232: SEQNUM=2635, ACTION=add, SUBSYSTEM=block,
DEVPATH=/sys/block/sr0, DEVNAME=/dev/scd0, IFINDEX=0
11:01:27.330 [I] hotplug.c:208: /sys/block/sr0 is a block device (devpath)
11:01:27.331 [I] blockdev.c:589: block_add: sysfs_path=/sys/block/sr0
dev=/dev/scd0 is_part=1, parent=0x00000000
11:01:27.332 [I] blockdev.c:499: get_luks_uuid: device_file=/dev/scd0
11:01:27.332 [I] blockdev.c:625: Ignoring hotplug event - no parent
11:01:27.332 [W] blockdev.c:990: Not adding device object

Thus hal has no idea whatsoever about /dev/sr0, although the device is present
in the system and works quite well.
Comment 4 Martin Pitt 2006-08-23 02:40:08 UTC
OK, I think I have an idea about what goes wrong now:

* The kernel creates /sys/block/sr0, which is the block device for the USB CD-ROM.

* ./hald/linux2/hotplug.c, around line 285:

   is_partition = isdigit(hotplug_event->sysfs.sysfs_path[len - 1]) ||
      strstr (hotplug_event->sysfs.sysfs_path, "/fakevolume") ;

  hal assumes that devices ending with a number are partitions on a block
device, which is not the case for SCSI CD-ROMs (i.e. it's not
/sys/block/sra/sra0, SCSI CD-ROMs are enumerated with numbers, not with letters
as ATAPI devices are). Thus is_partition becomes true.

    if (is_partition) {
       gchar *parent_path;
       parent_path = hal_util_get_parent_path (hotplug_event->sysfs.sysfs_path);

sysfs.sysfs_path is /sys/block/sr0, thus parent_path is /sys/block, which is of
course not a device.

       parent = hal_device_store_match_key_value_string (hald_get_gdl (),      
                                                                   
"linux.sysfs_path_device", parent_path);

parent becomes NULL here, which is then directly passed to
hotplug_event_begin_add_blockdev(), which throws the event away.
Comment 5 Martin Pitt 2006-08-23 06:11:08 UTC
Created attachment 6658 [details] [review]
hack to fix it

I created a small patch that fixes it for now; it's pretty ugly, i. e.
eventually the original is_partition condition should be reworked properly, but
the patch should point out what the actual problem is.

   * Add 16-nonpartitions-ending-in-nums.patch:
     - Hal currently assumes that device names ending in numbers are
       partitions. This patch adds a safe and easy, but slightly ugly
       workaround. (Real fix will be discussed with upstream at
       https://bugs.freedesktop.org/show_bug.cgi?id=5558)
     - This breaks SCSI, USB, and Firewire CD drives, which are usually called
       'scd0', 'sr1', etc.
Comment 6 Danny Kukawka 2008-01-03 17:41:57 UTC
This is IIRC fixed in actual HAL versions by check for the range file in sysfs. Close as Fixed


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.