Attached is a new and improved description for setting up permissions via udev.
I had a problem on Fedora Core 6 where OW was using the
/dev/bus/usb/... file instead of the /proc/bus/usb/... file. I'm not
sure why. I suspect that it has something to do with libusb. Can
anyone provide some insight? And please try the instructions on
different Linux distributions so we can work through any issues.
- Peter
On 11/30/06, Peter Kropf <[EMAIL PROTECTED]> wrote:
Hold off on posting this. I'm having some troubles on a fedora core 6
system following the directions...
- Peter
On 11/30/06, Peter Kropf <[EMAIL PROTECTED]> wrote:
> No problem. Attached is an outline for the same process using udev.
>
> - Peter
>
>
> On 11/30/06, Paul Alfille <[EMAIL PROTECTED]> wrote:
> > See: http://www.owfs.org/index.php?page=hotplug
> >
> > Can I suggest a separate page for udev -- it would be less overwhelming.
> >
> > Paul Alfille
> >
> >
> > On 11/30/06, Peter Kropf <[EMAIL PROTECTED]> wrote:
> > > Hold off a bit on putting it on the web site. I'm updating it with
> > > instructions on also using udev. Hopefully this'll cover more users...
> > >
> > > - Peter
> > >
> > >
> > > On 11/30/06, Paul Alfille < [EMAIL PROTECTED]> wrote:
> > > > Very nicely summarized.
> > > >
> > > > I'll add it to the web wite. Is hotplug for 2.6 kernels as well as 2.4?
> > > >
> > > > Paul Alfille
> > > >
> > > > On 11/30/06, Jan Kandziora < [EMAIL PROTECTED]> wrote:
> > > > > Am Donnerstag, 30. November 2006 20:03 schrieb Peter Kropf:
> > > > > > I've written up a preliminary guide to extending the hotplug
> > subsystem
> > > > > > to automatically change the file owner and permissions on 1-Wire
> > > > > > controller.
> > > > > >
> > > > > >
> > > > > > Comments? Thought?
> > > > > >
> > > > > Shouldn't / Couldn't the same thing be achieved by adding some udev
> > rules?
> > > > >
> > > > > Kind regards
> > > > >
> > > > > Jan
> > > > > --
> > > > > "...Deep Hack Mode -- that mysterious and frightening state of
> > > > > consciousness where mortal users fear to tread.
> > > > > -- Matt Welsh
> > > > >
> > > > >
> > > >
> > -------------------------------------------------------------------------
> > > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > > Join SourceForge.net's Techsay panel and you'll get the chance to
> > share
> > > > your
> > > > > opinions on IT & business topics through brief surveys - and earn cash
> > > > >
> > > >
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > > > _______________________________________________
> > > > > Owfs-developers mailing list
> > > > > Owfs-developers@lists.sourceforge.net
> > > > >
> > > >
> > https://lists.sourceforge.net/lists/listinfo/owfs-developers
> > > > >
> > > >
> > > >
> > > >
> > -------------------------------------------------------------------------
> > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > > > opinions on IT & business topics through brief surveys - and earn cash
> > > >
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > >
> > > > _______________________________________________
> > > > Owfs-developers mailing list
> > > > Owfs-developers@lists.sourceforge.net
> > > >
> > https://lists.sourceforge.net/lists/listinfo/owfs-developers
> > > >
> > > >
> > > >
> > >
> > >
> > -------------------------------------------------------------------------
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > > opinions on IT & business topics through brief surveys - and earn cash
> > >
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > _______________________________________________
> > > Owfs-developers mailing list
> > > Owfs-developers@lists.sourceforge.net
> > >
> > https://lists.sourceforge.net/lists/listinfo/owfs-developers
> > >
> >
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share your
> > opinions on IT & business topics through brief surveys - and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >
> > _______________________________________________
> > Owfs-developers mailing list
> > Owfs-developers@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/owfs-developers
> >
> >
> >
>
>
>
Overview
========
There are times when access to the 1-Wire USB controller has to be
modified to allow a user other than root to have write access. This
article presents a simple way to use the Linux udev subsystem to
change the file ownership and permissions on the file associated with
a 1-Wire controller.
Udev Subsystem
--------------
The notes presented here are specific to the Linux udev subsystem and
it must be installed for it to work. Several leading-edge Linux
distributions have udev installed as part of the base system including
FedoraCore 6 and Suse 10.
If it's not installed on your system, see the documentation for that
version Linux for more details on how to install the udev subsystem.
USB Vendor and Product IDs
--------------------------
The USB vendor and product ids can be used by the udev subsystem to
identify which program is to be run when the device is plugged in.
If you don't know the vendor and product ids for the 1-Wire USB
controller you'll be using, you can use the lsusb program to find
them. If lsusb isn't installed (typically in /usr/sbin or /sbin)
you'll need to install the appropiate package for your Linux
distribution.
Once installed, run lsusb with the 1-Wire USB controlled plugged in:
$ /sbin/lsusb
Bus 001 Device 005: ID 04fa:2490 Dallas Semiconductor DS1490F 2-in-1 Fob,
1-Wire adapter
Bus 001 Device 001: ID 0000:0000
$
The 04fa is the vendor id and 2490 is the product id.
Unplug the 1-Wire USB controller.
Customize udev
--------------
With the vendor and product ids in hand, the udev subsystem can be
modified to change the file permissions and file ownership.
Create a new file called /etc/udev/rules.d/46_ds2490.rules. This will
contain the mapping of vendor / product id and the program to run. The
file should contain the following:
BUS=="usb", SYSFS{idVendor}=="04fa", SYSFS{idProduct}=="2490", \
GROUP="users", MODE="0774", \
PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i
$${K%%%%.*} $${K#*.}'", \
NAME="%c", RUN="/etc/udev/ds2490 '%c'"
Change the 0x04fa to the vendor id and 0x2490 to the product id for
your 1-Wire USB controller.
Create a new shell program called /etc/udev/ds2490. This will be the
program that is run. Here's a simple example of changing the file
group to ow and giving the group read and write access.
#! /bin/sh -x
MATCH="no"
if [ "$1" != "" ]; then
if [ -f /proc/$1 ]; then
chgrp ow /proc/$1 && \
chmod g+rw /proc/$1 && \
logger ow udev: group set to ow and permission g+rw on /proc/$1
MATCH="yes"
fi
if [ -e /dev/$1 ]; then
chgrp ow /dev/$1 && \
chmod g+rw /dev/$1 && \
logger ow udev: group set to ow and permission g+rw on /dev/$1
MATCH="yes"
fi
fi
if [ "$MATCH" = "no" ]; then
echo ow udev: no device file found for "$1"
logger ow udev: no device file found for "$1"
fi
The file has to be made executable via
chmod +x /etc/udev/ds2490
otherwise it will not be excuted by the udev subsystem.
Don't forget to add a group called ow and add users to the group.
Once this is setup, you can plug the 1-Wire USB controller into the
computer. After a bit, you should see a messages in the system log file
that looks like:
Nov 30 14:29:52 localhost logger: ow udev: group set to ow and permission
g+rw on /proc/bus/usb/001/006
Nov 30 14:29:52 localhost logger: ow udev: group set to ow and permission
g+rw on /dev/bus/usb/001/006
and that can be verified by
$ ls -l /proc/bus/usb/001/006 /dev/bus/usb/001/006
crw-rw---- 1 root ow 189, 12 Nov 30 14:29 /dev/bus/usb/001/006
-rw-rw-r-- 1 root ow 147 Nov 30 14:29 /proc/bus/usb/001/006
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers