Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Oct 2011 20:35:05 -0700
From:      Martin Alejandro Paredes Sanchez <mapsware@prodigy.net.mx>
To:        freebsd-questions@freebsd.org
Subject:   Re: Help with devd.conf
Message-ID:  <201110012035.05248.mapsware@prodigy.net.mx>
In-Reply-To: <20110924100418.50edc7ea@atomizer>
References:  <20110924100418.50edc7ea@atomizer>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday 24 September 2011 07:04:18 Rod Person wrote:
> I'm trying to understand devd.conf to auto mount usb devices. For
> example I have a usb drive that will show up as da1 so as a test I just
> want to write something to syslog when it is plugged in.
>
> This is what I have tried in devd.conf:
>
> notify 20{
> 	match "system"		"DEVFS";
> 	match "subsystem"	"CDEV";
> 	match "type"		"CREATE";
> 	match "cdev"		"da[1-9]+";
> 	action "logger you plugged in some usb device";
> };
>
> notify 20{
> 	match "system"		"USB";
> 	match "subsytem"	"DEVICE";
> 	match "type"		"ATTACH";
> 	action "logger some type of usb thing attached";
> };
>

I do not belive that the values of that variables are in upper case

To see what is happening in devd, try this

Create the file /usr/local/etc/devd/printvar.conf with

=============================
#
# Run devd in debug mode
#  devd -Dd
#

attach 0 {
        device-name "umass[0-9]+";
        
action "/usr/local/etc/devd/printvar.sh '$bus' '$cdev' '$cisproduct' '$cisvendor' '$class' '$device' '$device-name' '$function' '$manufacturer' '$notify' '$product' '$serial' '$slot' '$subvendor' '$subdevice' '$subsystem' '$system' '$type' '$vendor'";
};
=============================

Also, creat the file Create the file /usr/local/etc/devd/printvar.sh

=============================
#!/bin/sh
{
  echo "$# parametros"
  echo $@
  echo "bus          = $1"
  echo "cdev         = $2"
  echo "cisproduct   = $3"
  echo "cisvendor    = $4"
  echo "class        = $5"
  echo "device       = $6"
  echo "device-name  = $7"
  echo "function     = $8"
  echo "manufacturer = $9"
  shift 9
  echo "notify       = $1"
  echo "product      = $2"
  echo "serial       = $3"
  echo "slot         = $4"
  echo "subvendor    = $5"
  echo "subdevice    = $6"
  echo "subsystem    = $7"
  echo "system       = $8"
  echo "type         = $9"
  shift 1
  echo "vendor       = $9"
} > /tmp/VariablesDevd.txt
=============================

Check the content of /tmp/VariablesDevd.txt

You can also try this other advise for auto mount

http://networking.ringofsaturn.com/Unix/freebsdautomount.php



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