On Fri, 15 Jun 2012, Oliver Fromme wrote:

Warren Block wrote:
> [...]
> > > > > attach 50 {
> [...]
>
> Even with those changes, devd is not triggering on my scanner attach:
>
>          match "subsystem" "DEVICE";
>          match "type" "ATTACH";
>          match "cdev" "ugen[0-9]+.[0-9]+";
>          match "vendor" "0x04b8";
>          match "product" "0x010a";
>          action "echo HERE! $cdev > /tmp/zoot";

Have you tried to put those lines inside a "notify" block
instead of an "attach" block?  The documentation is not
very clear about the difference between an "attach" block
an a "notify" block with $type=ATTACH, but it probably
wouldn't hurt to try both.

Well, it did work with an attach event. Progress: the event is seen with a notify event. However, something is not right with the execution of backticks in the action string:

notify 20 {
        match "subsystem" "DEVICE";
        match "type" "ATTACH";
        match "cdev" "ugen[0-9]+.[0-9]+";
        match "vendor" "0x04b8";
        match "product" "0x010a";
        action "devnum=`echo $cdev | sed -e 's/^ugen//'` && \
                echo $devnum > /tmp/example && \
                echo $cdev >> /tmp/example";
};

When the event is seen:
Executing 'devnum=`echo ugen0.6 | sed -e 's/^ugen//'` && echo devnum:  > /tmp/example 
&& echo cdev: ugen0.6 >> /tmp/example'

$devnum never gets a value, the contents of /tmp/example are:
  devnum:
  cdev: ugen0.6

Trying $() instead of backticks makes it worse:
Executing 'devnum=$(echo $cdev | sed -e 's/^ugen//') && echo devnum: $devnum > /tmp/example 
&& echo cdev: $cdev >> /tmp/example'

/tmp/example is then:
  devnum:
  cdev:
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Reply via email to