0

I use libusb-1.0 for communication with the device.

int rc=libusb_init(NULL);
Q_ASSERT_X(rc == 0,"initialization","---libusb is not initialized----" );
libusb_set_debug(NULL, 3);
m_handle = libusb_open_device_with_vid_pid(NULL, VID, PID);
if (m_handle == NULL)
        return false;
if (libusb_kernel_driver_active(m_handle,DEV_INTF))
        libusb_detach_kernel_driver(m_handle, DEV_INTF);
if (libusb_claim_interface(m_handle,  DEV_INTF) < 0)
    return false;

I have two indepent software products, which both handle the device. If i use device in the first software, i will not be able to open_device_with_vid_pid in the second. How can i get status what device is busy? Libusb debug shows me error

libusb:error [winusbx_open] could not open device...Access is denied

Timur
  • 95
  • 2
  • 12

1 Answers1

1

There's no cross-platform way of doing it short of attempting to open the device and checking if it has succeeded.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313