How to access USB on Linux

I’m trying to access a USB device from Unity. There are some additional hurdles as the finished game is supposed to run on a Linux machine continuously reading input from the device (which is plugged into a USB slot on the motherboard).

I’ve got code for reading and interpreting information passed from the device, it’s VendorID and ProductID so I don’t need to reverse engineer anything, just access it. Another game made for the device (c++) uses built in Libusb library that is already in linux. It references #include and gets access like this:

for (bus = usb_busses; bus; bus = bus->next)
        for (dev = bus->devices; dev; dev = dev->next)
            if ((dev->descriptor.idVendor == vid) && (dev->descriptor.idProduct == pid))
                return dev;

Than it keeps reading from this device:

usb_interrupt_read(handle, 1, (char*)Inbuf, PKT_SIZE*NUM_MATS, 50);

Inbuf then is interpreted as the game inputs.

I’ve got libraries: libusb (written in C++, so it’s a native plugin in Unity) and c# wrapper for it libusbdotnet . With that and IDs for that device I should be able to access it (as a test I could crash Unity accessing a USB keyboard… on a PC Windows machine). But, when I compile a Linux build from Unity, the libusb.dll native plugin is dropped. There is not even an option to keep it for Linux in plugin inspector. Even If I manually add it to the build to Plugin directory it doesn’t load and game throws missing dll file. Libusb is already on the OS on the Linux machine. Can I somehow access that library from Unity? Or is there a way to “sneak in” the .dll with the Linux build? Or Am I going about it ass-backwards and it should be done in a completely different way?

Well, I’ve found the answer. I had to update libusb on the linux machine and than I’ve copied .so file from /lib folder on that computer. After adding it to plugins in /Assets it builds correctly.