On Sat, Jul 11, 2009 at 7:07 AM, Xiaofan Chen<[email protected]> wrote:
> On Sat, Jul 11, 2009 at 2:31 AM, Spencer Oliver<[email protected]> wrote:
>>>
>>> A minor fix needs to be done as I mentioned before.
>>> usb_init(); needs to be moved up to the helper function
>>> find_jlink_device(void) (before the line usb_find_busses();)
>>> http://libusb.sourceforge.net/doc/examples-code.html
>>>
>>> Could you rework the patch? Thanks.
>>>
>>
>> Why does it?
>> usb_init is called once at the start of jlink_usb_open - it does not need
>> calling again.
>
> I was very sure about this but you have posted a good question. I think
> after usb_reset(), usb_init() is necessary. And that is what I do in other
> projects (eg: pk2cmd) and it works there for Windows, Linux and Mac OS X.
>
> I will ask again in the libusb mailing list.

Here is the answer from Alan Stern (Linux USB kernel developer)
in the libusb mailing list.
http://article.gmane.org/gmane.comp.lib.libusb.devel.general/6569
"If the reset causes the device to disconnect and reconnect or change
its descriptors, then yes -- the device list will have changed and
consequently libusb will need to rescan the set of devices to find the
new one.  If the reset doesn't cause such drastic changes then the list
of devices won't change and usb_init() won't be needed.  But you'll
still have reopen the device handle, since the reset will invalidate
the old handle."

I think my suggestion is safer.

-- 
Xiaofan http://mcuee.blogspot.com
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to