After two days of experimenting I can't get beyond an error on Libusb_open.I have simplified as much as possible and it all hinges on "dev" returned by libusb_get_device_descriptor(dev,@desc)The number returned in dev is a rather large number , but different each time. (29346192)The large number puzzles me as, if it is an address, then the content prints as 0.Worth noting that if I print all the other usb devices it finds, the numbers are in the same range.Playing around with dev either returns an error of -4 (LIBUSB_ERROR_NO_DEVICE) or the program hangs with a segment violation.Running it as Root from the terminal produces the same result.

By changing the Vendor & Product to your device, this program will run in Linux if someone can test it for me.

Couldn't include the .bi file as it exceeded the char count for this post, but it is in the previous thread.One thing I simply can't get my head around is the multiple Ptr statements , like "libusb_device Ptr Ptr dev" and that probably contributesto my lack of understanding the problem.

But the downside of that is that it never finds the second unit which has the same Vendor details but different serial number.I have tried to find other ways to open the port to no avail, so getting Libusb_open to work is crucial.

Hopefully someone here has experience with this and sees the problem.Much appreciated.

Enum libusb_capability /''* The libusb_has_capability() API is available. ''/ LIBUSB_CAP_HAS_CAPABILITY = &h0000 /''* Hotplug support is available on this platform. ''/ LIBUSB_CAP_HAS_HOTPLUG = &h0001 /''* The library can access HID devices without requiring user intervention. * Note that before being able to actually access an HID device, you may * still have to call additional libusb functions such as * \ref libusb_detach_kernel_driver(). ''/ LIBUSB_CAP_HAS_HID_ACCESS = &h0100 /''* The library supports detaching of the default USB driver, using * \ref libusb_detach_kernel_driver(), if one is set by the OS kernel ''/ LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = &h0101End Enum

/'' oops..slight bug in the API. packet is an unsigned int, but we use * signed integers almost everywhere else. range-check and convert to * signed to avoid compiler warnings. FIXME for libusb-2. ''/ If (packet > INT_MAX) Then Return NULL EndIf _packet = Cast(Long, packet)

If _packet >= transfer->num_iso_packets Then Return NULL EndIf

For i = 0 To _packet offset += transfer->iso_packet_desc(i).length Next

/'' oops..slight bug in the API. packet is an unsigned int, but we use * signed integers almost everywhere else. range-check and convert to * signed to avoid compiler warnings. FIXME for libusb-2. ''/ If (packet > INT_MAX) Then Return NULL EndIf _packet = Cast(Long, packet)

/''* A device has left and is no longer available. * It is the user''s responsibility to call libusb_close on any handle associated with a disconnected device. * It is safe to call libusb_get_device_descriptor on a device that has left ''/ LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = &h02End Enum

When dealing with pointers, I (mostly) use pVar (or varPtr) and for pointers to pointers ppVar (where var would be a normal variable). This way the variable name tells me what it is. So e.g. pVar = ppVar[i] is good, and so is pVar = *ppVar, or ppVar = @pVar.

EDIT: The line that call WriteOnce & ReadOnce should be commented out as they are specific.Just tested with a Servo Motor that has inbuilt usb controller, and discovered that the rules.d statement is critical.The WriteOnce & ReadOnce failed but that was to be expected as I don't know the commands for this motor.

I am rewriting the vendor checking section as at the moment it only checks for duplicates using .Vendor(1) / .Product(1)but really I need a Select Case there to check all 4 Vendor possibilities.

Type usbPort Handle(0 to 7) As Long Ptr Found As Short usbFlag As Short 'Hd As Short PrintFlag As Short RxBytes As Long TxBytes As Long RetValue As Long ChrByte As String * 1 ValString(0 to 7) As String * 24 SerialNbr(0 to 7) As String * 6 Vendor (0 to 7) As String * 4 Product(0 to 7) As String * 4End TypeDim Shared usbPort as usbPort'------------------------------------Dim Shared Buffer As UByte Ptr Dim shared as libusb_device Ptr devdim shared as libusb_device_descriptor descdim shared as libusb_device_handle ptr pHandledim shared as libusb_device ptr pDevicedim shared as libusb_device ptr ptr ppListdim shared as ssize_t cnt = 0, i = 0dim shared as short ix = 0 , MyDev = 0