Unity3d Use Libusbdotnet

Source: Internet
Author: User

1. Download first, download the address: http://download.csdn.net/detail/cumtwys/7713473, after downloading to install.

2. Throw the LibUsbDotNet.dll into the Unity3d project and start using the Libusbdotnet library.

3. According to the official copy of the example, test


Using System;
Using Libusbdotnet;
Using Libusbdotnet.descriptors;
Using Libusbdotnet.info;
Using Libusbdotnet.main;
Using Libusbdotnet.ludnmonolibusb;
Using System.Collections.ObjectModel;


Using Unityengine;

    public class Showinfo:monobehaviour {public static usbdevice Myusbdevice; Use this for initialization void Start () {//Dump all devices and descriptor information to console OUTPU
        T. Usbdevice.forcelibusbwinback = true;
        Usbregdevicelist alldevices = usbdevice.alldevices;
        Debug.Log (Alldevices.count); 
                foreach (Usbregistry usbregistry in alldevices) {if (Usbregistry.open (out Myusbdevice)) {
                Debug.Log (MyUsbDevice.Info.ToString ()); for (int iconfig = 0; iconfig < MyUsbDevice.Configs.Count; iconfig++) {Usbconfigin
                    Fo configinfo = Myusbdevice.configs[iconfig];

          Debug.Log (Configinfo.tostring ());          readonlycollection<usbinterfaceinfo> interfacelist = configinfo.interfaceinfolist;
                        for (int iinterface = 0; iinterface < Interfacelist.count; iinterface++) {
                        Usbinterfaceinfo interfaceinfo = Interfacelist[iinterface];

                        Debug.Log (Interfaceinfo.tostring ());
                        readonlycollection<usbendpointinfo> endpointlist = interfaceinfo.endpointinfolist;
                            for (int iendpoint = 0; iendpoint < Endpointlist.count; iendpoint++) { Debug.Log (Endpointlist[iendpoint].
                        ToString ());
        }}}//free USB resources.
        This is necessary for libusb-1.0 and Linux compatibility.


    Usbdevice.exit ();
 }//update is called once per frame void Update () {}}

4. If you find that there is an error missing libusb-1.0.dll, you need to download Libusb-1.0.dll, download the address is, https://sourceforge.net/projects/libusb/files/ libusb-1.0/libusb-1.0.19/,

Download Libusb-1.0.19-rc1-win, decompression has libusb-1.0.dll, put Libusb-1.0.dll into windows/system32 can be solved.


5. If you cannot detect the device, then you need to run Install-filter-win.exe to install the corresponding USB device.

6. It is now found that the XBox handle can be identified.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.