hotplug to insert options like iocharset/codepage for Removable USB HD

David Zeuthen david at fubar.dk
Thu Nov 4 15:46:06 UTC 2004


On Thu, 2004-11-04 at 12:46 +0800, John Lin wrote:
> I got a 80GB Removable USB HD and on systems without udev and hotplug,
> I got /etc/fstab line below:
> /udev/sda              /mnt/sda                auto   
> iocharset=cp950,codepage=950    0 0
> 
> With FC3t3, I am trying to get hotplug system to automatically insert
> iocharset=cp950,codepage=950 option when device is plugged in.  How do
> I do that?  I am not familiar with hotplug system.  Where is the best
> place to insert this option?
> 
> Thank you in advanced!
> 

You want to create a file in /usr/share/hal/fdi/95userpolicy with this
content (filename needs to end in .fdi; you might want to call it my-
usb-harddisk.fdi)

<deviceinfo version="0.2">
  <device>
    <match key="block.is_volume" bool="true">
      <match key="volume.fsusage" string="filesystem">
        <match key="volume.uuid" string="4150-3F34">
          <merge key="volume.policy.mount_option.iocharset=cp950" type="bool">true</merge>
          <merge key="volume.policy.mount_option.codepage=cp950" type="bool">true</merge>
        </match>
      </match>
    </match>
  </device>
</deviceinfo>

and replace 4150-3F34 with the UUID of the filesystem on the usb device
in question. You may use either lshal or hal-device-manager (from the
hal-gnome package) to check what UUID to use. You may also want to check
on other properties than the uuid; e.g. perhaps use label.

Hope this helps,
David





More information about the test mailing list