[Pkg-voip-commits] [dahdi-tools] 90/285: xtalk: Caller passes xusb_spec to xusb_find_iface()
tzafrir at debian.org
tzafrir at debian.org
Thu Jul 7 19:18:36 UTC 2016
This is an automated email from the git hooks/post-receive script.
tzafrir pushed a commit to branch master
in repository dahdi-tools.
commit ec71fef2750dabe306b3a6016af93854cc6e282c
Author: Oron Peled <oron.peled at xorcom.com>
Date: Thu Sep 20 13:40:40 2012 +0000
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)
git-svn-id: http://svn.astersk.org/svn/dahdi/tools/trunk@10711 17933a7a-c749-41c5-a318-cba88f637d49
---
xpp/xtalk/xusb.c | 16 ++++++++++------
xpp/xtalk/xusb.h | 2 +-
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/xpp/xtalk/xusb.c b/xpp/xtalk/xusb.c
index b1c7c74..6a85fd2 100644
--- a/xpp/xtalk/xusb.c
+++ b/xpp/xtalk/xusb.c
@@ -67,7 +67,7 @@ void xusb_init_spec(struct xusb_spec *spec, char *name,
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 @@ fail:
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 xusb *xusb_find_iface(const char *devpath, int iface_num, int ep_out, int
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 @@ struct xusb *xusb_find_iface(const char *devpath, int iface_num, int ep_out, int
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;
diff --git a/xpp/xtalk/xusb.h b/xpp/xtalk/xusb.h
index 65da029..2859475 100644
--- a/xpp/xtalk/xusb.h
+++ b/xpp/xtalk/xusb.h
@@ -67,7 +67,7 @@ typedef int (*xusb_filter_t)(const struct xusb *xusb, void *data);
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
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/dahdi-tools.git
More information about the Pkg-voip-commits
mailing list