OWFS Design
OWFS Features
OWFS Software
Examples & Usage
|
FAQ
- What does owfs do?
- 1-Wire
One-wire is a very simple (at least in hardware) communication scheme
developed by Dallas Semiconductor (now part of Maxim). It requires one a
communication
wire (and ground). Power can be stolen from the communication wire, and
the 1`-wire devices can uniquely identify and select themselves. 1-wire
devices are cheap, and have a variety of properties: identity, memory,
encryption, temperature, voltage, current sensing, and time keeping and
switching capabilities. Unfortunately the intricasies of each device
are a little arcane, and require carefule perusa; of the datasheet.
Thats where OWFS comes in. OWFS is a simple approach to the 1-wir
devices. All their properties are there, but presented in an intuitive
way. It will take one a few minutes to get a temperature reading, for
instance!
- What's the differnce between -wire and iButton.
iButtons are 1-wire devices
specially packaged in a steel can (think coin battery) direct use. The
rast of the 1-wire devices are standard integrated components in a
variety of chip sizes and configurations. The iButtons have some
limitations, for instance they can't have more than two electrical
onnections, but they are robust, and can hold a battery for persistent
staorage and opartion.
- File system model
- user-mode
- How do I get OWFS?
- Complete instructions
- Packages
The Software is packaged all together as "owfs" which includes source
to build:
owfs -- the filesystem interface using fuse
owhttpd -- the web server
owperl -- the OW perl package that makes a simple interface to the
1wire bus
owpython -- the OW Python package that makes a pythonic interface to
the
1wire bus
libow.so -- the dynamic library that actually talks to the bus
- CVS
The newest version can be pulled from the Sourceforge CVS
server.
- Daily configured packages.
Only needs "./configure" and "make install" -- avoids automake
difficulties.
- Other components
- Installation problems
- USB
- USB is a little tricky. Communication is done using libusb -- a popular user-mode
usb library (current version 0.18, though 0.17 is known to work).
- Newer kernels (2.6.8+) have a conflicting module ds9094r
which Peter Kropf found
must be disabled prior to running owfs (ow owhttpd, etc):
rmmod ds9490r
/opt/owfs/bin/owfs -u .......
- Getting owfs running
- Where is it?
The usual place for owfs installation is in the /opt/owfs directory.
/opt/owfs/bin holds the programs, and /opt/owfs/lib holds the library.
Thus to invoke owfs, you would enter
/opt/owfs/bin/owfs
and to start the web server
/opt/owfs/bin/owhttpd
- command line
- Startup scripts
- Debian
Peter Kropf posted his startup
scripts
- Redhat
Serg
Oskin's approach.
- inittab
See the cellar example for an inittab script
that starts (and restarts) the logging script.
- Tested platforms
- Major distributions:
- Debian Woody, Sid
Woody only works with daily packages, not cvs pull. (automake
problem).
- Fedora Core 1, 2 3
- Gentoo 1.3, 2004.2 2004.0 (from
Stuart Grimshaw)
Gentoo/OWFS Minit-Howto.
Make sure you have all the owfs dependencies installed, owfs was one
of the first things I installed on my Gentoo server after initial
setup was complete, so you may already have these installed.
emerge -v =sys-fs/fuse-1.4
you only need the latest stable (1.4 at the time
of writing.) Once you have emerged fuse, create /etc/fuse.conf and add
the line
user_allow_other
This lets you specify that other users can access the mounted owfs.
Next I had to emerge swig, but only if you want to build the wrapper
libraries for Perl, Python etc. If you don't want them, you can tell
./configure that you don't want them, and in that case you don't need
to emerge swig.
Now Install owfs as per the normal instructions.
I havn't figured out what permissions are needed on the various
devices to allow me to owfs as non-root.
- SuSE 8.0, 8.1, 8.2, 9.0 9.1 9.2*
* -- rmmod ds9094r (autodetected 1-wire module)
- Embedded systems
- MIPS Linksys
Wireless
Router
- Motorola Coldfire board
- Macintosh
- libusb is supported
under OS X
- Serial ports under OSX follow the same design (POSIX
compliance) as Linux. See this or this.
- FUSE is not supported, so owfs cannot be run (though owhttpd,
etc will work).
- C libraries
- glibc
- uClibc
- File system access
- What is FUSE?
A little digression to talk about FUSE.
Linux (and unix) model many parts of the operating system as a
filesystem. Not only are regular disk portions files, but so are serial
ports, console screens, digital cameras, etc. One unusual type of file
is a "virtual" file, which gets constructed on the fly from information
in memory. All the entries in the /proc and /sys directories are like
that.
Fuse is somewhere in between. a program is registered with fuse, and
any file operations to the directory it is mounted on are sent to the
fuse program.
- NFS
- 2.4 Kernel
Fuse cannot be re-exported using the NFS under the 2.4 series of
kernels. Update your system. Or use a user-space NFS. Or Samba.
- 2.6 Kernal
Fuse (and thus owfs) can be exported under NFS.
- SAMBA
OWFS can be exported under Samba (the windows network file system).
This means that Windows machines, and other SMB-compatible machines can
mount the 1-wire network remotely.
- Security
- Web server
The owfs webserver, owhttpd, is a relatively simple process. It
responds to the specified port, and interprets URLs very similar to
owfs file system names.
- Runs with other web servers?
Yes, as long a different port is specified.
- Security?
Should be good. Only apropriate URLs are accepted. The filesystem is
not actually read or written.
- Does it reque FUSE?
No.
- Does it require Linux?
Probably not. BSD and Mac OSX should work.
- Can it run simultaneously with owfs?
Unwise at present. They will step on each other. If you don't actually
do anything at the same time, it will be ok, but wait for the socket
model.
- Can I run APACHE (ROXEN, ..)
Yes and no. You should use the owfs file-system interface and either
read and manipulate the file-system directly, or through a cgi script.
- FTP
Under developement. The idea is for an anonymous ftp server. Although
any ftp server could work with a fuse-mounted filesystem (owfs), the
idea of owftpd would be to avoid fuse and thus be possible on non 2.4
and 2.6 kernels (older linux and BSD-derived).
- perl
- Package owperl. An interface to OWFS created with swig.
- Module name: OW
- configure with "./configure --enable-owperl" which is the
default
- Four functions:
- OW::init("device")
device is either the name of the serial port e.g. "/dev/ttyS0"
or "u" for USB
or (later) the TCP address:port of owserver
- OW::get("path")
path follows the same syntax as owfs
path looks like a file directory e.g.
/uncached/10.0123112112/temperature
uncached, alarm, simultaneous all supported
Return is the value, comma separated value list, or comma separated
directory elements
Returned directory elements will have a "/" at the end
- OW::put("path","value")
Path follows the same syntax as OW::get
put will not work for directories and read-only properties
put of non-writable paths is not an error, just ineffective
- OW::finish()
Probably optional
- Example -- Full tree listing
#!/usr/bin/perl -w
# OWFS test program
# See owfs.sourceforge.net for details
# {copyright} 2004 Paul H. Alfille
# GPL license
use OW ;
die (
"OWFS 1-wire tree perl program\n"
." by Paul Alfille 2004 see
http://owfs.sourceforge.net\n"
."Syntax:\n"
."\t$0 1wire-port\n"
." 1wire-port (required):\n"
."\t'u' for USB -or-\n"
."\t/dev/ttyS0 (or whatever) serial port\n"
) if ( $#ARGV != 0 ) ;
OW::init($ARGV[0]) or die "Cannot open 1wire port $ARGV[0]" ;
sub treelevel {
my $lev = shift ;
my $path = shift ;
my $res = OW::get($path) or return ;
for (split(',',$res)) {
for (1..$lev) { print("\t")
} ;
print $_ ;
if ( m{/$} ) {
print "\n" ;
treelevel($lev+1,$path.$_) ;
} else {
my
$r = OW::get($path.$_) ;
print ": $r" if defined($r) ;
print "\n" ;
}
}
}
treelevel(0,"/") ;
OW::finish() ;
Example -- one liners:
- Show the 1-wire bus (USB adapter)
perl -MOW -e "OW::init('u');print OW::get('/');"
- Show all the temperatures (serial bus)
perl -MOW -e"OW::init('/dev/ttyS1');my \$x;for \$x
(split(',',OW::get('/'))) { print OW::get(\$x.temperature) if
\$x=~m/^10/ };"
- Python
- Package owpython. An interface to OWFS created with swig.
- Module name: ow
- configure with "./configure --enable-owpython" which is the
default
- Four functions:
- ow.init( "device" )
device is either the name of the serial port e.g. "/dev/ttyS0"
or "u" for USB
or (later) the TCP address:port of owserver
- ow.finish()
Probably optional
- ow.Sensor( "path" )
Repersents a sensor on the 1-wire network. path follows the same syntax as owfs
path looks like a file directory e.g.
/uncached/10.0123112112/temperature
uncached, alarm, simultaneous all supported
- Example -- Full tree listing
#! /usr/bin/env python """ OWFS test program See owfs.sourceforge.net for details {copyright} 2005 Peter Kropf GPL license """
import sys import ow
def tree( sensor ): print '%7s - %s' % ( sensor._type, sensor._path ) for next in sensor.sensors( ): if next._type in [ 'DS2409', ]: tree( next ) else: print '%7s - %s' % ( next._type, next._path )
if __name__ == "__main__": if len( sys.argv ) == 1: print 'usage: tree.py u|serial_port_path' sys.exit( 1 ) else: ow.init( sys.argv[ 1 ] ) tree( ow.Sensor( '/' ) )
- Hardware resources
- Software resources
- Alternatives to OWFS
|