[zaptel-commits] tzafrir: branch 1.4 r4631 - in /branches/1.4/kernel/xpp: ./ firmwares/ utils/...

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Thu Mar 19 15:08:34 CDT 2009


Author: tzafrir
Date: Thu Mar 19 15:08:29 2009
New Revision: 4631

URL: http://svn.digium.com/svn-view/zaptel?view=rev&rev=4631
Log:
xpp: a massive backport from DAHDI. From Xorcom branch-rel-6839-r6908 .

Sun Mar  1 2009 Oron Peled <oron at actcom.co.il> - xpp.r6795
  * Fix cases where the command_queue overflowed during initialization.
    - Also add a 'command_queue_length' parameter to xpp.ko
  * More migrations to sysfs:
    - Add a 'transport' attribute to our astribank devices which
      points to the usb device we use. E.g:
       /sys/bus/astribanks/devices/xbus-00/transport is symlinked to
       ../../../../../../devices/pci0000:00/0000:00:10.4/usb5/5-4
    - Move /proc/xpp/XBUS-??/XPD-??/span to
      /sys/bus/xpds/devices/??:?:?/span
    - Migrate from /proc/xpp/sync to:
      /sys/bus/astribanks/drivers/xppdrv/sync
    - New 'offhook' attribute in:
      /sys/bus/xpds/devices/??:?:?/offhook
  * PRI: change the "timing" priority to match the convention used by
         other PRI cards -- I.e: lower numbers (not 0) have higher
	 priority.
  * FXO: 
    - Power denial: create two module parameters instead of hard-coded
      constants (power_denial_safezone, power_denial_minlen).
      For sites that get non-standard power-denial signals from central
      office on offhook.
    - Don't hangup on power-denial, just notify Dahdi and wait for
    - Fix caller-id detection for the case central office sends it before
      first ring without any indication before.
      Asterisk's desicion.
Mon, Dec  8 2008 Oron Peled <oron at actcom.co.il> - xpp.r6430
  * PRI:
    - Match our span clocking priorities (in system.conf)
      to Digium -- this is a reversal of the previous state.
      Now lower numbers (greater than 0) are better.
    - Synchronization fixes for PRI ports other than 0.
    - Fix T1 CRC for some countries (e.g: China).
  * FXS: fix bug in VMWI detection if using old asterisk
    which does not provide ZT_VMWI ioctl().
  * FXO:
    - Improve caller_id_style module parameter. This provide a workaround
      for countries that send this information without any notification
      (reverse polarity, ring, etc.)
    - Don't force on-hook upon power-denial. So, loopstart devices
      would ignore these as expected.
  * Implement a flow-control to prevent user space (init_card_* scripts)
    from pressuring our command queue.

Added:
    branches/1.4/kernel/xpp/XppConfig.pm   (with props)
    branches/1.4/kernel/xpp/utils/genconf_parameters   (with props)
    branches/1.4/kernel/xpp/utils/migrate_xpp   (with props)
    branches/1.4/kernel/xpp/utils/waitfor_xpds   (with props)
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Config/Gen/
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Config/Gen.pm   (with props)
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Config/Gen/Unicall.pm   (with props)
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Config/Gen/Users.pm   (with props)
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Config/Gen/Zapata.pm   (with props)
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Config/Gen/Zaptel.pm   (with props)
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Config/Params.pm   (with props)
    branches/1.4/kernel/xpp/xpp.conf   (with props)
Modified:
    branches/1.4/kernel/xpp/.version
    branches/1.4/kernel/xpp/Changelog_xpp
    branches/1.4/kernel/xpp/Kbuild
    branches/1.4/kernel/xpp/README.Astribank
    branches/1.4/kernel/xpp/card_bri.c
    branches/1.4/kernel/xpp/card_fxo.c
    branches/1.4/kernel/xpp/card_fxs.c
    branches/1.4/kernel/xpp/card_global.c
    branches/1.4/kernel/xpp/card_global.h
    branches/1.4/kernel/xpp/card_pri.c
    branches/1.4/kernel/xpp/firmwares/FPGA_1141.hex
    branches/1.4/kernel/xpp/firmwares/FPGA_1151.hex
    branches/1.4/kernel/xpp/firmwares/FPGA_FXS.hex
    branches/1.4/kernel/xpp/firmwares/USB_FW.hex
    branches/1.4/kernel/xpp/init_card_1_30
    branches/1.4/kernel/xpp/init_card_2_30
    branches/1.4/kernel/xpp/init_card_3_30
    branches/1.4/kernel/xpp/init_card_4_30
    branches/1.4/kernel/xpp/utils/Makefile
    branches/1.4/kernel/xpp/utils/astribank_hook
    branches/1.4/kernel/xpp/utils/genzaptelconf
    branches/1.4/kernel/xpp/utils/print_modes.c
    branches/1.4/kernel/xpp/utils/test_parse.c
    branches/1.4/kernel/xpp/utils/xpp_sync
    branches/1.4/kernel/xpp/utils/zapconf
    branches/1.4/kernel/xpp/utils/zaptel_drivers
    branches/1.4/kernel/xpp/utils/zconf/Zaptel.pm
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Chans.pm
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Config/Defaults.pm
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Span.pm
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Xpp.pm
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Xpp/Line.pm
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm
    branches/1.4/kernel/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm
    branches/1.4/kernel/xpp/utils/zt_registration
    branches/1.4/kernel/xpp/xbus-core.c
    branches/1.4/kernel/xpp/xbus-core.h
    branches/1.4/kernel/xpp/xbus-pcm.c
    branches/1.4/kernel/xpp/xbus-pcm.h
    branches/1.4/kernel/xpp/xbus-sysfs.c
    branches/1.4/kernel/xpp/xdefs.h
    branches/1.4/kernel/xpp/xframe_queue.c
    branches/1.4/kernel/xpp/xframe_queue.h
    branches/1.4/kernel/xpp/xpd.h
    branches/1.4/kernel/xpp/xpp_usb.c
    branches/1.4/kernel/xpp/xpp_zap.c
    branches/1.4/kernel/xpp/xpp_zap.h
    branches/1.4/kernel/xpp/xproto.c
    branches/1.4/kernel/xpp/xproto.h
    branches/1.4/kernel/xpp/zap_debug.h

