Linux Quicknet-Drivers-Howto
Quicknet Technologies, Inc. (www.quicknet.net)
Version 0.3.5  July 2, 1999

1.0  Introduction

This is a Pre-Alpha release version of the Linux driver for
the Quicknet Internet PhoneJACK and Internet LineJACK cards.  More
information about these cards is available at www.quicknet.net.
The driver version discussed in this document is 0.1.30.

These cards offer nice telco style interfaces to use your standard
telephone/key system/PBX as the user interface for VoIP applications.
The Internet LineJACK also offers PSTN connectivity for a single line
Internet to PSTN gateway.  Of course, you can add more than one card
to a system to obtain multi-line functionality.  At this time, the
driver supports the POTS port on both the Internet PhoneJACK and the
Internet LineJACK, but the PSTN port on the latter card is not yet
supported.

This document, and the drivers for the cards, are intended for a
limited audience that includes technically capable programmers who
would like to experiment with Quicknet cards.  

THE LINUX DRIVERS FOR QUICKNET CARDS ARE PRESENTLY IN A PRE-ALPHA
STATE AND SHOULD NOT BE CONSIDERED AS READY FOR NORMAL WIDESPREAD USE.

They are released early in the spirit of Internet development and to
make this technology available to innovators who would benefit from
early exposure.

When we promote the device driver to "beta" level it will be
considered ready for non-programmer, non-technical users.  Until then,
please be aware that these drivers may not be stable and may affect
the performance of your system.


1.1 Latest Additions/Improvements

The 0.1.30 version of the driver added support for the Internet
LineJACK cards POTS port and fixed several small bugs.  Refer to the
CHANGES file for details.


1.2 Copyright, Trademarks, Disclaimer, & Credits 

Copyright

Copyright (c) 1999 Quicknet Technologies, Inc.  Permission is granted
to freely copy and distribute this document provided you preserve it
in its original form. For corrections and minor changes contact the
maintainer at linux@quicknet.net.

Trademarks

Internet PhoneJACK and Internet LineJACK are registered trademarks of
Quicknet Technologies, Inc.

Disclaimer

Much of the info in this HOWTO is early information released by
Quicknet Technologies, Inc. for the express purpose of allowing early
testing and use of the Linux drivers developed for their products.
While every attempt has been made to be thorough, complete and
accurate, the information contained here may be unreliable and there
are likely a number of errors in this document. Please let the
maintainer know about them. Since this is free documentation, it
should be obvious that neither I nor previous authors can be held
legally responsible for any errors.

Credits

This HOWTO was written by:

	Greg Herlein <gherlein@quicknet.net>
	Ed Okerson <eokerson@quicknet.net> 


1.3  Future Plans: You Can Help 

Please let the maintainer know of any errors in facts, opinions,
logic, spelling, grammar, clarity, links, etc.  But first, if the date
is over a month old, check to see that you have the latest
version. Please send any info that you think belongs in this document.

You can also contribute code and/or bug-fixes for the sample
applications.


1.4  Where to get things

You can download the latest versions of the driver from:

http://www.quicknet.net/develop.htm

You can download the latest version of this document from:

http://www.quicknet.net/develop.htm


1.5  Mailing List

Quicknet operates a mailing list to provide a public forum on using
these drivers.

To subscribe to the linux-sdk mailing list, send an email to:

   majordomo@linux.quicknet.net

In the body of the email, type:

   subscribe linux-sdk <your-email-address>

Please delete any signature block that you would normally add to the
bottom of your email - it tends to confuse majordomo.

To send mail to the list, address your mail to 

   linux-sdk@linux.quicknet.net

Your message will go out to everyone on the list.

To unsubscribe to the linux-sdk mailing list, send an email to:

   majordomo@linux.quicknet.net

In the body of the email, type:

   unsubscribe linux-sdk <your-email-address>



2.0  Requirements

2.1  Quicknet Card(s)

You will need at least two Internet PhoneJACK or Internet LineJACK
cards (note that the present state of the driver supports only the
POTS port on the Internet LineJACK).  These are ISA bus devices that
use Plug-n-Play for configuration, and use no IRQs.  The driver will
support up to 16 cards in any one system, of any mix between the two
types.

Note that you will need two cards to do any useful testing, since
you will need a card on both ends of the connection.

2.2  ISAPNP

Since the Quicknet cards are Plug-n-Play devices, you will need the
isapnp tools package to configure the cards.  This package probably
came with your Linux distribution.  Documentation on this package is
available online at: 

http://mailer.wiwi.uni-marburg.de/linux/LDP/HOWTO/Plug-and-Play-HOWTO.html


3.0  Card Configuration 

The Internet PhoneJACK only has one configuration register that requires
16 IO ports.  The Internet LineJACK card has two configuration registers
and isapnp reports that IO 0 requires 16 IO ports and IO 1 requires 8.
The Quicknet driver assumes that these registers are configured to be
contiguous, i.e. if IO 0 is set to 0x340 then IO 1 should be set to 0x350.

Make sure that none of the cards overlap if you have multiple
cards in the system.

If you are new to the isapnp tools, you can jumpstart yourself by
doing the following:

   a.  run pnpdump to get a blank isapnp.conf file

	pnpdump > /etc/isapnp.conf

   b.  edit the /etc/isapnp.conf file to set the register IO addresses.

   c.  if you have multiple Quicknet cards, make sure that you do
