devd problem with 9-stable
Warren Block
wblock at wonkity.com
Fri Jun 15 17:21:03 UTC 2012
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:
More information about the freebsd-stable
mailing list