FreeBSD Bugzilla – Attachment 225431 Details for
Bug 256296
"No Device" error after using asynchronous API of libusb once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Bug reproducer
libusbbug.c (text/plain), 1.10 KB, created by
Sergii
on 2021-05-31 21:10:30 UTC
(
hide
)
Description:
Bug reproducer
Filename:
MIME Type:
Creator:
Sergii
Created:
2021-05-31 21:10:30 UTC
Size:
1.10 KB
patch
obsolete
>#include <stdio.h> >#include <libusb.h> >#include <pthread.h> >#include <unistd.h> > >// (gdb) b libusb10_io.c:162 >// (gdb) b libusb_close() >// (gdb) c >// (gdb) c >// at this point should see that device is being marked as gone > >static void * >thread_start(void *arg) >{ > struct timeval tv = { > .tv_usec = 0, > .tv_sec = 2, > }; > libusb_context *ctx = arg; > > while (1) > libusb_handle_events_timeout_completed (ctx, &tv, NULL); > > return NULL; >} > >void >libusb_transfer_cb(struct libusb_transfer *transfer) >{ >} > >int main () { > ssize_t dev_num; > > libusb_context *ctx; > libusb_device **list; > libusb_device *dev; > libusb_device_handle *devh; > > pthread_t thread_id; > > libusb_init (&ctx); > > pthread_create(&thread_id, NULL, &thread_start, ctx); > sleep(1); > > dev_num = libusb_get_device_list (ctx, &list); > > dev = list[3]; > > int code = libusb_open (dev, &devh); > if (code != 0) > return 1; > libusb_close (devh); > > sleep(5); > > 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 256296
:
225431
|
225579
|
225640