From owner-freebsd-bugs@FreeBSD.ORG Thu Mar 22 22:20:06 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40E1F1065673 for ; Thu, 22 Mar 2012 22:20:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 22CFE8FC2A for ; Thu, 22 Mar 2012 22:20:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q2MMK6nh087664 for ; Thu, 22 Mar 2012 22:20:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q2MMK5nl087663; Thu, 22 Mar 2012 22:20:05 GMT (envelope-from gnats) Date: Thu, 22 Mar 2012 22:20:05 GMT Message-Id: <201203222220.q2MMK5nl087663@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Stefan Balu Cc: Subject: Re: misc/166321: devd rule is not processed X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Stefan Balu List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 22:20:06 -0000 The following reply was made to PR misc/166321; it has been noted by GNATS. From: Stefan Balu To: Gary Palmer Cc: Subject: Re: misc/166321: devd rule is not processed Date: Thu, 22 Mar 2012 22:55:34 +0200 --e89a8ff1c378207e4c04bbdb2137 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable And i also tried changing the `attach` keyword into a `nomatch` rule. According to `devd.conf(8)`, a rule with a higher priority wins, so it should have matched before `usb.conf` file's rules. Trying with the full path to `chown` in the `action` statement doesn't seem to work either. This was my latest failure: [root@fw /usr/home/packardb]# cat /etc/devd/nut.conf attach 100 { device-name "ugen1.3"; match "vendor" "0x0665"; match "product" "0x5161"; action "/usr/sbin/chown uucp /dev/$device-name"; }; On Thu, Mar 22, 2012 at 10:27 PM, Stefan Balu wrote: > This doesn't seem to fix the problem. I forgot to mention that i also > thought it was a regex missmatch, and i've tried ugen[0-9.]+ and also > ugen[0-9\.] and i've also tried ugen[0-9]+.[0-9]+ with no luck. > > I thought the problem has to do with the `/etc/devd/usb.conf` file which > exists on 9.0 and didn't existed on 8.2. From the devd's debugging i see > that the last matched rule is: > > Testing bus=3Duhub3 against ^uhub[0-9]+ > Testing mode=3Dhost against ^host > Testing intclass=3D0x03 against ^0x03 > > which is present in the `usb.conf` file. > > I suspect that `devd`, for some reason, doesn't really try to match > against the rules from my `nut.conf` file. However, when `devd` starts in > debugging mode, it does mention parsing my file: > > [root@fw /usr/home/packardb]# devd -D -d > Parsing /etc/devd.conf > setting > scsi-controller-regex=3D(aac|adv|adw|aha|ahb|ahc|ahd|aic|amd|amr|asr|bt|c= iss|ct|dpt|esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm|wds)[0-9= ]+ > Parsing files in /etc/devd > Parsing /etc/devd/asus.conf > Parsing /etc/devd/uath.conf > Parsing /etc/devd/usb.conf > Parsing files in /usr/local/etc/devd > Parsing /usr/local/etc/devd/nut.conf > ... > > And i've also symlink()ed my `nut.conf` file in /etc/devd/ directory. > Still, no luck! > > > On Thu, Mar 22, 2012 at 8:24 PM, Gary Palmer wrote: > >> On Thu, Mar 22, 2012 at 06:01:48PM +0000, Stefan BALU wrote: >> > I have a UPS box which works like a charm with nut (netwok-ups-tools). >> In order for the nut driver to properly work, it needs the `/dev/ugen*` >> file to be owned by `uucp`. >> > >> > In order to do this, i have a `devd(8)` configuration file in >> `/usr/local/etc/devd/` entitled `nut.conf`. >> > >> > [root@fw ~]# cat /usr/local/etc/devd/nut.conf >> > attach 100 { >> > match "device-name" "ugen[0-9]+"; >> > match "vendor" "0x0665"; >> > match "product" "0x5161"; >> > action "logger chown uucp /dev/$device-name*"; >> > }; >> > >> > [root@fw ~]# usbconfig dump_device_desc >> > .. >> > ugen1.3: at usbus1, cfg=3D0 md= =3DHOST >> spd=3DLOW (1.5Mbps) pwr=3DON >> > >> >> The reason is in the above information. You are matching against >> "ugen[0-9]+" but the device is "ugen1.3". Note that [0-9]+ means one or >> more characters from the set of 0 through 9. No ".". Try fixing the >> ugen regular expression to allow for the ".". e.g. >> >> "ugen[0-9.]+" >> >> or >> >> "ugen[0-9]+.[0-9]+" >> >> Gary >> > > > > -- > =C8=98tefan B=C4=82LU > Tel: +40757 377 489 > --=20 =C8=98tefan B=C4=82LU Tel: +40757 377 489 --e89a8ff1c378207e4c04bbdb2137 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable And i also tried changing the `attach` keyword into a `nomatch` rule. Accor= ding to `devd.conf(8)`, a rule with a higher priority wins, so it should ha= ve matched before `usb.conf` file's rules. Trying with the full path to= `chown` in the `action` statement doesn't seem to work either.=C2=A0
This was my latest failure:

