Callout not called when USB disk removed?

Peter Valdemar Mørch swp5jhu02 at sneakemail.com
Mon Jul 10 09:34:36 PDT 2006


I have an external USB drive. The callout gets called/run on insert, but 
not on removal of the USB drive. Where did I go wrong? :D

details:

 > cat /etc/hal/fdi/policy/devLinks.fdi
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->

<deviceinfo version="0.2">
   <device>
     <match key="info.udi" 
string="/org/freedesktop/Hal/devices/storage_serial_Maxtor_4_D040H2_1200E000022237521">
       <append key="info.callouts.add" type="strlist">devLinks.pl</append>
     </match>
   </device>

All /usr/share/hal/scripts/devLinks.pl does is touch a file in /tmp. The 
file is touched when I insert the usb drive, but not when I remove it. I 
can see from

lshal --follow

that hal does notice both insert and remove, but the callout is not called.

In 2004, Sjoerd Simons (sjoerd at luon.net) posted
"[patch] Do callout when optical device is removed", patching 
hald/linux/block_class_device.c. The 0.5.7 changelog metions that this 
was renamed to volume_remove_from_gdl in 2004 but neither of these 
functions are present in the code any longer. (Looks like major 
refactoring has taken place along the way.)

Should I expect my callout to get called when I remove the USB disk? Is 
there any way I an make that happen?

Sincerely,

Peter

FYI:

Debian testing/etch (dist-upgraded today)

 > uname -a
Linux lyta 2.6.15.lyta #1 SMP PREEMPT Wed Jan 11 16:29:09 CET 2006 i686 
GNU/Linux

 > dpkg-query -W | grep hal
hal     0.5.7-2
hal-doc 0.5.7-2
hashalot        0.3-3
libhal1 0.5.7-2

 > lshal -l -u 
/org/freedesktop/Hal/devices/storage_serial_Maxtor_4_D040H2_1200E000022237521
udi = 
'/org/freedesktop/Hal/devices/storage_serial_Maxtor_4_D040H2_1200E000022237521'
   info.callouts.add = {'devLinks.pl'} (string list)
   block.storage_device = 
'/org/freedesktop/Hal/devices/storage_serial_Maxtor_4_D040H2_1200E000022237521' 
  (string)
   info.udi = 
'/org/freedesktop/Hal/devices/storage_serial_Maxtor_4_D040H2_1200E000022237521' 
  (string)
   storage.requires_eject = false  (bool)
   storage.hotpluggable = true  (bool)
   info.capabilities = {'storage', 'block'} (string list)
   info.category = 'storage'  (string)
   info.product = 'D040H2'  (string)
   info.vendor = 'Maxtor 4'  (string)
   storage.removable = false  (bool)
   storage.physical_device = 
'/org/freedesktop/Hal/devices/usb_device_d49_3000_1200E000022237521_if0' 
  (string)
   storage.lun = 0  (0x0)  (int)
   storage.firmware_version = 'DAK0'  (string)
   storage.serial = 'Maxtor_4_D040H2_1200E000022237521'  (string)
   storage.vendor = 'Maxtor 4'  (string)
   storage.model = 'D040H2'  (string)
   storage.drive_type = 'disk'  (string)
   storage.automount_enabled_hint = true  (bool)
   storage.media_check_enabled = false  (bool)
   storage.no_partitions_hint = false  (bool)
   storage.bus = 'usb'  (string)
   block.is_volume = false  (bool)
   block.minor = 16  (0x10)  (int)
   block.major = 8  (0x8)  (int)
   block.device = '/dev/sdb'  (string)
   linux.hotplug_type = 3  (0x3)  (int)
   info.parent = 
'/org/freedesktop/Hal/devices/usb_device_d49_3000_1200E000022237521_if0_scsi_host_scsi_device_lun0' 
  (string)
   linux.sysfs_path_device = '/sys/block/sdb'  (string)
   linux.sysfs_path = '/sys/block/sdb'  (string)


-- 
Peter Valdemar Mørch
http://www.morch.com


More information about the hal mailing list