Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jun 2012 11:21:02 -0600 (MDT)
From:      Warren Block <wblock@wonkity.com>
To:        Oliver Fromme <olli@lurza.secnetix.de>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: devd problem with 9-stable
Message-ID:  <alpine.BSF.2.00.1206151053360.26334@wonkity.com>
In-Reply-To: <201206151433.q5FEXJC6073094@lurza.secnetix.de>
References:  <201206151433.q5FEXJC6073094@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1206151053360.26334>