hal: usb flash drive is seen as scsi device

Andriy Gapon avg at icyb.net.ua
Fri Jan 11 03:49:04 PST 2008


Please compare two snippets of lshal output below.
In the first case I have a USB card reader connected, in the second case
I have a USB flash drive connected. In the first case storage.bus is
equal to usb, in the second case it is scsi.

Looking at the code in hf_scsi_block_device_new() function I think that
value of storage.bus is determined by looking at info.bus values of
parent devices.

The snippets below show that in the case of the flash drive there is one
"missing link": 'SCSI Host Adapter' is a direct child of 'Mass Storage
Device'. In the case of the card reader there is also 'USB Mass Storage
Interface' between them. The latter has info.bus='usb'.
But in the second case, there is no device with info.bus='usb' at all,
only with info.bus='usb_device'.

I am not sure if an easy way of teaching hf_scsi_block_device_new() to
recognize usb_device bus would be sufficient.
It is a little bit weird that there is such difference in device
hierarchies for such a similar devices.

--------------Snippet #1, USB card reader----------------------------
udi = '/org/freedesktop/Hal/devices/usb_device_58f_6362_058F312D81B'
  info.udi =
'/org/freedesktop/Hal/devices/usb_device_58f_6362_058F312D81B'  (string)
  freebsd.unit = 0  (0x0)  (int)
  freebsd.driver = 'umass'  (string)
  usb_device.num_interfaces = 1  (0x1)  (int)
  usb_device.can_wake_up = false  (bool)
  usb_device.vendor = 'Generic'  (string)
  usb_device.product = 'Mass Storage Device'  (string)
  usb_device.serial = '058F312D81B'  (string)
  usb_device.device_revision_bcd = 297  (0x129)  (int)
  usb_device.vendor_id = 1423  (0x58f)  (int)
  usb_device.product_id = 25442  (0x6362)  (int)
  usb_device.version_bcd = 512  (0x200)  (int)
  usb_device.speed_bcd = 294912  (0x48000)  (int)
  usb_device.port_number = 2  (0x2)  (int)
  usb_device.num_ports = 0  (0x0)  (int)
  usb_device.max_power = 250  (0xfa)  (int)
  usb_device.is_self_powered = false  (bool)
  usb_device.device_protocol = 0  (0x0)  (int)
  usb_device.device_subclass = 0  (0x0)  (int)
  usb_device.device_class = 0  (0x0)  (int)
  usb_device.num_configurations = 1  (0x1)  (int)
  usb_device.configuration_value = 1  (0x1)  (int)
  usb_device.bus_number = 1  (0x1)  (int)
  info.vendor = 'Generic'  (string)
  info.product = 'Mass Storage Device'  (string)
  info.bus = 'usb_device'  (string)
  info.parent = '/org/freedesktop/Hal/devices/pci_10de_026e'  (string)

udi = '/org/freedesktop/Hal/devices/usb_device_58f_6362_058F312D81B_if0'
  info.udi =
'/org/freedesktop/Hal/devices/usb_device_58f_6362_058F312D81B_if0'  (string)
  usb.interface.number = 0  (0x0)  (int)
  usb.interface.protocol = 80  (0x50)  (int)
  usb.interface.subclass = 6  (0x6)  (int)
  usb.interface.class = 8  (0x8)  (int)
  info.product = 'USB Mass Storage Interface'  (string)
  usb.bus_number = 1  (0x1)  (int)
  usb.configuration_value = 1  (0x1)  (int)
  usb.num_configurations = 1  (0x1)  (int)
  usb.device_class = 0  (0x0)  (int)
  usb.device_subclass = 0  (0x0)  (int)
  usb.device_protocol = 0  (0x0)  (int)
  usb.is_self_powered = false  (bool)
  usb.max_power = 250  (0xfa)  (int)
  usb.num_ports = 0  (0x0)  (int)
  usb.port_number = 2  (0x2)  (int)
  usb.speed_bcd = 294912  (0x48000)  (int)
  usb.version_bcd = 512  (0x200)  (int)
  usb.product_id = 25442  (0x6362)  (int)
  usb.vendor_id = 1423  (0x58f)  (int)
  usb.device_revision_bcd = 297  (0x129)  (int)
  usb.serial = '058F312D81B'  (string)
  usb.product = 'USB Mass Storage Interface'  (string)
  usb.vendor = 'Generic'  (string)
  usb.can_wake_up = false  (bool)
  usb.num_interfaces = 1  (0x1)  (int)
  info.bus = 'usb'  (string)
  info.parent =
'/org/freedesktop/Hal/devices/usb_device_58f_6362_058F312D81B'  (string)

udi =
'/org/freedesktop/Hal/devices/usb_device_58f_6362_058F312D81B_if0_scsi_host'
  info.udi =
'/org/freedesktop/Hal/devices/usb_device_58f_6362_058F312D81B_if0_scsi_host'
 (string)
  info.product = 'SCSI Host Adapter'  (string)
  scsi_host.host = 6  (0x6)  (int)
  info.bus = 'scsi_host'  (string)
  info.parent =
'/org/freedesktop/Hal/devices/usb_device_58f_6362_058F312D81B_if0'  (string)

udi = '/org/freedesktop/Hal/devices/storage_model_USB_SD_Reader'
  info.addons = {'hald-addon-storage'} (string list)
  block.storage_device =
