[svn-commits] tzafrir: branch tools/2.2 r7474 - in /tools/branches/2.2: ./ xpp/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Nov 4 11:33:50 CST 2009


Author: tzafrir
Date: Wed Nov  4 11:33:46 2009
New Revision: 7474

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7474
Log:
xpp: reduce the clutter of firmware loading

Make the new XPP tools much less verbose:
 * demote messages to be debug
 * Convert multi-line messages to be single-line messages

Making xpp_fxloader run in debug mode can be done by setting

  DEBUG=yes

in /etc/dahdi/init.conf

Merged revisions 7221 via svnmerge from 
http://svn.digium.com/svn/dahdi/tools/trunk

Modified:
    tools/branches/2.2/   (props changed)
    tools/branches/2.2/xpp/astribank_hexload.c
    tools/branches/2.2/xpp/astribank_tool.c
    tools/branches/2.2/xpp/astribank_usb.c
    tools/branches/2.2/xpp/debug.c
    tools/branches/2.2/xpp/mpp_funcs.c
    tools/branches/2.2/xpp/pic_loader.c
    tools/branches/2.2/xpp/xpp_fxloader

Propchange: tools/branches/2.2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Nov  4 11:33:46 2009
@@ -1,1 +1,1 @@
-/tools/trunk:1-6678,6823,6829-6830,6832-6833,6835,6837-6886,6889-6982,6985-6986,6988-6992,6994-6998,7000-7011,7013,7015,7017,7020-7042,7044,7046-7131,7133,7135-7136,7139-7217,7220,7222-7223,7225-7251,7254-7255,7258-7262,7264-7332,7336-7408,7410-7460,7462
+/tools/trunk:1-6678,6823,6829-6830,6832-6833,6835,6837-6886,6889-6982,6985-6986,6988-6992,6994-6998,7000-7011,7013,7015,7017,7020-7042,7044,7046-7131,7133,7135-7136,7139-7217,7220-7223,7225-7251,7254-7255,7258-7262,7264-7332,7336-7408,7410-7460,7462

Modified: tools/branches/2.2/xpp/astribank_hexload.c
URL: http://svnview.digium.com/svn/dahdi/tools/branches/2.2/xpp/astribank_hexload.c?view=diff&rev=7474&r1=7473&r2=7474
==============================================================================
--- tools/branches/2.2/xpp/astribank_hexload.c (original)
+++ tools/branches/2.2/xpp/astribank_hexload.c Wed Nov  4 11:33:46 2009
@@ -82,7 +82,7 @@
 		perror(hexfile);
 		return -errno;
 	}
-	INFO("Loading FPGA firmware version %s\n", hexdata->version_info);
+	INFO("Loading FPGA: %s (version %s)\n", hexdata->fname, hexdata->version_info);
 #if 0
 	FILE		*fp;
 	if((fp = fopen("fpga_dump_new.txt", "w")) == NULL) {
@@ -121,7 +121,7 @@
 	fclose(fp);
 #endif
 	free_hexdata(hexdata);
-	INFO("FPGA firmware loaded successfully\n");
+	DBG("FPGA firmware loaded successfully\n");
 	return 0;
 }
 

Modified: tools/branches/2.2/xpp/astribank_tool.c
URL: http://svnview.digium.com/svn/dahdi/tools/branches/2.2/xpp/astribank_tool.c?view=diff&rev=7474&r1=7473&r2=7474
==============================================================================
--- tools/branches/2.2/xpp/astribank_tool.c (original)
+++ tools/branches/2.2/xpp/astribank_tool.c Wed Nov  4 11:33:46 2009
@@ -83,6 +83,8 @@
 	struct extrainfo	extrainfo;
 
 	show_astribank_info(astribank);
+	if(verbose <= LOG_INFO)
+		return 0;
 	ret = mpp_caps_get(astribank, &eeprom_table, &capabilities, NULL);
 	if(ret < 0)
 		return ret;
@@ -221,11 +223,13 @@
 			ERR("Bad reset kind '%s'\n", opt_reset);
 			return 1;
 		}
