[asterisk-dev] Sysfs udev /dev/dahdi/span-names/ population

Tzafrir Cohen tzafrir.cohen at xorcom.com
Sat Jul 24 08:38:16 CDT 2010


On Fri, Jul 23, 2010 at 05:01:02PM -0500, Russ Meyerriecks wrote:
> Tzafrir,
>   What do you think about removing the "location" and using just  
> "span_id" as a global unique span identifier?

Astribanks have two persistant identifiers:

* Connector string: This basically describes the USB connector you
  plugged the device into
* Label: Essentially a serial number. Identifies a specific box.

Both are useful to identify devices by, as we have seen customers in the
field. Identifying by the connector rather than the label may be more
useful for those who want to easily replace one device with another in
case of a problem.

So I can't make an easy choice which of those two to present as a span
ID.

Also note that those identify the hardware. DAHDI currently lacks any
specific object of a "DAHDI hardware device", while many span attributes
actually refer to it. As a simple way out, we added the portno (port
number inside the hardware device, with the sane default of 0 for those
who don't bother to set it).

Currently the entried in /dev/dahdi/span-names are actually devices. The
spans are subdirectories there.

> This can be filled in by  
> the lower level drivers on a case-by-case basis. For an example, the  
> quad span driver would probably fill it in as  
> "<pci_bus_id>:<span_number>". Then the udev script could simply populate  
> a single level directory tree under /dev/dahdi/span-names/<span_id>
>
> eg:
> /dev/dahdi/span-names/PCI_Bus_03_Slot02:1

This separation is useful if you want to allow aliases. As from a number
of variations we tried, it seems that aliases of the hardware device
itself are simple and useful.


I currently only have a test system with a single Astribank here:

# ../dahdi-tools-sysfs/xpp/dahdi_spanmap
#   Name               Alias           Hardware ID        Location                  Span ID    Type
1   XBUS-00/XPD-00     test-AB!00      usb_INT00415       @usb-0000_00_03.3-5.3     00         E1
2   XBUS-00/XPD-01     test-AB!01      usb_INT00415       @usb-0000_00_03.3-5.3     01         E1
3   XBUS-00/XPD-02     test-AB!02      usb_INT00415       @usb-0000_00_03.3-5.3     02         E1
4   XBUS-00/XPD-03     test-AB!03      usb_INT00415       @usb-0000_00_03.3-5.3     03         E1
5   XBUS-00/XPD-10     test-AB!10      usb_INT00415       @usb-0000_00_03.3-5.3     10         FXS
6   XBUS-00/XPD-20     test-AB!20      usb_INT00415       @usb-0000_00_03.3-5.3     20         FXS
7   XBUS-00/XPD-30     test-AB!30      usb_INT00415       @usb-0000_00_03.3-5.3     30         FXO

# grep -v '^#' live/etc/dahdi/hardware_aliases
test-AB         usb_INT00415

# ls -F /dev/dahdi/
1@    11@   120@  131@  142@  2@   30@  41@  52@  63@  74@  85@  96@
10@   110@  121@  132@  143@  20@  31@  42@  53@  64@  75@  86@  97@
100@  111@  122@  133@  144@  21@  32@  43@  54@  65@  76@  87@  98@
101@  112@  123@  134@  145@  22@  33@  44@  55@  66@  77@  88@  99@
102@  113@  124@  135@  146@  23@  34@  45@  56@  67@  78@  89@  channel
103@  114@  125@  136@  147@  24@  35@  46@  57@  68@  79@  9@   ctl
104@  115@  126@  137@  148@  25@  36@  47@  58@  69@  8@   90@  pseudo
105@  116@  127@  138@  15@   26@  37@  48@  59@  7@   80@  91@  span-aliases/
106@  117@  128@  139@  16@   27@  38@  49@  6@   70@  81@  92@  span-names/
107@  118@  129@  14@   17@   28@  39@  5@   60@  71@  82@  93@  spans/
108@  119@  13@   140@  18@   29@  4@   50@  61@  72@  83@  94@  timer
109@  12@   130@  141@  19@   3@   40@  51@  62@  73@  84@  95@

# ls -l /dev/dahdi/span-aliases/
total 0
lrwxrwxrwx 1 root root 34 2010-07-24 15:39 test-AB -> /dev/dahdi/span-names/usb_INT00415

# ls -l /dev/dahdi/span-names/*
/dev/dahdi/span-names/@usb-0000_00_03.3-5.3:
total 0
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 00 -> /dev/dahdi/spans/1
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 01 -> /dev/dahdi/spans/2
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 02 -> /dev/dahdi/spans/3
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 03 -> /dev/dahdi/spans/4
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 10 -> /dev/dahdi/spans/5
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 20 -> /dev/dahdi/spans/6
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 30 -> /dev/dahdi/spans/7

/dev/dahdi/span-names/usb_INT00415:
total 0
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 00 -> /dev/dahdi/spans/1
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 01 -> /dev/dahdi/spans/2
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 02 -> /dev/dahdi/spans/3
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 03 -> /dev/dahdi/spans/4
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 10 -> /dev/dahdi/spans/5
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 20 -> /dev/dahdi/spans/6
lrwxrwxrwx 1 root root 18 2010-07-24 15:49 30 -> /dev/dahdi/spans/7


BTW: testing this with live_dahdi:

  mkdir test; cd test # or whatever. A new place
  svn co http://svn.asterisk.org/svn/dahdi/linux/team/tzafrir/sysfs dahdi-linux
  svn co http://svn.asterisk.org/svn/dahdi/tools/team/tzafrir/sysfs dahdi-tools
  # If you don't use the name 'dahdi-tools', you'll need to edit
  # live/live.conf later on
  cd dahdi-linux
  ./build_tools/live_dahdi configure  # './ocnfigure' for the tools
  ./build_tools/live_dahdi install    # 'make install' for both
  ./build_tools/live_dahdi config     # 'make config' for both
  ./build_tools/genudevrules >/etc/udev/rules/dahdi.rules
  ./build_tools/live_dahdi reload

Testing hence forth should normally only require the 'install' target
for a rebuild and 'reload' target to restart. It may also be handy to
unload / load specific modules in this case.

For this branch I believe that /etc/udev/rules/dahdi.rules is the only
configuration file that needs to be set on the system.

If you already run 'config' before, you may need to re-do so, due to
http://svnview.digium.com/svn/dahdi?view=rev&rev=8973 .

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-dev mailing list