'/org/freedesktop/Hal/devices/storage_model_USB_SD_Reader'  (string)
  info.udi = '/org/freedesktop/Hal/devices/storage_model_USB_SD_Reader'
 (string)
  block.is_volume = false  (bool)
  block.freebsd.cam_path = '6,0,0'  (string)
  storage.lun = 0  (0x0)  (int)
  storage.firmware_revision = '1.00'  (string)
  info.product = 'USB SD Reader'  (string)
  info.vendor = 'Generic'  (string)
  storage.vendor = 'Generic'  (string)
  storage.model = 'USB SD Reader'  (string)
  storage.physical_device =
'/org/freedesktop/Hal/devices/usb_device_58f_6362_058F312D81B_if0'  (string)
  storage.no_partitions_hint = false  (bool)
  storage.automount_enabled_hint = true  (bool)
  storage.media_check_enabled = true  (bool)
  storage.hotpluggable = true  (bool)
  storage.requires_eject = false  (bool)
  storage.removable = true  (bool)
  storage.drive_type = 'sd_mmc'  (string)
  storage.bus = 'usb'  (string)
  block.minor = 135  (0x87)  (int)
  block.major = 0  (0x0)  (int)
  block.device = '/dev/da0'  (string)
  info.category = 'storage'  (string)
  info.bus = 'block'  (string)
  info.capabilities = {'block', 'storage'} (string list)
  freebsd.unit = 0  (0x0)  (int)
  freebsd.driver = 'da'  (string)
  info.parent =
'/org/freedesktop/Hal/devices/usb_device_58f_6362_058F312D81B_if0_scsi_host_scsi_device_lun0'
 (string)

--------------Snippet #2, USB Flash Drive---------------------------

udi = '/org/freedesktop/Hal/devices/usb_device_58f_6387_AYBDZ52Y'
  info.udi = '/org/freedesktop/Hal/devices/usb_device_58f_6387_AYBDZ52Y'
 (string)
  freebsd.unit = 0  (0x0)  (int)
  freebsd.driver = 'umass'  (string)
  usb_device.num_interfaces = 1  (0x1)  (int)
  usb_device.can_wake_up = false  (bool)
  usb_device.vendor = 'Flash'  (string)
  usb_device.product = 'Drive AU_USB20'  (string)
  usb_device.serial = 'AYBDZ52Y'  (string)
  usb_device.device_revision_bcd = 323  (0x143)  (int)
  usb_device.vendor_id = 1423  (0x58f)  (int)
  usb_device.product_id = 25479  (0x6387)  (int)
  usb_device.version_bcd = 512  (0x200)  (int)
  usb_device.speed_bcd = 294912  (0x48000)  (int)
  usb_device.port_number = 2  (0x2)  (int)
  usb_device.num_ports = 0  (0x0)  (int)
  usb_device.max_power = 100  (0x64)  (int)
  usb_device.is_self_powered = false  (bool)
  usb_device.device_protocol = 0  (0x0)  (int)
  usb_device.device_subclass = 0  (0x0)  (int)
  usb_device.device_class = 0  (0x0)  (int)
  usb_device.num_configurations = 1  (0x1)  (int)
  usb_device.configuration_value = 1  (0x1)  (int)
  usb_device.bus_number = 1  (0x1)  (int)
  info.vendor = 'Flash'  (string)
  info.product = 'Drive AU_USB20'  (string)
  info.bus = 'usb_device'  (string)
  info.parent = '/org/freedesktop/Hal/devices/pci_10de_026e'  (string)

udi = '/org/freedesktop/Hal/devices/usb_device_58f_6387_AYBDZ52Y_scsi_host'
  info.udi =
'/org/freedesktop/Hal/devices/usb_device_58f_6387_AYBDZ52Y_scsi_host'
(string)
  info.product = 'SCSI Host Adapter'  (string)
  scsi_host.host = 6  (0x6)  (int)
  info.bus = 'scsi_host'  (string)
  info.parent =
'/org/freedesktop/Hal/devices/usb_device_58f_6387_AYBDZ52Y'  (string)

udi = '/org/freedesktop/Hal/devices/storage_serial___0'
  info.addons = {'hald-addon-storage'} (string list)
  block.storage_device =
'/org/freedesktop/Hal/devices/storage_serial___0'  (string)
  info.udi = '/org/freedesktop/Hal/devices/storage_serial___0'  (string)
  block.is_volume = false  (bool)
  storage.serial = '^_'  (string)
  block.freebsd.cam_path = '6,0,0'  (string)
  storage.lun = 0  (0x0)  (int)
  storage.firmware_revision = '8.07'  (string)
  info.product = 'Drive AU_USB20'  (string)
  info.vendor = 'Flash'  (string)
  storage.vendor = 'Flash'  (string)
  storage.model = 'Drive AU_USB20'  (string)
  storage.physical_device =
'/org/freedesktop/Hal/devices/usb_device_58f_6387_AYBDZ52Y_scsi_host_scsi_device_lun0'
 (string)
  storage.no_partitions_hint = false  (bool)
  storage.automount_enabled_hint = true  (bool)
  storage.media_check_enabled = true  (bool)
  storage.hotpluggable = false  (bool)
  storage.requires_eject = false  (bool)
  storage.removable = true  (bool)
  storage.drive_type = 'disk'  (string)
  storage.bus = 'scsi'  (string)
  block.minor = 152  (0x98)  (int)
  block.major = 0  (0x0)  (int)
  block.device = '/dev/da0'  (string)
  info.category = 'storage'  (string)
  info.bus = 'block'  (string)
  info.capabilities = {'block', 'storage'} (string list)
  freebsd.unit = 0  (0x0)  (int)
  freebsd.driver = 'da'  (string)
  info.parent =
'/org/freedesktop/Hal/devices/usb_device_58f_6387_AYBDZ52Y_scsi_host_scsi_device_lun0'
 (string)

-- 
Andriy Gapon


More information about the freebsd-gnome mailing list