[svn-commits] tzafrir: branch linux/tzafrir/sysfs r8441 - /linux/team/tzafrir/sysfs/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sun Mar 28 14:34:32 CDT 2010
Author: tzafrir
Date: Sun Mar 28 14:34:28 2010
New Revision: 8441
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8441
Log:
dahdi_symlinks - remove aliaseing, add hardware_id
* Remove the span aliasing functioanlity from this script. It will be done
elsewhere. Doing it in the channel symlinks does not allow to see them
clearly.
* Separate link for the hardware_id+hardware-port.
* Those links sit under /dev/dahdi/devices, to keep a clean space directly
under /dev/dahdi . They are not intended to be used directly normally.
Modified:
linux/team/tzafrir/sysfs/dahdi_symlinks
Modified: linux/team/tzafrir/sysfs/dahdi_symlinks
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/dahdi_symlinks?view=diff&rev=8441&r1=8440&r2=8441
==============================================================================
--- linux/team/tzafrir/sysfs/dahdi_symlinks (original)
+++ linux/team/tzafrir/sysfs/dahdi_symlinks Sun Mar 28 14:34:28 2010
@@ -1,6 +1,8 @@
#! /bin/sh
-# a wrapper to kernel-doc from the kernel source tree
+set -e
+
+# dahdy_symlinks: list of symlinks to point to a device of a DAHDI channel
#
# Copyright (C) 2010 by Xorcom <support at xorcom.com>
#
@@ -18,8 +20,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-# dahdy_symlinks: list of symlinks to point to a device of a DAHDI channel
-#
# This script is to be used by udevd through udev rules. It should
# output a list of symbolic links that should point to the channel.
# This is used at startup to generate those links and at shutdown to
@@ -27,21 +27,20 @@
#
# Having an extra directory element in this script is perfectly OK.
#
+# This will create symlinks from
+# /dev/dahdi/devices/@<location>/<chanpos> and optionally from
+# /dev/dahdi/devices/<hardware_id>/<port>/<chanpos>
+# to /dev/dahdi/<channo> .
+#
# The names are directory names that default to the content of the
# span's 'location' field, but may ibe further mapped using a simple
# mapping script.
#
+# <Field names> above are taken from the channel's sysfs information (or
+# its span). Some are further slightly cooked.
+#
# Inside the directory, file names are based on the 'chanpos', that is,
# the number of the channel in the span (1-based).
-#
-# An example /etc/dahdi/span_aliases:
-#
-# #! /bin/sed -f
-# # Alias a single wcfxo:
-# s/^PCI_Bus_01_Slot_10/wildcard/
-# # Alias a single Astribank: Each xpd (span) gets a separate subdir under
-# # /dev/dahdi/ab-lab5/
-# s/^usb-0000:00:1d_7-3/ab-lab5/
set -e
@@ -52,10 +51,8 @@
# DEVPATH: The path under /sys with the node of the channel's device.
# Set by the kernel when emmiting an event.
-# LOCATION: The 'location' field of the channel's span with special
-# characters replaced by a '_' except '!' that is replaced by
-# '/'.
-LOCATION=`cat "/sys/$DEVPATH/device/location" | tr -d '\n' | tr '!' '/' | tr -c 'a-zA-Z0-9/:-' '_' | /etc/dahdi/span_aliases`
+HWLINKTO=''
+LOCATION=`cat "/sys/$DEVPATH/device/location" | tr -d '\n' | tr '!' '/' | tr -c 'a-zA-Z0-9/:-' '_'`
if [ "$LOCATION" == '' ]; then
echo >&2 "$0: Missing location attribute"
exit 1
@@ -65,6 +62,16 @@
echo >&2 "$0: Missing chanpos attribute"
exit 1
fi
-LINKTO="dahdi/$LOCATION/$CHANPOS"
-#echo "$LINKTO" 1>&2
-echo "$LINKTO"
+HARDWARE_ID=`cat "/sys/$DEVPATH/device/hardware_id" | tr -d '\n' | tr '!' '/' | tr -c 'a-zA-Z0-9/:-' '_'`
+if [ "$HARDWARE_ID" != '' ]; then
+ HARDWARE_PORT=`cat "/sys/$DEVPATH/device/hardware_port"`
+ if [ "$HARDWARE_PORT" == '' ]; then
+ echo >&2 "$0: Missing hardware_port attribute"
+ exit 1
+ fi
+ HWSPAN="${HARDWARE_ID}/${HARDWARE_PORT}"
+ HWLINKTO="dahdi/devices/$HWSPAN/$CHANPOS"
+fi
+LINKTO="dahdi/devices/@$LOCATION/$CHANPOS"
+#echo "$LINKTO $HWLINKTO" 1>&2
+echo "$LINKTO $HWLINKTO"
More information about the svn-commits
mailing list