Modified: branches/1.4/kernel/xpp/.version
URL: http://svn.digium.com/svn-view/zaptel/branches/1.4/kernel/xpp/.version?view=diff&rev=4631&r1=4630&r2=4631
==============================================================================
--- branches/1.4/kernel/xpp/.version (original)
+++ branches/1.4/kernel/xpp/.version Thu Mar 19 15:08:29 2009
@@ -1,1 +1,1 @@
-branch-rel-6171-r6408
+branch-rel-6839-r6908

Modified: branches/1.4/kernel/xpp/Changelog_xpp
URL: http://svn.digium.com/svn-view/zaptel/branches/1.4/kernel/xpp/Changelog_xpp?view=diff&rev=4631&r1=4630&r2=4631
==============================================================================
--- branches/1.4/kernel/xpp/Changelog_xpp (original)
+++ branches/1.4/kernel/xpp/Changelog_xpp Thu Mar 19 15:08:29 2009
@@ -1,3 +1,84 @@
+Sun Mar  1 2009 Oron Peled <oron at actcom.co.il> - xpp.r6795
+  * Fix cases where the command_queue overflowed during initialization.
+    - Also add a 'command_queue_length' parameter to xpp.ko
+  * More migrations to sysfs:
+    - Add a 'transport' attribute to our astribank devices which
+      points to the usb device we use. E.g:
+       /sys/bus/astribanks/devices/xbus-00/transport is symlinked to
+       ../../../../../../devices/pci0000:00/0000:00:10.4/usb5/5-4
+    - Move /proc/xpp/XBUS-??/XPD-??/span to
+      /sys/bus/xpds/devices/??:?:?/span
+    - Migrate from /proc/xpp/sync to:
+      /sys/bus/astribanks/drivers/xppdrv/sync
+    - New 'offhook' attribute in:
+      /sys/bus/xpds/devices/??:?:?/offhook
+  * PRI: change the "timing" priority to match the convention used by
+         other PRI cards -- I.e: lower numbers (not 0) have higher
+	 priority.
+  * FXO: 
+    - Power denial: create two module parameters instead of hard-coded
+      constants (power_denial_safezone, power_denial_minlen).
+      For sites that get non-standard power-denial signals from central
+      office on offhook.
+    - Don't hangup on power-denial, just notify Dahdi and wait for
+    - Fix caller-id detection for the case central office sends it before
+      first ring without any indication before.
+      Asterisk's desicion.
+  * New USB_FW.hex (xpp.r6885): handles some firmware rewriting races.
+
+Mon, Dec  8 2008 Oron Peled <oron at actcom.co.il> - xpp.r6430
+  * PRI:
+    - Match our span clocking priorities (in system.conf)
+      to Digium -- this is a reversal of the previous state.
+      Now lower numbers (greater than 0) are better.
+    - Synchronization fixes for PRI ports other than 0.
+    - Fix T1 CRC for some countries (e.g: China).
+  * FXS: fix bug in VMWI detection if using old asterisk
+    which does not provide ZT_VMWI ioctl().
+  * FXO:
+    - Improve caller_id_style module parameter. This provide a workaround
+      for countries that send this information without any notification
+      (reverse polarity, ring, etc.)
+    - Don't force on-hook upon power-denial. So, loopstart devices
+      would ignore these as expected.
+  * Implement a flow-control to prevent user space (init_card_* scripts)
+    from pressuring our command queue.
+
+Thu, Oct 30 2008 Oron Peled <oron at actcom.co.il> - xpp.r6279
+  * Major changes in hotplug architecture (backported from our DAHDI
+    drivers). It entails migration to proper sysfs representation.
+    and implementing a proper state machine for Astribanks.
+  * Astribanks are now represented in /sys/bus/astribanks/devices/*
+  * XPD's are now represented in /sys/bus/xpds/devices/*
+  * Old /proc interfaces:
+    - Some debugging info was left there (not affecting device functioning
+      and does not fit sysfs model).
+    - All the rest can be compiled in by -DOLD_PROC in Kbuild.
+    - The perl scripts and their zconf/ modules abstract this change
+      and fallback to /proc if no /sys interface is found (with a warning).
+  * Astribank state:
+    - May be read from /sys/bus/astribanks/devices/xbus-*/xbus_state
+    - Writing stop/start into these file, initiate a logical
+      disconnect/connect event (without physical access to AB).
+  * Kill the race conditions that were inherent during AB initialization
+    in the old method (at least those known to us). Using the /proc
+    interface is racy by definition.
+  * Send two new udev events (apart from add/remove):
+    - "online" - when the Astribank is initialized and ready.
+    - "offline" - when the Astribank start going down.
+    - They can be used in the example astribank_hook udev script.
+
+Thu, Oct 30 2008 Oron Peled <oron at actcom.co.il> - xpp.r6276
+  * Important firmware change:
+    - The protocol version of FPGA_*.hex firmwares is still 30,
+      so old firmwares still work.  However, the firmware loading is modified.
+      This add some functionality to fpga_load and affect how xpp_fxloader calls it.
+    - New USB_FW.hex fixes problems observed during boot with some BIOS'es.
+    - libhexfile now read the version info (if available in the hex
+      comments) and fpga_load displays it.
+    - PRI: fix some scenarious where firmware would send bogus CAS updates
+      when no CAS is used.
+
 Thu, Aug 14 2008 Oron Peled <oron at actcom.co.il> - xpp.r6055
   * Added E1 CAS support. Uses new firmware.
   * New firmware also solve DTMF problems with some phones (double digits).

