Modifying mount points of USB Mass Storage devices

Bill Paxton goawaypleaseus at yahoo.com
Fri Dec 9 15:36:36 PST 2005


Hi.

I did figure out an admittedly redundant kludge-y way after talking with John off-list (thanks John!) It's probably not the right solution; nonetheless it works.

My (and yours, and probably everyones' similar) problem is that I kept trying to refer to keys from a "deeper" udi than it's parent. AFAICT this does not work or I cannot decipher the proper refer syntax. So what I did to get it to work is to just clone the relevant values "up" to a "higher" udi where they are accessable.

In my case, I'm trying to match at the volume udi. But I wanted to refer to keys in storage.physical_device... two "levels below" as it were. However inside the volume's udi I could only access block.storage_device keys.(it's direct parent). To get around it I just copy the needed keys from physical. to block. and then when I match on volume level keys I can have access to these values... problem solved.

As exampled below, any media mounted via USB device 0x123 from vendor 0x1234 with serial 012345 will /always/ mount to /media/permanent_mount_point regardless of it's size, label, format, uuid, etc.

Hope this helps you.
-BP

----
  <device>
   <match key="storage.bus" string="usb">
      <match key="@storage.physical_device:usb.vendor_id" int="0x1234">
      <match key="@storage.physical_device:usb.product_id" int="0x123">
      <match key="@storage.physical_device:usb.serial" string="012345">
          <merge key="usb.vendor_id" type="copy_property">@storage.physical_device:usb.vendor_id</merge>
         <merge key="usb.product_id" type="copy_property">@storage.physical_device:usb.product_id</merge>
         <merge key="usb.serial" type="copy_property">@storage.physical_device:usb.serial</merge>
       </match>
   </match>
   </match>
   </match>
  </device>

  <device>
    <match key="block.is_volume" bool="true">
    <match key="@block.storage_device:usb.vendor_id" int="0x1234">
    <match key="@block.storage_device:usb.product_id" int="0x123">
    <match key="@block.storage_device:usb.serial" string="012345">
      <merge key="volume.policy.desired_mount_point" type="string">permanent_mount_point</merge>
    </match>
    </match>
     </match>
    </match>
  </device>
----

--------------------------


"John (J5) Palmieri" <johnp at redhat.com> wrote: On Fri, 2005-12-09 at 13:59 +0100, vitko wrote:
> Bill Paxton wrote:
> 
> > I hate asking these kinds of questions, I've read the archives and 
> > googled for a couple days but I can't figure it out on my own. Sorry.
> > 
> > So here we have a USB Mass Storage camera. I can tickle udev to make a 
> > snazzy device name for it, that works well but it's just cosmetic. The 
> > big deal comes from the fdi entry and the mount point. I don't care if 
> > it's /dev/sd? but I do care where it gets mounted.
> 
> ...
> 
> > And it does make those entries in the corresponding udi when you check 
> > it with lshal. But that's not where the actual mount is; it's a parent 
> > device.
> 
> Bill, I have similar problems, I'm trying to enforce custom mountpoint
> /media/apacerht203 for my Apacer flash drive. My FDI is
> 
> $ cat /usr/share/hal/fdi/50user/apacer_ht203.fdi
>  
> 
> 
>    

So the first match (or first few matches) needs to be a match that is
unique to the level you wish to append the property to. The you must
match on keys relative to that level using the @: syntax
(i.e. ).  It is
best not to use info.parent because you can't be sure the parent won't
change in future releases but if there is no other UDI key that points
to the right level then this is the way to do it.   Sorry I don't have
any USB hardware to give a better example with but it is all at the
office and the weather is keeping me from going in today.  Check out the
storage policy fdi that ships with HAL for more insight.

>      
>        
>          
>            FooBarJustToTestMatchWorks
>            
> type="string">/media/apacerht203
>        
>      
>    
> 
> 
> but so far I failed to set it for correct object, as I don't know how
> to propagete it to volume object.
> 
> (Anyone willing to kick me in the right direction?)
> 
> Vit
> _______________________________________________
> hal mailing list
> hal at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/hal
-- 
John (J5) Palmieri 

_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



			
---------------------------------
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/hal/attachments/20051209/e183fe92/attachment.html


More information about the hal mailing list