FreeBSD Bugzilla – Attachment 151308 Details for
Bug 196471
segmentation fault in libusb usage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
testcase for libusb segmentation fault
testcase.c (text/x-csrc), 1.30 KB, created by
Markus Heinz
on 2015-01-03 23:02:57 UTC
(
hide
)
Description:
testcase for libusb segmentation fault
Filename:
MIME Type:
Creator:
Markus Heinz
Created:
2015-01-03 23:02:57 UTC
Size:
1.30 KB
patch
obsolete
>#include <libusb.h> >#include <stdio.h> > >void try_to_claim_and_release(libusb_device_handle *handle); >void do_test(libusb_device_handle *handle); > >void try_to_claim_and_release(libusb_device_handle *handle) { > int r; > > r = libusb_claim_interface(handle ,0); > > if (r == LIBUSB_SUCCESS) { > printf("device claimed\n"); > > r = libusb_release_interface(handle, 0); > > if (r == LIBUSB_SUCCESS) { > printf("device released\n"); > } else { > printf("could not release device\n"); > } > > } else { > printf("could not claim device\n"); > } >} > >void do_test(libusb_device_handle *handle) { > try_to_claim_and_release(handle); > > libusb_close(handle); > printf("device closed\n"); >} > >int main (int argc, char *argv[]) { > libusb_context *ctx = NULL; > libusb_device_handle *handle; > libusb_device *device; > > if (libusb_init(&ctx) == LIBUSB_SUCCESS) { > > if ((handle = libusb_open_device_with_vid_pid(ctx, 0x03f0, 0x6004))) { > printf("device opened\n"); > > device = libusb_get_device(handle); > > do_test(handle); > > if (device != NULL && libusb_open(device, &handle) == LIBUSB_SUCCESS) { > printf("device opened\n"); > do_test(handle); > } > > } else { > printf("could not open device\n"); > } > > libusb_exit(ctx); > } > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 196471
: 151308