Modified: branches/1.4/kernel/xpp/Kbuild
URL: http://svn.digium.com/svn-view/zaptel/branches/1.4/kernel/xpp/Kbuild?view=diff&rev=4631&r1=4630&r2=4631
==============================================================================
--- branches/1.4/kernel/xpp/Kbuild (original)
+++ branches/1.4/kernel/xpp/Kbuild Thu Mar 19 15:08:29 2009
@@ -8,10 +8,9 @@
 			-I$(ZAP_KERNEL)	\
 			-DDEBUG			\
 			-DPOLL_DIGITAL_INPUTS	\
-			-DWITH_ECHO_SUPPRESSION	\
 			-DDEBUG_PCMTX		\
 			-DPROTOCOL_DEBUG	\
-			-g
+			-g # -DOLD_PROC
 			#
 
 ifneq	(,$(shell grep -w echo_can_state_t $(ZAP_KERNEL)/zaptel.h))

Modified: branches/1.4/kernel/xpp/README.Astribank
URL: http://svn.digium.com/svn-view/zaptel/branches/1.4/kernel/xpp/README.Astribank?view=diff&rev=4631&r1=4630&r2=4631
==============================================================================
--- branches/1.4/kernel/xpp/README.Astribank (original)
+++ branches/1.4/kernel/xpp/README.Astribank Thu Mar 19 15:08:29 2009
@@ -7,18 +7,43 @@
 The drivers reside in a separate subdirectory, kernel/xpp/ .
 
 It is generally a more technical document than the 
-http://www.xorcom.com/documentation/manuals/[Astribank User Manual]
+http://www.xorcom.com/product-manuals/product-manuals.html[Astribank 
+User Manual]
 
 An HTML version of the latest version of this document could be found at 
-http://zaptel.tzafrir.org.il/README.Astribank.html[]
+http://docs.tzafrir.org.il/README.Astribank.html[]
+
+Introduction
+------------
+The Xorcom Astribank is a USB-connected channel-bank. An Astribank may
+have up to 4 modules:
+
+PRI:: 
+  1, 2 or 4 ports of E1 or T1. Can only be the first (left-most) module
+  of the Astribank. Note that each port has physically a pair of ports,
+  where the top one has crossed wiring.
+
+BRI::
+  2, 4 or 8 ports of BRI. Can only be used as the first (left-most)
+  module of the Astribank. 
+
+FXO::
+  8 ports of FXO (connector to an analog PSTN line).
+
+FXS::
+  8 ports of FXS (connector to an analog phone). If used as the first
+  (left-most) module, it will also have 2 output lines and 4 input lines
+  that will appear on Zaptel like standard Zaptel ports. The input and
+  output ports are connected from the two RJ-45 connectors on the right
+  side of the module.
+
+There is also a 6FXS-2FXO module that is essentially an FXS module with
+six lines instead of 8 (but still with the input and output ports) and
+an FXO module of two ports.
+
 
 Building and Installation
 -------------------------
-Building and installation is basically like the normal procedure of 
-installing Zaptel with some additions.
-
-Building drivers
-~~~~~~~~~~~~~~~~
 Apart from the standard Zaptel build requirements, you also need libusb
 development headers to build the fpga_load firmware loader. This is
 typically the package libusb-dev on Debian (and derivatives like Ubuntu)
@@ -29,16 +54,96 @@
 
   make -C xpp/utils install
 
