From 85e8aec92ecb455cdc70e4985caabc5e7ab78aa2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 27 May 2009 00:41:05 +0000 Subject: [PATCH] fix by Florian Fainelli: I finally tracked down the issue being in the xpc_ext_done, which calls xpcu_output_enable while we could not claim the device, this simply fails since the usb_handler is not valid. The xpc_ext_done callback is there to reset the status of the JTAG cable on exit, but we should actually reset the state on initialization no matter what was the status before calling urjtag. Since we are performing the reset in the initilization callback, we can now remove xpc_ext_done and call urj_tap_cable_generic_usbconn_done(). git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1630 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 5 +++++ urjtag/src/tap/cable/xpc.c | 15 +++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index f58b1fbf..c68182f0 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,8 @@ +2009-05-26 Mike Frysinger + + * src/tap/cable/xpc.c: fix crash when USB device is busy (Florian Fainelli) + + 2009-05-26 Arnim Laeuger * src/bus/bf561_ezkit.c, src/bus/sharc21065l.c, src/bus/bf537_stamp.c, diff --git a/urjtag/src/tap/cable/xpc.c b/urjtag/src/tap/cable/xpc.c index 777a397b..b080249f 100644 --- a/urjtag/src/tap/cable/xpc.c +++ b/urjtag/src/tap/cable/xpc.c @@ -388,6 +388,8 @@ xpc_ext_init (urj_cable_t *cable) xpcu = ((urj_usbconn_libusb_param_t *) (cable->link.usb->params))->handle; + if (r == URJ_STATUS_OK) + r = xpcu_output_enable (xpcu, 0); if (r == URJ_STATUS_OK) r = xpcu_request_28 (xpcu, 0x11); if (r == URJ_STATUS_OK) @@ -411,17 +413,6 @@ xpc_ext_init (urj_cable_t *cable) /* ---------------------------------------------------------------------- */ -static void -xpc_ext_done (urj_cable_t *cable) -{ - struct usb_dev_handle *xpcu; - xpcu = ((urj_usbconn_libusb_param_t *) (cable->link.usb->params))->handle; - xpcu_output_enable (xpcu, 0); - urj_tap_cable_generic_usbconn_done (cable); -} - -/* ---------------------------------------------------------------------- */ - static void xpc_ext_free (urj_cable_t *cable) { @@ -722,7 +713,7 @@ urj_cable_driver_t urj_tap_cable_xpc_ext_driver = { urj_tap_cable_generic_disconnect, xpc_ext_free, xpc_ext_init, - xpc_ext_done, + urj_tap_cable_generic_usbconn_done, urj_tap_cable_generic_set_frequency, xpc_ext_clock, xpc_ext_get_tdo,