Unity3D 使用 LibUsbDotNet
来源:互联网 发布:手机号码拦截软件 编辑:程序博客网 时间:2024/06/15 01:21
1. 先下载 ,下载地址 : http://download.csdn.net/detail/cumtwys/7713473, 下载完之后进行安装。
2. 把 LibUsbDotNet.dll 丢到Unity3D 工程中,就开始使用LibUsbDotNet库了。
3. 根据复制官方例子,进行测试
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 output. 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++) { UsbConfigInfo 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. 如果发现有报错 缺少 libusb-1.0.dll 的话,就需要去下载 libusb-1.0.dll,下载地址就是,https://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.19/,
下载libusb-1.0.19-rc1-win,解压就有 libusb-1.0.dll,把 libusb-1.0.dll 放到Windows/System32中就可以解决了。
5. 如果无法检测设备,那么 需要运行 install-filter-win.exe 安装对应的 USB 的设备。
6. 目前发现,XBox 手柄可以识别出来。
0 0
- Unity3D 使用 LibUsbDotNet
- c#如何使用LibUSBDotNet
- LibUsbDotNet
- LibUsbDotNet使用方法
- LibUsbDotNet使用方法
- LibUsbDotNet的简单理解
- LibusbDotNet Read/Write(Polling)
- LibUsbDotNet的简单理解:Read Write(Poll)
- LibUsbDotNet的readwrite(Event Driven)
- Unity3D使用FreeImageNET
- Unity3d Time的使用
- unity3d 使用sqlite数据库
- MouseLook脚本使用-- Unity3D
- Unity3D iTween 使用
- Unity3D ItweenEvent 使用
- unity3d 定时器的使用
- unity3D iTween的使用
- Unity3D中的委托使用
- Going Deeper with Convolutions学习笔记
- java学习之:Iterable与Iterator的区别
- STL中map,multimap,set,multiset,unordered_map,unordered_multimap,unordered_set,unordered_multiset的实现方
- 数据库范式
- Hadoop优化与调整
- Unity3D 使用 LibUsbDotNet
- Oracle 11g 监听服务启动不了
- 【笔试】今日头条 形式化输出
- [BZOJ3038&&BZOJ3211] 势能分析线段树
- 友元
- java核心技术学习问题
- 练习
- Ubuntu下安装scikit-learn(sklearn)
- FFT模板(UOJ34多项式乘法)