-Though this should be done automatically on Zaptel >= 1.4.1 .
+
+Patch for BRI
+~~~~~~~~~~~~~
+In order for the BRI module (xpd_bri.ko) to build, you still need an
+external patch: 
+
+http://updates.xorcom.com/astribank/bristuff/1.4/bristuff-current/patches/zaptel/bri_dchan[]
+
+You need to apply it to the zaptel tarball before building:
+
+  wget
+  http://updates.xorcom.com/astribank/bristuff/1.4/bristuff-current/patches/zaptel/bri_dchan
+  patch -p1 <http://updates.xorcom.com/astribank/bristuff/1.4/bristuff-current/patches/zaptel/bri_dchan
+
+Note, however, that you would still need a bristuffed Asterisk.
+Therefore chances are that you will still need the full BriSTUFF
+distribution from http://updates.xorcom.com/astribank/bristuff/1.4[] .
+
+
+Installation Scenarios
+~~~~~~~~~~~~~~~~~~~~~~
+Below are some commented sequences of commands that can be used at some
+common scenarios. Those scenarios begin only after you installed the
+software (Zaptel, asterisk, etc.).
+
+New Installation Scenario
+^^^^^^^^^^^^^^^^^^^^^^^^^
+Installing Astribank on a system where there's no existing Astribank.
+You install the driver when the Astribank was already connected:
+
+--------------------------------------------
+# If you had the hardware already connected: Load just the USB firmware
+/usr/share/zaptel/xpp_fxloader usb
+# (you could use 'load' instead of 'usb' but this is also a good test
+# that automatic load through firmware is also in place)
+zaptel_hardware -v
+# wait until the Astribank has a product ID of 11x2
+sleep 5 # Just wait a little bit 
+zaptel_hardware -v # now that you see that all's well:
+/etc/init.d/zaptel start
+# generate configuration:
+zapconf
+# Apply it:
+ztcfg
+# edit /etc/asterisk/zapata.conf to #include zaptel-channels.conf or
+# copy its content to the end of zapata.conf
+#
+# This stops existing Zaptel calls, if any, but does no other harm:
+asterisk -rx 'zap restart' 
+--------------------------------------------
+
+
+Upgrade Scenario
+^^^^^^^^^^^^^^^^
+Upgrading is roughly the same as a new installation. But in many cases 
+you begin with  resetting the firmware.
+
+I also assume here that the configuration is valid, and hence I don't
+generate it.
+
+Also be sure to use latest /etc/init.d/zaptel from zaptel.init in the
+source tree. Specifically one that uses the script
+/usr/share/zaptel/waitfor_xpds rather than directly looking at
+waitfor_xpds under /proc which no longer works.
+
+--------------------------------------------
+# If you need to reset the firmware:
+/usr/share/zaptel/xpp_fxloader reset
+# (you could use 'load' instead of 'usb' but this is also a good test
+# that automatic load through firmware is also in place)
+zaptel_hardware -v
+# wait until the Astribank has a product ID of 11x2
+sleep 5 # Just wait a little bit
+zaptel_hardware -v # now that you see that all's well:
+/etc/init.d/zaptel start
+#
+# This stops existing Zaptel calls, if any, but does no other harm:
+asterisk -rx 'zap restart' 
+--------------------------------------------
 
 
 Sample Configurations
 ---------------------
 We generally recommend to generate the configuration by using utility
-genzaptelconf or zapconf which are included with Zaptel. Nevertheless,
-the following can serve as reference configurations for a system where 
-Astribank devices are used.
-
+zapconf or genzaptelconf (obsolete and non-optimal) which are included 
+with Zaptel. Nevertheless, the following can serve as reference 
+configurations for a system where Astribank devices are used.
+
+Also refer to the general README for documentation of the other Zaptel
+configuration files.
 
 Zaptel Init Configuration File
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -50,19 +155,6 @@
 -----------------------------------------------------------
 # Lines beginning with '#' are considered comments and ignored.
 
-# A two-letter country code. genzaptelconf uses it to better guess 
-# the configuration it generates. E.g: the signalling of E1 spans, and 
-# a few other country-specific settings.
-#lc_country=us
-
-# See genzaptelconf(8) and the script itself for a longer list of 
-# variables.
-
-# Equivalent to the parameter opermode to the module wctdm: country-specific
-# settings to the FXO lines. For a complete list of possible values, see
-# /usr/share/zaptel/init_fxo_mode .
-#opermode=FRANCE
-
 # xpp_sync runs with the value of 'XPP_SYNC' as its parameter to set the
 # synchronization source. The default is 'auto' that selects the best
 # Astribank. 'ZAPTEL' gets synchronization from the Zaptel sync master
@@ -73,18 +165,49 @@
 #XPP_HOTPLUG_DISABLED=yes
 #
 
+# genzaptelconf also reads a number of extra parameters from here. Refer 
+# to the script itself (/usr/sbin/genzaptelconf). However it is
+# generally recommended to use zapconf (which reads configuration from
+# /etc/genconf_parameters).
+
 # Disables udev hook called when an Astribank is added and ready
-# or removed.
+# or removed. Though it is disabled by default with recent configuration
+# anyway.
 #ASTRIBANK_HOOK_DISABLED=yes
-
-# Setup for the Astribank PRI module:
-# All the ports in the unit connected to the USB port 0000:00:1d.7-1
-# will be NT and E1. Ports no. 1 and 3 of all the other Astribanks will 
-# be NT and E1 (and thus ports 0 and 2 will be TE and E1).
-#XPP_PRI_SETUP='
-#	CONNECTOR/usb-0000:00:1d.7-1/XPD-01=NT,E1
-#	NUM/*/XPD-0[13]=NT,E1
-#	'
+-----------------------------------------------------------
+
+
+xpp.conf: Astribank Initialization
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+/etc/xpp.conf is read by the initialization scripts of Astribank
+modules:
+-----------------------------------------------------------
+# /etc/xpp.conf
+#
+# This file is used to configure the operation
+# of init_card_* initialization scripts.
+#
+
+# Adds many more tracing messages that are sent to syslog:
+#debug		1
+
+# xpd_pri: E1 or T1. The default is E1 for all the ports.
+#   Setting T1 instead:
+#pri_protocol	T1
+#
+#  Or if you actually want to mix E1 and T1:
+#pri_protocol/xbus-00/xpd-02	T1
+#pri_protocol/connector:usb-0000:00:1d.7-7/xpd-03	T1
+#pri_protocol/label:usb:0000183/xpd-03	T1
+# If several definitions can refer to a port, the last wins. 
+# If none applies, the default of E1 holds.
+
+#  FXO: country to adjust settings to:
+#opermode	FRANCE
+
+#  Don't run power calibration on the FXS units. This can save time
+#  but can also get you unit randomly disconnect, if badly used:
+#fxs_skip_calib	1
 -----------------------------------------------------------
 
 /etc/zaptel.conf
