LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   halevt does not pass mount-point to my script during OnInit (https://www.linuxquestions.org/questions/linux-desktop-74/halevt-does-not-pass-mount-point-to-my-script-during-oninit-794275/)

nemesis9 03-09-2010 12:32 PM

halevt does not pass mount-point to my script during OnInit
 
I am running halevt to support removable media for a custom system. I have an OnInit rule as follows: (OnInit means the device was already inserted before halevt was started)

<halevt:Device match="&MOUNTABLE; &amp; (!hal.volume.is_disc | hal.volume.is_disc=false)">
<halevt:OnInit exec='halevt-mount -u $hal.udi - m 002 ; usr/sbin/myProgram Add_Init USB "$hal.udi$ "$hal.volume.mount_point$'/>
</halevt:Device>

myProgram is called but the $hal.volume.mount_point$ is null. When I check in /media the device is mounted there. So why was I passed null for the mount point, is there some kind of race condition.

I have a similar rule for the case where a device is inserted after halevt is already started, and it works fine. That rule is for the case where a device gets a mount point, but in the case where halevt is started after a device is inserted, even that rule is not called.
Any ideas?

berbae 03-10-2010 08:57 AM

Try to separate the two actions, because I think halevt will be called another times when the device gets mounted :
Code:

<halevt:Device match="&MOUNTABLE; &amp; hal.volume.is_disc=false">
  <halevt:OnInit exec='halevt-mount -u $hal.udi$ - m 002'/>
</halevt:Device>

<halevt:Device match="hal.block.device &amp; hal.block.is_volume = true &amp; hal.volume.mount_point">
  <halevt:Property name="hal.volume.is_mounted">
      <halevt:Action value="true" exec='usr/sbin/myProgram Add_Init USB "$hal.udi$ "$hal.volume.mount_point$'/>
  </halevt:Property>
</halevt:Device>

You will have to adapt the second match conditions to execute myProgram only when it is required. The example above will run it each times any block device volume is mounted.
Also I don't know if you call your program with "usr/sbin" or "/usr/sbin";
and are you sure of the double quotes in :

myProgram Add_Init USB "$hal.udi$ "$hal.volume.mount_point$
?

I just realized you missed a $ in your exec line and the ; doesn't seem correct too :
<halevt:OnInit exec='halevt-mount -u $hal.udi - m 002 ; ...
instead of
<halevt:OnInit exec='halevt-mount -u $hal.udi$ - m 002 &amp;&amp; ...

Maybe it is enough to make your command to work.


All times are GMT -5. The time now is 01:24 PM.