From db77afdbde30d91a64707ef94627cf00938b2664 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 4 Nov 2009 16:36:21 +0000 Subject: Compilation and documentation fixes from trunk Merged revisions 6842,6898,6902,6976,7131 via svnmerge from http://svn.digium.com/svn/dahdi/tools/trunk ........ r6842 | tzafrir | 2009-07-16 13:19:23 +0300 (Thu, 16 Jul 2009) | 2 lines Document attributes of a Dahdi::Xpp::Xpd object. ........ r6898 | dbrooks | 2009-07-27 22:54:13 +0300 (Mon, 27 Jul 2009) | 6 lines Replaces typos "recieved" with "received" and "initilize" with "initialize". (closes issue #15571) Reported by: alecdavis ........ r6902 | seanbright | 2009-07-28 00:05:16 +0300 (Tue, 28 Jul 2009) | 11 lines Pass correct channel number to DAHDI_GET_PARAMS when passing span numbers to dahdi_scan. When filtering, we weren't taking into account the number of channels in the spans that we were skipping. (closes issue #15553) Reported by: tony Patches: 20090723_issue15553.patch uploaded by seanbright (license 71) Tested by: seanbright ........ r6976 | tzafrir | 2009-08-12 22:21:01 +0300 (Wed, 12 Aug 2009) | 4 lines xpp: cleanup gcc warnings and one real astribank_tool bug xpp rev: 7281 ........ r7131 | tzafrir | 2009-09-15 19:52:58 +0300 (Tue, 15 Sep 2009) | 7 lines Add a missing trailing slash on the install-libs target (closes issue #15793) Reported by: pprindeville Patches: dahdi-tools-makefile.patch uploaded by pprindeville (license 347) ........ git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/branches/2.2@7471 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- Makefile | 2 +- dahdi_scan.c | 13 +++--- doc/pattest.8 | 2 +- xpp/README.Astribank | 4 +- xpp/astribank_tool.c | 15 +++++-- xpp/fpga_load.c | 4 +- xpp/mpp_funcs.c | 2 +- xpp/perl_modules/Dahdi/Xpp/Xpd.pm | 88 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 115 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index e1d2e3f..588393a 100644 --- a/Makefile +++ b/Makefile @@ -241,7 +241,7 @@ ifeq (,$(DESTDIR)) /sbin/ldconfig || : ;\ fi endif - rm -f $(DESTDIR)$(LIB_DIR)$(LTZ_SO) + rm -f $(DESTDIR)$(LIB_DIR)/$(LTZ_SO) $(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \ $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER) $(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \ diff --git a/dahdi_scan.c b/dahdi_scan.c index f844b41..d1564f4 100644 --- a/dahdi_scan.c +++ b/dahdi_scan.c @@ -60,8 +60,14 @@ int main(int argc, char *argv[]) span_filter[filter_count++] = s; } } - + for (x = 1; x < DAHDI_MAX_SPANS; x++) { + + memset(&s, 0, sizeof(s)); + s.spanno = x; + if (ioctl(ctl, DAHDI_SPANSTAT, &s)) + continue; + if (filter_count > 0) { int match = 0; for (z = 0; z < filter_count; z++) { @@ -71,13 +77,10 @@ int main(int argc, char *argv[]) } } if (!match) { + basechan += s.totalchans; continue; } } - memset(&s, 0, sizeof(s)); - s.spanno = x; - if (ioctl(ctl, DAHDI_SPANSTAT, &s)) - continue; alarms[0] = '\0'; if (s.alarms) { diff --git a/doc/pattest.8 b/doc/pattest.8 index 0211c8d..9fbbd36 100644 --- a/doc/pattest.8 +++ b/doc/pattest.8 @@ -7,7 +7,7 @@ pattest \(em Tests a Pattern for a DAHDI Clear Channel Test .SH DESCRIPTION .B pattest -Recieves test data from a DAHDI channel and checks if it matches the +Receives test data from a DAHDI channel and checks if it matches the test pattern. The channel should be of CLEAR signalling (e.g: B channel of a PRI line). patgen(8) is used to generate the data at the other side. diff --git a/xpp/README.Astribank b/xpp/README.Astribank index 52156cc..4f24cab 100644 --- a/xpp/README.Astribank +++ b/xpp/README.Astribank @@ -770,10 +770,10 @@ of the driver does not match the driver gives an ugly message and fails the initialization. However in the change of the protocol between versions 2.9 (29) and 3.0 -(30), the response that the new driver recieves from a device with the +(30), the response that the new driver receives from a device with the old version is now considered to be an illegal packet and gets discarded. As a result, the Astribank waits till time-out for the -initilization to end. +initialization to end. .Fix: Reset the firmware of the Astribank by either: diff --git a/xpp/astribank_tool.c b/xpp/astribank_tool.c index b9bcaaa..caee860 100644 --- a/xpp/astribank_tool.c +++ b/xpp/astribank_tool.c @@ -150,8 +150,6 @@ int main(int argc, char *argv[]) char *opt_port = NULL; char *opt_watchdog = NULL; char *opt_reset = NULL; - int tws_portnum; - int full_reset; int ret; progname = argv[0]; @@ -177,7 +175,11 @@ int main(int argc, char *argv[]) break; case 'r': opt_reset = optarg; - if((full_reset = reset_kind(opt_reset)) < 0) + /* + * Sanity check so we can reject bad + * arguments before device access. + */ + if(reset_kind(opt_reset) < 0) usage(); break; case 'v': @@ -213,6 +215,12 @@ int main(int argc, char *argv[]) } show_hardware(astribank); if(opt_reset) { + int full_reset; + + if((full_reset = reset_kind(opt_reset)) < 0) { + ERR("Bad reset kind '%s'\n", opt_reset); + return 1; + } if((ret = mpp_reset(astribank, full_reset)) < 0) { ERR("%s Reseting astribank failed: %d\n", (full_reset) ? "Full" : "Half", ret); @@ -232,6 +240,7 @@ int main(int argc, char *argv[]) } } else if(opt_port) { int new_portnum = strtoul(opt_port, NULL, 0); + int tws_portnum = mpp_tws_portnum(astribank); char *msg = (new_portnum == tws_portnum) ? " Same same, never mind..." : ""; diff --git a/xpp/fpga_load.c b/xpp/fpga_load.c index d99e3e7..bc32422 100644 --- a/xpp/fpga_load.c +++ b/xpp/fpga_load.c @@ -210,7 +210,7 @@ struct usb_device *dev_of_path(const char *path) return NULL; } /* Find last '/' */ - if((p = memrchr(path, '/', strlen(path))) == NULL) { + if((p = (const char *)memrchr(path, '/', strlen(path))) == NULL) { ERR("Missing a '/' in %s\n", path); return NULL; } @@ -221,7 +221,7 @@ struct usb_device *dev_of_path(const char *path) return NULL; } /* Search for a '/' before that */ - p = memrchr(path, '/', p - path); + p = (const char *)memrchr(path, '/', p - path); if(p == NULL) p = path; /* Relative path */ else diff --git a/xpp/mpp_funcs.c b/xpp/mpp_funcs.c index c52397f..53b1a7a 100644 --- a/xpp/mpp_funcs.c +++ b/xpp/mpp_funcs.c @@ -605,9 +605,9 @@ int mpp_eeprom_blk_rd(struct astribank_device *astribank, uint8_t *buf, uint16_t size = ret; goto out; } + size = reply->header.len - sizeof(struct mpp_header) - sizeof(struct d_EEPROM_BLK_RD_REPLY); INFO("size=%d offset=0x%X\n", size, CMD_FIELD(reply, EEPROM_BLK_RD_REPLY, offset)); dump_packet(LOG_DEBUG, "BLK_RD", (char *)reply, ret); - size = reply->header.len - sizeof(struct mpp_header) - sizeof(struct d_EEPROM_BLK_RD_REPLY); if(size > len) { ERR("Truncating reply (was %d, now %d)\n", size, len); size = len; diff --git a/xpp/perl_modules/Dahdi/Xpp/Xpd.pm b/xpp/perl_modules/Dahdi/Xpp/Xpd.pm index 55439fc..5cf6f96 100644 --- a/xpp/perl_modules/Dahdi/Xpp/Xpd.pm +++ b/xpp/perl_modules/Dahdi/Xpp/Xpd.pm @@ -12,6 +12,94 @@ use Dahdi::Utils; use Dahdi::Xpp; use Dahdi::Xpp::Line; +=head1 NAME + +Dahdi::Xpp::Xpd - Perl interface to the Xorcom Astribank XPDs (spans) + +=head1 SYNOPSIS + + # Listing all Astribanks: + use Dahdi::Xpp; + # scans hardware: + my @xbuses = Dahdi::Xpp::xbuses("SORT_CONNECTOR"); + for my $xbus (@xbuses) { + print $xbus->name." (".$xbus->label .", ". $xbus->connector .")\n"; + for my $xpd ($xbus->xpds) { + print " - ".$xpd->fqn,"\n"; + } + } + +=head1 xbus + +The parent L + +=head1 id + +The two-digit ID in the Xbus. Normally 0I for digital spans and +I0 for analog ones (for some digit, I). + +=head1 unit + +First digit of the ID. Zero-based number of the module inside the +Astribank, + +=head1 subunit + +Second digit of the ID. Zero-based sub-part inside the module. +Applicable only to digital (BRI/PRI) modules and always 0 for others. + +=head1 FQN + +Textual name: E.g. C. + +=head1 dir + +The ProcFS directory with information about the XPD. e.g. +C. + +=head1 sysfs_dir + +The SysFS directory with information about the module. E.g. +C. + +=head1 channels + +A list of L channels of this span. In a scalar context +this will be the number of channels in the span. + +=head1 spanno + +0 if not registered with Dahdi. Otherwise, the number of the span it is +registered as. + +=head1 type + +The type of the XPD. One of: C, C, C, C, +C, C. + +=head1 is_bri + +True if this XPD is BRI. + +=head1 is_pri + +True if this XPD is PRI (E1/T1). + +=head1 is_digital + +True if this XPD is a digital port (BRI / PRI). + +=head1 termtype + +For a digital span: C or C. + +=head1 dchan_hardhdlc + +For a BRI port: true if the driver with hardhdlc support (rather than +bri_dchan). + +=cut + my %file_warned; # Prevent duplicate warnings about same file. sub xpd_attr_path($@) { -- cgit v1.2.3