not have any overlaps.  Be especially careful if you are mixing Internet
PhoneJACK and Internet LineJACK cards in the same system.


4.0 Driver and Test Software Installation

To install and load the driver, perform the following:

   a.  untar the distribution file.

   b.  run the "ixj_dev_create" script to remove any stray device
files left in the /dev directory, and to create the new officially
designated device files.

   c.  ensure that you have run the isapnp configuration utility to 
properly configure the cards.

   d.  copy the module to a common module directory.  We recommend
that you copy the driver to /lib/modules/<kernel-rev>/misc.  Our
current preferred location is /lib/modules/2.2.10/misc.

   e.  if you are loading the module by hand, use insmod.  An example
of this would look like this:

	insmod ixj io=0x300 ixjdebug=0

Then verify the module loaded by running lsmod.

   f.  if you are planning on using kerneld to automatically load the 
module for you, then you need to edit /etc/conf.modules and add the 
following lines:

	options ixj io=0x300 ixjdebug=0
	alias char-major-159 ixj

If you do this, then when you execute an application that uses the
module kerneld will load the module for you.  Note that to do this,
you need to have your kernel set to support kerneld.  You can check
for this by looking at /usr/src/linux/.config and you should see this:

	# Loadable module support
	#
	CONFIG_MODULES=y
	# CONFIG_MODVERSIONS is not set
	CONFIG_KMOD=y

  g.  if you want non-root users to be able to read and write to the 
ixj devices (this is a good idea!) you should do the following:

     - decide upon a group name to use and create that group if 
       needed.  Add the user names to that group that you wish to 
       have access to the device.  For example, we typically will
       create a group named "ixj" in /etc/group and add all users
       to that group that we want to run software that can use the 
       ixjX devices.

     - change the permissions on the device files, like this:
	
       chgrp ixj /dev/ixj*	
       chmod 660 /dev/ixj*
	
Once this is done, then non-root users should be able to use the
devices.  If you have enabled autoloading of modules, then the user
should be able to open the device and have the module loaded
automatically for them.
 

5.0  Example Code

There are several sample applications included with the driver to
demonstrate its use.

intercom.c - Demonstrates the drivers capability to pass audio between
multiple cards without passing the audio data through user space.  The
application only has to deal with telling which cards to talk to each
other, the driver does the rest.

inter2.c - Same concept as intercom.c, only passing the data through user
space.  In this example the application has to deal with reading and
writing to the device files to pass data between cards.

tpjackd.c - This is the server side of a very basic IP Telephony app.  It
simply waits on a TCP port for an incoming connection.  When it receives
it the phone rings.  When the phone is lifted it starts passing UDP
packets with audio data to the tpjack.c program.

tpjack.c - This is the client side that goes with tpjackd.c

dtmfread.c - This is sample code that shows how to use asynchronous
notification and how to read detected DTMF digits.

playtone.c - This is sample code that shows how to play DTMF tones.

busytone.c - This is sample code that shows how to play both busy and
ringback tones.

ixjasync.c - This is sample code that shows how to use asyncronous
notification.

record.c - This is sample code that shows how to record sound from the
phone handset.  The sound is recorded to a file that can be played
back with plaback.c (below).

playback.c - This is sample code that shows how to play back sound
samples to the handset.

jackopen.c - This is sample code that shows how to open the ixj device.

led.c - This is sample code that shows how to blink the LEDs on the
Internet LineJACK.


6.0  Use of the Driver

Follow the directions above to use the "ixj_dev_create" script to
create the necessary device files.  Modify the /etc/conf.modules file
as described above, and use modprobe or insmod to load the driver.


6.1  Test Applications

tpjackd - daemon application to listen for an incoming call

Use:  tpjackd dev port
dev - is the name of the device, usually "/dev/ixj0" - though if 
      there are multiple cards in the system it might be /dev/ixj1, etc.
port - the port that the daemon will listen to for an incoming ring

The daemon application now runs as a true daemon - it disconnects from
the controlling terminal upon startup and runs only in the background.
It logs messages to syslog.  Typical use during development is to use
an xterm window and put a "tail -f /var/log/messages" in use to watch
the logging.


tpjack - calling application

Use:  tpjack dev host port
dev - is the name of the device, usually "/dev/ixj0" - though if 
      there are multiple cards in the system it might be /dev/ixj1, 
      /dev/ixj2, etc.
host - the name of the host that is running the daemon (name,
      not ip address)  Note that the name of both hosts needs to be
      resolvable, either by DNS or local hosts files. 
port - the port that the daemon will listen to for an incoming ring


7.0  Known Limitations

We cannot currently play "dial-tone" and listen for DTMF digits at the
same time.  This is a bug in the DSP chip.  We have a work-around, but
it's not done yet.  Until then, if you want dial-tone, you can always
play a recorded dial-tone sound into the audio until you have gathered
the DTMF digits.  Yes, it's lame, but it's the best we can do with a
buggy DSP at this point.

Currently, the driver does not support non-blocking IO.  It does
support poll() and select() functionality though.  Other features will
be available soon.

You should not use various ioctl calls in the ixjuser.h file unless
you see them used in the sample code distributed with the driver.  Not
all the ioctls are implemented even though they are found in the
header file.

See the lates CHANGES files for other recent improvements or known
limitations.

















