On 28/08/13 05:10, Cody Vaudrin wrote:
> Hello all, I was wondering if there's a way to test a given
> libusb_device_handle for validity? I have a situation where a device handle
> could be corrupted, and when a corrupted (invalid) device handle is passed to
> the libusb_reset_device() function, libusbx crashes. I'm wondering if there's
> a way to test a given device handle before passing it into this function.
Are you looking for how you can tell if a libusb_device_handle is
probably valid in a debugger, like GDB, or want something which would
allow you to have code like the following:
if (libusb_handle_is_valid(handle)) {
libusb_reset_device(handle);
} else {
logf("Not resetting handle %p as it appears to be invalid", handle);
}
If it's the former then your best bet is to look at the libusbi.h at the
libusb_device_handle struct and to print it out in your debugger with
"print *handle".
As for the latter approach, there's certainly no reliable way to
implement a "libusb_handle_is_valid()" function.
Regards,
Toby
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel