Search Unity

Reading data from USB device using winusb.dll

Discussion in 'Scripting' started by V0odo0, Nov 10, 2021.

  1. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    I'm using Windows winusb.dll NET wrapper library to interact with USB devices. I can not get it working on Unity while the exact same code compiled with VS is working properly.

    Here is what I noticed with winusb.dll native calls.

    Visual Studio:
    WinUsb_GetDescriptor() - OK
    WinUsb_ReadPipe() - OK

    Unity:
    WinUsb_GetDescriptor() - OK
    WinUsb_ReadPipe() - returns false but fills the read buffer with random amount of bytes on each call

    I assume that this issue somehow related to Unity.