[svn-commits] tzafrir: tools/trunk r10711 - in /tools/trunk/xpp/xtalk: xusb.c xusb.h

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Sep 20 08:40:44 CDT 2012


Author: tzafrir
Date: Thu Sep 20 08:40:40 2012
New Revision: 10711

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10711
Log:
xtalk: Caller passes xusb_spec to xusb_find_iface()

* This xusb_spec:
  - Is a dummy struct used for this xusb instance only.
  - Is now passed by reference from caller.
  - So caller now manage the life cycle of this struct
* Also, demote one INFO() to DBG() (library should not print
  on its own)
* Also minor fix to DBG() output of spec initialization (leading 0)

Signed-off-by: Oron Peled <oron.peled at xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

Origin: Xorcom xtalk (r9303)

Modified:
    tools/trunk/xpp/xtalk/xusb.c
    tools/trunk/xpp/xtalk/xusb.h

Modified: tools/trunk/xpp/xtalk/xusb.c
URL: http://svnview.digium.com/svn/dahdi/tools/trunk/xpp/xtalk/xusb.c?view=diff&rev=10711&r1=10710&r2=10711
==============================================================================
--- tools/trunk/xpp/xtalk/xusb.c (original)
+++ tools/trunk/xpp/xtalk/xusb.c Thu Sep 20 08:40:40 2012
@@ -67,7 +67,7 @@
 		uint16_t vendor_id, uint16_t product_id,
 		int nifaces, int iface, int nep, int ep_out, int ep_in)
 {
-	DBG("Initialize %s: interfaces=%d using interface num=%d endpoints=%d (OUT=0x%2X, IN=0x%2X)\n",
+	DBG("Initialize %s: interfaces=%d using interface num=%d endpoints=%d (OUT=0x%02X, IN=0x%02X)\n",
 			name, nifaces, iface, nep, ep_out, ep_in);
 	memset(spec, 0, sizeof(*spec));
 	spec->name = name;
@@ -365,7 +365,11 @@
 	return NULL;
 }
 
-struct xusb *xusb_find_iface(const char *devpath, int iface_num, int ep_out, int ep_in)
+struct xusb *xusb_find_iface(const char *devpath,
+	int iface_num,
+	int ep_out,
+	int ep_in,
+	struct xusb_spec *dummy_spec)
 {
 	struct usb_bus		*bus;
 
@@ -387,7 +391,6 @@
 			struct usb_device_descriptor	*dev_desc;
 			struct usb_config_descriptor	*config_desc;
 			struct usb_interface		*interface;
-			struct xusb_spec		spec;
 			struct xusb			*xusb;
 			int				device_num;
 
@@ -402,14 +405,15 @@
 			assert(config_desc);
 			interface = config_desc->interface;
 			assert(interface);
-			INFO("Matched device %s: %X:%X\n", tmppath, dev_desc->idVendor, dev_desc->idProduct);
-			xusb_init_spec(&spec, "Astribank",
+			DBG("Matched device %s: %X:%X\n", tmppath, dev_desc->idVendor, dev_desc->idProduct);
+			assert(dummy_spec);
+			xusb_init_spec(dummy_spec, "<none>",
 				dev_desc->idVendor, dev_desc->idProduct,
 				config_desc->bNumInterfaces,
 				iface_num,
 				interface->altsetting->bNumEndpoints,
 				ep_out, ep_in);
-			if((xusb = xusb_new(dev, &spec)) == NULL) {
+			if((xusb = xusb_new(dev, dummy_spec)) == NULL) {
 				ERR("xusb allocation failed\n");
 			}
 			return xusb;

Modified: tools/trunk/xpp/xtalk/xusb.h
URL: http://svnview.digium.com/svn/dahdi/tools/trunk/xpp/xtalk/xusb.h?view=diff&rev=10711&r1=10710&r2=10711
==============================================================================
--- tools/trunk/xpp/xtalk/xusb.h (original)
+++ tools/trunk/xpp/xtalk/xusb.h Thu Sep 20 08:40:40 2012
@@ -67,7 +67,7 @@
 struct xlist_node *xusb_find_byproduct(const struct xusb_spec *specs, int numspecs, xusb_filter_t filterfunc, void *data);
 struct xusb *xusb_find_bypath(const struct xusb_spec *specs, int numspecs, const char *path);
 struct xusb *xusb_open_one(const struct xusb_spec *specs, int numspecs, xusb_filter_t filterfunc, void *data);
-struct xusb *xusb_find_iface(const char *devpath, int iface_num, int ep_out, int ep_in);
+struct xusb *xusb_find_iface(const char *devpath, int iface_num, int ep_out, int ep_in, struct xusb_spec *dummy);
 
 /*
  * A convenience filter




More information about the svn-commits mailing list