FreeBSD Bugzilla – Attachment 209310 Details for
Bug 242131
libusb_set_auto_detach_kernel_driver(3) causes libusb_claim_interface(3) to fail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
usb.cpp
usb.cpp (text/plain), 1.10 KB, created by
Yuri Victorovich
on 2019-11-21 06:41:07 UTC
(
hide
)
Description:
usb.cpp
Filename:
MIME Type:
Creator:
Yuri Victorovich
Created:
2019-11-21 06:41:07 UTC
Size:
1.10 KB
patch
obsolete
>#include <libusb.h> > >#include <iostream> > >int main() { > libusb_context *ctx = nullptr; > libusb_init(&ctx); > > libusb_device **devLst; > ssize_t sz = libusb_get_device_list(ctx, &devLst); > > for (int i = 0; i < sz; i++) { > struct libusb_device_descriptor desc; > libusb_get_device_descriptor(devLst[i], &desc); > printf("USB device: idVendor=%04x idProduct=%04x\n", desc.idVendor, desc.idProduct); > if (desc.idVendor == 0x04b4 && desc.idProduct==0x6022) { > libusb_device_handle *handle; > int errorCode = libusb_open(devLst[i], &handle); > if (errorCode != LIBUSB_SUCCESS) { > printf("USB device: libusb_open failed: %s\n", libusb_error_name(errorCode)); > return 1; > } > > std::cout << "USB device opened" << std::endl; > int status = libusb_set_auto_detach_kernel_driver(handle, 1); > if (status != 0) { > std::cout << "libusb_set_auto_detach_kernel_driver failed" << std::endl; > } > status = libusb_claim_interface(handle, 0); > if (status != LIBUSB_SUCCESS) { > std::cout << "libusb_claim_interface() failed: " << libusb_error_name(status) << std::endl; > } > 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 242131
: 209310