+		INFO("Reseting (%s)\n", opt_reset);
 		if((ret = mpp_reset(astribank, full_reset)) < 0) {
 			ERR("%s Reseting astribank failed: %d\n",
 				(full_reset) ? "Full" : "Half", ret);
 		}
 	} else if(opt_renumerate) {
+		INFO("Renumerate\n");
 		if((ret = mpp_renumerate(astribank)) < 0) {
 			ERR("Renumerating astribank failed: %d\n", ret);
 		}

Modified: tools/branches/2.2/xpp/astribank_usb.c
URL: http://svnview.digium.com/svn/dahdi/tools/branches/2.2/xpp/astribank_usb.c?view=diff&rev=7474&r1=7473&r2=7474
==============================================================================
--- tools/branches/2.2/xpp/astribank_usb.c (original)
+++ tools/branches/2.2/xpp/astribank_usb.c Wed Nov  4 11:33:46 2009
@@ -262,7 +262,7 @@
 		return 0;
 	if(get_usb_string(astribank, iface_desc->iInterface, astribank->iInterface, BUFSIZ) < 0)
 		return 0;
-	INFO("ID=%04X:%04X Manufacturer=[%s] Product=[%s] SerialNumber=[%s] Interface=[%s]\n",
+	DBG("ID=%04X:%04X Manufacturer=[%s] Product=[%s] SerialNumber=[%s] Interface=[%s]\n",
 		dev_desc->idVendor,
 		dev_desc->idProduct,
 		astribank->iManufacturer,
@@ -332,11 +332,28 @@
  */
 void show_astribank_info(const struct astribank_device *astribank)
 {
+	struct usb_device_descriptor	*dev_desc;
+	struct usb_device		*dev;
+
 	assert(astribank != NULL);
-	printf("USB    Firmware Type: [%s]\n", astribank->fwtype->name);
-	printf("USB    iManufacturer: [%s]\n", astribank->iManufacturer);
-	printf("USB    iProduct:      [%s]\n", astribank->iProduct);
-	printf("USB    iSerialNumber: [%s]\n", astribank->iSerialNumber);
+	dev = astribank->dev;
+	dev_desc = &dev->descriptor;
+	if(verbose <= LOG_INFO) {
+		INFO("usb:%s/%s: ID=%04X:%04X [%s / %s / %s]\n",
+			dev->bus->dirname,
+			dev->filename,
+			dev_desc->idVendor,
+			dev_desc->idProduct,
+			astribank->iManufacturer,
+			astribank->iProduct,
+			astribank->iSerialNumber);
+	} else {
+		printf("USB    Bus/Device:    [%s/%s]\n", dev->bus->dirname, dev->filename);
+		printf("USB    Firmware Type: [%s]\n", astribank->fwtype->name);
+		printf("USB    iManufacturer: [%s]\n", astribank->iManufacturer);
+		printf("USB    iProduct:      [%s]\n", astribank->iProduct);
+		printf("USB    iSerialNumber: [%s]\n", astribank->iSerialNumber);
+	}
 }
 
 void astribank_close(struct astribank_device *astribank, int disconnected)

Modified: tools/branches/2.2/xpp/debug.c
URL: http://svnview.digium.com/svn/dahdi/tools/branches/2.2/xpp/debug.c?view=diff&rev=7474&r1=7473&r2=7474
==============================================================================
--- tools/branches/2.2/xpp/debug.c (original)
+++ tools/branches/2.2/xpp/debug.c Wed Nov  4 11:33:46 2009
@@ -26,7 +26,7 @@
 #include <syslog.h>
 #include "debug.h"
 
-int	verbose = LOG_DEBUG;
+int	verbose = LOG_INFO;
 int	debug_mask = 0;
 
 void log_function(int level, int mask, const char *msg, ...)

Modified: tools/branches/2.2/xpp/mpp_funcs.c
URL: http://svnview.digium.com/svn/dahdi/tools/branches/2.2/xpp/mpp_funcs.c?view=diff&rev=7474&r1=7473&r2=7474
==============================================================================
--- tools/branches/2.2/xpp/mpp_funcs.c (original)
+++ tools/branches/2.2/xpp/mpp_funcs.c Wed Nov  4 11:33:46 2009
@@ -239,7 +239,7 @@
 #endif
 	ret = send_usb(astribank, (char *)cmd, len, timeout);
 	if(ret < 0) {
-		ERR("send_usb failed ret=%d\n", ret);
+		DBG("send_usb failed ret=%d\n", ret);
 	}
 	astribank->tx_sequenceno++;
 	return ret;
@@ -277,6 +277,7 @@
 }
 
 
+__attribute__((warn_unused_result))
 int process_command(struct astribank_device *astribank, struct mpp_command *cmd, struct mpp_command **reply_ref)
 {
 	struct mpp_command		*reply = NULL;
@@ -291,12 +292,12 @@
 	expected = get_command_desc(reply_op);
 	//printf("%s: len=%d\n", __FUNCTION__, cmd->header.len);
 	ret = send_command(astribank, cmd, TIMEOUT);
-	if(ret < 0) {
-		ERR("send_command failed: %d\n", ret);
-		goto out;
-	}
 	if(!reply_ref) {
 		DBG("No reply requested\n");
+		goto out;
+	}
+	if(ret < 0) {
+		ERR("send_command failed: %d\n", ret);
 		goto out;
 	}
 	reply = recv_command(astribank, TIMEOUT);
@@ -400,7 +401,8 @@
 		ret = -EPROTO;
 		goto out;
 	}
-	INFO("Protocol version: %02x\n", astribank->mpp_proto_version);
+	DBG("Protocol version: %02x\n", astribank->mpp_proto_version);
+	ret = astribank->mpp_proto_version;
 	free_command(reply);
 out:
 	return ret;

Modified: tools/branches/2.2/xpp/pic_loader.c
URL: http://svnview.digium.com/svn/dahdi/tools/branches/2.2/xpp/pic_loader.c?view=diff&rev=7474&r1=7473&r2=7474
==============================================================================
--- tools/branches/2.2/xpp/pic_loader.c (original)
+++ tools/branches/2.2/xpp/pic_loader.c Wed Nov  4 11:33:46 2009
@@ -187,7 +187,7 @@
 		ERR("Skip PIC burning (not USB2)\n");
 		return 0;
 	}
-	INFO("Load PIC: %s\n", hexdata->fname);
+	INFO("Load PIC: %s (version %s)\n", hexdata->fname, hexdata->version_info);
 	basename = pic_basename(hexdata->fname, &card_type);
 	if(!basename) {
 		ERR("Bad PIC filename '%s'. Abort.\n", hexdata->fname);
@@ -251,7 +251,7 @@
 {
 	int	i;
 
-	INFO("Loading %d PIC files...\n", numfiles);
+	DBG("Loading %d PIC files...\n", numfiles);
 	for(i = 0; i < numfiles; i++) {
 		struct hexdata	*picdata;
 		const char	*curr = filelist[i];

Modified: tools/branches/2.2/xpp/xpp_fxloader
URL: http://svnview.digium.com/svn/dahdi/tools/branches/2.2/xpp/xpp_fxloader?view=diff&rev=7474&r1=7473&r2=7474
==============================================================================
--- tools/branches/2.2/xpp/xpp_fxloader (original)
+++ tools/branches/2.2/xpp/xpp_fxloader Wed Nov  4 11:33:46 2009
@@ -81,6 +81,11 @@
 else
 	LOGGER="logger -i -t '$me'"
 fi
+
+debug() {
+	[ "$DEBUG" != "" ] && $LOGGER "$@"
+	return 0
+}
 
 USBFS_PREFIX=/proc/bus/usb
 DEVUSB_PREFIX=/dev/bus/usb
@@ -133,7 +138,7 @@
 }
 
 run_astribank_hexload() {
-	$LOGGER "Running: $ASTRIBANK_HEXLOAD $*"
+	debug "Running: $ASTRIBANK_HEXLOAD $*"
 	$ASTRIBANK_HEXLOAD "$@" | $LOGGER
 	status=$PIPESTATUS
 	if [ $status != 0 ]; then
@@ -143,7 +148,7 @@
 }
 
 run_astribank_tool() {
-	$LOGGER "Running: $ASTRIBANK_TOOL $*"
+	debug "Running: $ASTRIBANK_TOOL $*"
 	$ASTRIBANK_TOOL "$@" | $LOGGER
 	status=$PIPESTATUS
 	if [ $status != 0 ]; then
@@ -161,7 +166,7 @@
   for dev in $devices
   do
     ver=$(awk '/\$Id:/ { print $4 }' $FIRMWARE_DIR/$fw)
-    $LOGGER "USB Firmware $FIRMWARE_DIR/$fw (Version=$ver) into $dev"
+    debug "USB Firmware $FIRMWARE_DIR/$fw (Version=$ver) into $dev"
     run_fxload -D $dev -I $FIRMWARE_DIR/$fw || exit 1
   done
 }
@@ -169,13 +174,13 @@
 load_fw_device() {
 	dev=$1
 	fw=$2
-	$LOGGER "FPGA loading $fw into $dev"
+	debug "FPGA loading $fw into $dev"
 	run_astribank_hexload -D "$dev" -F "$FIRMWARE_DIR/$fw"
 	pic_files=`echo "$FIRMWARE_DIR"/PIC_TYPE_[1-4].hex`
-	$LOGGER "PIC burning into $dev: $pic_files"
+	debug "PIC burning into $dev: $pic_files"
 	run_astribank_hexload -D "$dev" -p $pic_files
 	run_astribank_tool -D "$dev" -n		# Do renumeration!
-	$LOGGER "PIC burning finished $pic_files"
+	debug "PIC burning finished $pic_files"
 }
 
 #
@@ -237,10 +242,10 @@
 reset_fpga() {
   totaldevs=`numdevs e4e4 '11[3456][012]'`
   devices=`find_dev e4e4 '11[3456][12]'`
-  $LOGGER "Reseting devices [$totaldevs devices]"
+  debug "Reseting devices [$totaldevs devices]"
   for dev in $devices
   do
-	$LOGGER "Resetting FPGA Firmware on $dev"
+	debug "Resetting FPGA Firmware on $dev"
 	sleep_if_race
 	run_astribank_tool -D "$dev" -r full 2>&1 >/dev/null
   done




More information about the svn-commits mailing list