Summary: | ASTERISK-05859: [patch] program for testing "is there any zaptel device?" | ||
Reporter: | Denis Smirnov (mithraen) | Labels: | |
Date Opened: | 2005-12-17 10:07:59.000-0600 | Date Closed: | 2005-12-19 21:23:50.000-0600 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) zt_exists.c | |
Description: | This program can be used for loading ztdummy in initscript: if ! zt_exists; then modprobe ztdummy end Can it be added to asterisk-addons? | ||
Comments: | By: Tilghman Lesher (tilghman) 2005-12-17 10:10:02.000-0600 Why not just do a simple shell test, i.e. if [ -e /dev/zap/pseudo ]; then ... fi ? By: Tzafrir Cohen (tzafrir) 2005-12-17 10:31:36.000-0600 /dev/zap/pseudo may exist but be invalid . To actually open it use something like: head -c 0 /dev/zap/pseudo (untested). The scriptlet I use in my Debian package: if [ ! -d /proc/zaptel ] || ! echo /proc/zaptel/* | grep -v '\*' | grep -q . then modprobe ztdummy fi that is: if either zaptel itself was not loaded or if zaptel was loaded but no other zaptel module was loaded, load ztdummy. This assumes that any other zaptel driver that has generated a span will also provide timing. I believe that this holds for all of the current zaptel drivers. (consider the above snipet disclaimed, FWIW) By: Denis Smirnov (mithraen) 2005-12-17 10:32:28.000-0600 Because it would not works without udev/devfs (when dev nodes created once and forevever) :) By: Tilghman Lesher (tilghman) 2005-12-17 11:34:36.000-0600 tzafrir: Verified that this works: if head -c 0 /dev/zap/pseudo 2>/dev/null; then echo "zap installed" else echo "not installed" fi By: Tilghman Lesher (tilghman) 2005-12-19 21:23:50.000-0600 Since this operation can be done with shell scripting, there's no need for a separate executable. |