[r= oot@fw /usr/home/packardb]# cat /etc/devd/nut.conf=C2=A0
attach 1= 00 {
device-name "ugen1.3";
match= "vendor" "0x0665";
match "product" "0x5= 161";
actio= n "/usr/sbin/chown uucp /dev/$device-name";
};


On Thu, Mar 22, 2012 at 10:= 27 PM, Stefan Balu <balustefan@gmail.com> wrote:
This doesn't seem to fix the problem. I = forgot to mention that i also thought it was a regex missmatch, and i'v= e tried ugen[0-9.]+ and also ugen[0-9\.] and=C2=A0i've also tried ugen[= 0-9]+.[0-9]+ with no luck.

I thought the problem has to do with the `/etc/devd/usb.conf` fi= le which exists on 9.0 and didn't existed on 8.2. From the devd's d= ebugging i see that the last matched rule is:

Testing bus=3Duhub3 against ^uhub[0-9]+
Testing mode=3Dhost against ^host
Testing intclass=3D0x03 against ^0x03

which is present in the `usb.conf= ` file.

I suspect that `devd`, for some r= eason, doesn't really try to match against the rules from my `nut.conf`= file. However, when `devd` starts in debugging mode, it does mention parsi= ng my file:

[root@fw /usr/home/packardb]# devd -D -d
Parsing /etc/devd.conf
sett= ing scsi-controller-regex=3D(aac|adv|adw|aha|ahb|ahc|ahd|aic|amd|amr|asr|bt= |ciss|ct|dpt|esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm|wds)[0= -9]+
Parsing files in /etc/devd
=
Parsing /etc/devd/asus.conf
Parsing /etc/devd/uath.conf
Parsing /etc/devd/usb.conf
=
Parsing files in /usr/local/etc/devd
Parsing /usr/local/etc/devd/n= ut.conf
...

And i've also symlink()ed my `nut.con= f` file in /etc/devd/ directory. Still, no luck!


On Thu= , Mar 22, 2012 at 8:24 PM, Gary Palmer <gpalmer@freebsd.org> wrote:
On Thu, Mar 22, 2012 at 06:01:48PM +0000, Stefan BALU wrote:
> I have a UPS box which works like a charm with nut (netwok-ups-tools).= In order for the nut driver to properly work, it needs the `/dev/ugen*` fi= le to be owned by `uucp`.
>
> In order to do this, i have a `devd(8)` configuration file in `/usr/lo= cal/etc/devd/` entitled `nut.conf`.
>
> [root@fw ~]# cat /usr/local/etc/devd/nut.conf
> attach 100 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 match "device-name" "ugen[0= -9]+";
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 match "vendor" "0x0665"= ;;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 match "product" "0x5161&quo= t;;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 action "logger chown uucp /dev/$devic= e-name*";
> };
>
> [root@fw ~]# usbconfig dump_device_desc
> ..
> ugen1.3: <USB to Serial Cypress Semiconductor> at usbus1, cfg=3D= 0 md=3DHOST spd=3DLOW (1.5Mbps) pwr=3DON
>

The reason is in the above information. =C2=A0You are matching against
"ugen[0-9]+" but the device is "ugen1.3". =C2=A0Note th= at [0-9]+ means one or
more characters from the set of 0 through 9. =C2=A0No ".". =C2=A0= Try fixing the
ugen regular expression to allow for the ".". =C2=A0e.g.

"ugen[0-9.]+"

or

"ugen[0-9]+.[0-9]+"

Gary



--
=C8=98tefan B= =C4=82LU
Tel: +40757 377 489



--
=C8=98tefan = B=C4=82LU
Tel: +40757 377 489
--e89a8ff1c378207e4c04bbdb2137--