@@ -308,10 +431,10 @@
 -----------------------------------------------------------
 [phones-zap]
 ; 6001 will dial to channel 1, 6020, to Zaptel channel 20, etc.
-exten => _6XXX,1,Dial(ZAP/${EXTEN:1})
+exten => _6XXX,1,Dial(Zap/${EXTEN:1})
 ; Useful for debugging trunks. Will potentially allow users to
 ; bypass context limitations.
-;exten => _6XXX.,1,Dial(ZAP/${EXTEN:1:3}/${EXTEN:4})
+;exten => _6XXX.,1,Dial(Zap/${EXTEN:1:3}/${EXTEN:4})
 
 [trunk]
 ; A number that begins with 9: dial it through a trunk
@@ -373,8 +496,6 @@
 ; of their own. Sending them to a context of their on makes 
 ; 'zap show channels' in the CLI provide useful display, though.
 -----------------------------------------------------------
-
-
 
 
 Troubleshooting
@@ -410,7 +531,7 @@
 
 Zaptel Registration
 ~~~~~~~~~~~~~~~~~~~
-Check if the Astribank spans are registered in Zaptel
+Check if the Astribank spans are registered with Zaptel
 
   zt_registration
 
@@ -423,9 +544,6 @@
 - Registration is normally done as part of `/etc/init.d/zaptel start`.
   If you want to register the spans manually, then run command:
   `zt_registration on` .
-- Disabling of the automatic Astribank spans registration give you full
-  control on the order of Zaptel spans. See the module parameter
-  **zap_autoreg** for the further details.
 
 
 Zaptel Level Information
@@ -448,7 +566,7 @@
 
      42 FXS
 
-- When a channel has been configured with *ztcfg* (that applies
+- When *ztcfg* has applied the configuration of the channel (from 
   /etc/zaptel.conf), you will see an extra column for the signalling
   type of the channel. The same channel after it has been configured:
 
@@ -597,7 +715,7 @@
 
 Alternatively: an initialization script fails and gives the error
 
-  An '/etc/default/zaptel' collides with 'etc/sysconfig/zaptel'
+  An '/etc/default/zaptel' collides with '/etc/sysconfig/zaptel'
 
 .Cause:
 /etc/default/<service name> is the place used in Debian-based 
@@ -614,6 +732,31 @@
 .Fix:
 Remove one of those two. There should be no reason to have both on the
 same system.
+
+
+Astribank in lsusb but not in zaptel_hardware
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+.Symptoms:
+You fail to find an Astribank device in the output of lsusb . But you
+see it in `lsusb | grep e4e4`
+
+.Cause:
+The perl module Zaptel::Hardware currently relies on
+/proc/bus/usb/devices (from usbfs) whereas lsusb can use either that or
+/dev/bus/usb . 
+
+.Fix:
+Usbfs is generally deprecated and some distributions (OpenSUSE, Ubuntu) no 
+longer mount it by default. Try:
+
+  mount /proc/bus/usb
+
+and if that doesn't work:
+
+  mount -t usbfs usbfs /proc/bus/usbfs
+
+However this is generally a cosmetic issue that only affects the listing
+in zaptel_hardware.
 
 
 Astribank not initialized: Premature packet end
@@ -692,125 +835,49 @@
 connectors are live. And connecting both of them with a flat 8-wire
 ethernet cable is a simple way to do a loop test for the port).
 
-
-For each port there are two optional parameters that define its
-behavior:
-
-Each port in the PRI module can be configured either as E1 or T1. The
-port type defaults to E1 and can be changed to T1 in the Zaptel Init 
-Configuration File.
-
-The Astribank xpp driver uses that information for correct hardware
-initialization that is performed before the Zaptel span registration
-process takes place. Because of that, xpp driver can't use the 
-information from file zaptel.conf.
-
-Another parameter that also can be defined in the Zaptel Init
-Configuration File is the function group TE (CPE) or NT (Network). This
-parameter is used for (a) building correct Zaptel & Asterisk
-configuration by genzaptelconf and (b) control RJ-45 sockets LEDs for 
-better visual port control:
-
-A port in the PRI module can be either E1 (default) or T1. It can also be 
-either "TE" (default) or "NT".
-
-TE::
-  Green LED of the lower socket will light. Hint that this is a TE
-  (CPE) port. This is the default.
-
-NT::
-    Orange LED of the upper socket will light. Hint that this is an
-    NT (network) port.
-
-To set them to a non-default value, you should use the variable
-XPP_PRI_SETUP in the 
-xref:_zaptel_init_configuration_file[Zaptel Init Configuration File]
-(/etc/sysconfig/zaptel on Redhats, /etc/default/zaptel on Debians).
-This value is a whitespace-separated list of conditions. When a port is 
-initialized it checks those conditions and uses the first one that 
-matches.
-
-Match expressions may be:
-- CONNECTOR/usb..../XPD-nn	To identify by physical connector
-- NUM/XBUS-mm/XPD-nn		To identify by bus number
-
-Match expressions may contain "wildcards":
-
-- * matches zero or more characters.
-- ? matches one charater
-- [xyz] - any of 'x', 'y', or 'z'.
-
-For each line you should define both if it is E1 or T1 and if it is NT
-or TE.
-
-The list implicitly contains an 'NUM/*=TE,E1' catch all default, appended
-to its end.
-
-A number of useful examples. Note that you should use just one of them.
----------------------------------------------
-# All ports are E1 and CPE
-#XPP_PRI_SETUP=  #no need to set it
-
-# All ports are T1 and CPE:
-XPP_PRI_SETUP='NUM/*=T1,TE'
-
-# Now you want to test a loop between ports 1 and 2 and between 
-# port 3 and 4. So let's make ports 2 and 4 network:
-XPP_PRI_SETUP='NUM/*/XPD-0[24]=E1,NT'
-
-# The same with T1. In this case we also need to set the default of all 
-# the others to T1. Note that we can use more than one item and the
-# first one that matches counts:
-XPP_PRI_SETUP='
-  NUM/*/XPD-0[24]=T1,NT
-  NUM/*=T1,TE
-'
-
-# Actually, there is an implicit 'NUM/*=E1,TE' added to the end of the
-# value and set as the value if there is none. This is how the default
-# is set.
-
-# If you have more than one Astribank and you wish to configure
-# different Astribanks differently, you can use the CONNECTOR option:
-# e.g: set one specific Astribank as E1 network. The others default to
-# E1 CPE:
-XPP_PRI_SETUP='CONNECTOR/usb-0000:00:10.4-4/*=E1,NT'
-
-# Theoretically you could use: XPP_PRI_SETUP='NUM/XBUS-01/*=E1,NT'
-# but the XBUS number depends on the specific load order and is thus
-# might differ in a manual load and a system boot.
----------------------------------------------
-
-This is currently implemented by writing a value to the 
-xref:_proc_xpp_xbus_nn_xpd_mm_pri_info[pri_info file in procfs], but
-that may change in future versions.
+Each port in the PRI module can be configured either as E1 or T1. 
+The default is E1, but it can be changed in xpp.conf (See the section
+above).
+
+In addition to that, a port defaults to consider itself a CPE, or
+rather, to accept timing from the remote party. To override that you
+need to set the timing value to 0 (second parameter in the 'span=' line
+in zaptel.conf).
+
+Thus the following in zaptel.conf will also set an ornage LED:
+
+  span=2,0,3,ccs,hdb3,crc4
+
+Note that as this is only applied when ztcfg is run, the port will have
+the default green LED lit at the bottom until it is configured.
 
 
 Device Startup
 ~~~~~~~~~~~~~~
 This section describes in great depth the initialization of the Xorcom
 Astribank. Normally it would not be really needed, as the standard
-installation of Zaptel should put everything in place.
+installation of Zaptel should put everything in place. This is generally
+some documentation to read when things fail.
 
 Terminology
 ^^^^^^^^^^^
 There are some technical terms that are used in this document and in the
 driver / zaptel.
 
-span:
-Zaptel breaks the channels it knows about to logical units called
-"spans". A port in a E1/T1/ISDN card is usually a span. An whole
-analog card is also a "span". You can see the list of spans as the list
-of files under /proc/zaptel directory or in output of the zttool
-utility.
-
-XBUS:
-A funny way to call an Astribank device.
-
-XPD:
-Basically this is a logical unit of the Astribank. It will be registered in
-Zaptel as a single span. This can be either an analog (FXS or FXO)
-module or a single port in case of a BRI module.
+span::
+  Dahdi breaks the channels it knows about to logical units called
+  "spans". A port in a E1/T1/ISDN card is usually a span. An whole
+  analog card is also a "span". You can see the list of spans as the list
+  of files under /proc/zaptel directory or in output of the dahdi_tool
+  utility.
+
+XBUS::
+  A funny way to call an Astribank device.
+
+XPD::
+  Basically this is a logical unit of the Astribank. It will be 
+  registered in Dahdi as a single span. This can be either an analog 
+  (FXS or FXO) module or a single port in case of a BRI module.
 
 
 Loading Firmware
@@ -824,15 +891,16 @@
 is lsusb. The output of lsusb should show you if the device is connected
 if its firmware is loaded. 
 
-The firmware files are named *.hex. They are presented in the text
-hexadecimal format The files are copied from xpp/utils to /usr/share/zaptel
-folder during the Zaptel installation.
+The firmware files are named *.hex. They are presented in the Intel hex
+format. The files are copied from xpp/utils to /usr/share/zaptel folder 
+during the Zaptel installation.
 
 The Astribank needs a firmware loaded into it. Without the firmware, 
-the device will appear in lsusb with Vendor ID e4e4 and Product ID 1130.
-The firmware loading process consists of two stages. In the first stage the
-"USB" firmware is loaded by using program fxload. When the first stage is
-completed the Vendor ID is e4e4 and the Product ID is 1131.
+the device will appear in lsusb with Vendor ID e4e4 and Product ID 11x0
+(1130, 1140 or 1150). The firmware loading process consists of two stages. 
+In the first stage the "USB" firmware is loaded by using program fxload. 
+When the first stage is completed the Vendor ID is e4e4 and the Product ID 
+is 11x1. (e.g. 1151 if it were 1150 previously).
 
 You can use the following command in order to load the "USB" firmware
 manually:
@@ -871,68 +939,67 @@
 the new NNN value. Usually, the new value is equal to the old value 
 incremented by 1.
 
+On newer systems usbfs (/prob/bus/usb) is replaced by basically the same
+structure under /dev/bus/usb . Note, however, that zaptel_hardware still
+relies on some data from usbfs that is not found in /dev/usb .
+
+
+Automatic Firmware Loading
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+Udev is a framework for dynamic device nodes, which is supported in
+kernel 2.6. if your udev rules are properly  configured then the 
+firmware should be loaded automatically and you will see product ID 11x2
+(e.g.: 1152). 
+
+Udev is mostly configured by files under /etc/udev/rules.d . The
+installer of dahdi-linux installs drivers/dahdi/xpp/xpp.rules into that
+directory.
+
+This file instructs udev to run /usr/share/dahdi/xpp_fxloader for each
+time an Astribank connects and needs firmware. When the Astribank loads
+firmware or when it resets its firmware it "reenumerates" - disconnects
+and reconnects as a new device. 
+
+Below are kernel log messages of an Astribank loading firmware. It firs
+connects without any firmware (device no. 44). Udev tells it to load the
+USB firmware. It disconnects and reconnects (45). This Udev gets the
+FPGA firmware loaded into it. It disconnects again, and when it
+reconnects it is now ready to talk with the driver. The last message is
+from the driver.
+-------------------------------------
+usb 7-1: configuration #1 chosen from 1 choice
+usb 7-1: New USB device found, idVendor=e4e4, idProduct=1150
+usb 7-1: New USB device strings: Mfr=0, Product=0, SerialNumber =0
+usb 7-1: USB disconnect, address 44
+usb 7-1: new high speed USB device using ehci_hcd and address 45
+usb 7-1: configuration #1 chosen from 1 choice
+usb 7-1: New USB device found, idVendor=e4e4, idProduct=1151
+usb 7-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
+usb 7-1: Product: Astribank
+usb 7-1: Manufacturer: Xorcom LTD
+usb 7-1: SerialNumber: 00000123
+usb 7-1: USB disconnect, address 45
+usb 7-1: new high speed USB device using ehci_hcd and address 46
+usb 7-1: configuration #1 chosen from 1 choice
+usb 7-1: reset high speed USB device using ehci_hcd and address 46
+INFO-xpp_usb: XUSB: Xorcom LTD -- Astribank -- FPGA
+-------------------------------------
+
 
 Firmware Loading with Hotplug
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-The Hotplug framework was popular for hot-plugging different devices and 
-usually also for automatic device drivers loading. If Hotplug is used in 
-your system, you'll see many files in folder /etc/hotplug. Hotplug will 
-automatically load the most relevant USB and PCI kernel modules according 
-to the USB and PCI IDs provided by devices. Please note, that if the 
-Hotplug framework is in place and the correct configuration files are 
-located in the right place, then the firmware should be loaded automatically.
-
-In order to get the Hotplug framework to load the firmware into the 
-Astribank automatically, the configuration file xpp_fxloader.usermap and
-the script xpp_fxloader should be copied into /etc/hotplug/usb/ . This is 
-done by 'make -C xpp/utils install'.
-
-File xpp_fxloader.usermap includes a map of USB IDs and the command to run 
-when such devices are encountered. It instructs the Hotplug to run the script 
-xpp_fxloader from that directory. This is also done by 'make -C
-xpp/utils install' .
-
-When xpp_fxloader is run without any parameters it assumes that it was
-run by the hotplug scripts. Then it will check if the "add" event was 
-accepted and if so, xpp_fxloader will install the required firmware file. 
-The xpp_fxloader will be called twice, as after the load of the USB 
-firmware the device will re-enumerate itself and thus "unplug" and 
-"replug" in order to load the FPGA firmware.
-
-
-Firmware Loading with UDEV
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-The UDEV framework has replaced Hotplug in most recent systems. If you
-have a recent 2.6 system without Hotplug and with many files in folder
-/etc/udev, then there are good chances that are you using udev.
-As in case of Hotplug, if your udev framework is configured properly
-then the firmware should be loaded automatically.
-
-In order to get udev to automatically load the firmware into the Astribank, 
-the configuration file xpp.rules should be copied into folder /etc/udev/rules.d 
-and the script xpp_fxloader should be copied into folder /etc/hotplug/usb/ . 
-This is done by 'make -C xpp/utils install' during Zaptel installation.
-
-File xpp.rules instructs the udevd daemon to run xpp_fxloader script with
-the option "udev" and with the Astribank USB ID obtained from the 
-device when it is plugged in.
-Please note, that exactly like in case of Hotplug, the xpp_fxloader will be
-called twice by the udevd. First time for the USB firmware loading and the 
-second time for FPGA firmware loading.
-
-
-Firmware Resetting
-^^^^^^^^^^^^^^^^^^
-Newer versions of the USB firmware can now be reset using 'fpga_load -r'.
-
-Also you can try the following:
-
-  /usr/share/zaptel/xpp_fxloader reset
-  # if asterisk was running: you may need to stop/restart it now. 
-  # if there are some "disconnected" spans in /proc/xpp/xbuses
-  # wait a while, until you see the 1152 IDs again, and then:
-  /etc/init.d/zaptel start
-  # and start/restart asterisk.
+Hotplug is an obsolete framework for doing some of the things done by
+udev today. Specifically, handling kernel hotplug events. It is used in
+systems with kernel < 2.6.13 (e.g. RHEL4 / Centos4 and Debian 3.1). As
+such Zaptel still installs support for those. However if you package
+Zaptel for a more recent distribution, you should probably avoid
+including those obsolete config files.
+
+The relevant files installed under /etc/hotplug/usb and are
+xpp/xpp_fxloader.usermap and xpp_fxloader (which is a symlink to
+/usr/share/dahdi/xpp_fxloader). the usermap file has the same format as
+modules.usbmap in the main kernel modules directory: it is intended to
+identify a (hotplugged) device.
 
 
 Loading The Modules
@@ -953,18 +1020,23 @@
 
 The driver of the Astribank is composed of several modules: 
 
-* xpp     - the basic module, that communicates with Zaptel and provides
-            some common services to other modules.
-* xpd_fxs - the module for controlling FXS modules.
-* xpd_fxo - the module for controlling FXO modules. 
-* xpd_bri - the module for controlling BRI modules. 
-* xpd_pri - the module for controlling E1/T1 modules. 
-* xpd_usb - the module that holds the functionality needed to connect to the
-            USB bus.
+xpp::
+  The basic module, that communicates with Dahdi and provides some 
+  common services to other modules.
+xpd_fxs::
+  FXS modules (analog phones). Module type 1.
+xpd_fxo::
+  FXO modules (Analog PSTN lines). Module type 2.
+xpd_bri::
+  BRI ("ISDN") modules. Module type 3.
+xpd_pri::
+  The module for controlling E1/T1 modules. Module type 4.
+xpp_usb::
+  The functionality needed to connect to the USB bus.
 
 All modules depend on xpp, and modprobing them will install xpp as well.
-However the xpd_* modules are installed on-demand: no need to install
-the xpd_fxo if you have only Astribank FXS.
+However the xpd_* modules are installed on-demand: no need to load 
+xpd_fxo if you have only Astribank FXS.
 
 Once an Astribank device connected and the firmware is loaded, the
 Vendor-ID/Product-ID of the device will be  e4e4/1132 . The handler for that
@@ -983,6 +1055,27 @@
 (firmware) version) and the type of telephony modules it has. According 
 to the answers it receives, the xpp driver will "modprobe" the required 
 xpd_* modules. 
+
+When an Astribank connects, it tells the driver what ports it has. For
+instance, a system with 8BRI (=type 3) ports and 3 modules of 8FXS
+(=type 1) ports:
+----------------------------------------------
+INFO-xpp: XBUS-00: DESCRIPTOR: 4 cards, protocol revision 30
+INFO-xpp: XBUS-00:     CARD 0 type=3.0 ports=8 (2x4), port-dir=0xCC
+INFO-xpp: XBUS-00:     CARD 1 type=1.0 ports=8 (8x1), port-dir=0xFF
+INFO-xpp: XBUS-00:     CARD 2 type=1.0 ports=8 (8x1), port-dir=0xFF
+INFO-xpp: XBUS-00:     CARD 3 type=1.0 ports=8 (8x1), port-dir=0xFF
+----------------------------------------------
+
+If zaptel, xpp or xpp_usb is missing or defective, you'll get relatively
+clear error messages. However if an xpd_* module fails to load (e.g.:
+because it is missing), the error is less intuitive:
+--------------------------------------------------
+NOTICE-xpp: xproto_get: Failed to load module for type=3. exit status=256.
+NOTICE-xpp: XBUS-00: CARD 0: missing protocol table for type 3. Ignored.
+--------------------------------------------------
+In this case it was because I maliciously removed the module xpd_bri
+(type 3) from the system. 
 
 
 Device Initializations Scripts
@@ -991,25 +1084,38 @@
 bunch of values to certain registers in those chips. We decided that
 hardwiring those values in the driver code is not a good idea.
 Before registering a XPD as a span in Zaptel, we run an initialization
-script: /usr/share/zaptel/init_card_N_MM (
-where,
-
-* N  - is 3 for an FXS span and 4 for an FXO span, and 6 or 7 for BRI.
-* MM - is a version number. Currently it equals 26
-
-Those scripts must be executable. Funny things happen if such a script
-exists but is not executable.
-
-If because of some reasons this fails (the script is not in the place, or the
-file doesn't have the executable permissions), then you will get an error 
-message in the logs and the XPD will then be removed (you won't see directory
-for that XPD under the corresponding /proc/xpp/XBUS-* directory) and will not
-be registered in Zaptel.
+script: /usr/share/zaptel/init_card_N_MM where,
+
+* N  is telephony module type: 1 for an FXS span and 2 for an FXO span, 
+  3 for BRI and 4 for PRI.

[... 15492 lines stripped ...]



More information about the zaptel-commits mailing list