亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在運行 LibUsbDotNet“入門示例”的 .NET 應用程序中填充

如何在運行 LibUsbDotNet“入門示例”的 .NET 應用程序中填充

C#
素胚勾勒不出你 2021-09-19 15:51:23
當我運行它時, allDevices 列表是空的。我開始了一個新的 VB.NET 控制臺項目,并安裝了 Nuget LibUsbDotNet。我的代碼是這樣的:Imports SystemImports LibUsbDotNetImports LibUsbDotNet.InfoImports LibUsbDotNet.MainImports System.Collections.ObjectModelModule Module1        Public  MyUsbDevice As UsbDevice        Public  Sub Main(args As String())            ' Dump all devices and descriptor information to console output.            Dim allDevices As UsbRegDeviceList = UsbDevice.AllDevices            For Each usbRegistry As UsbRegistry In allDevices                If usbRegistry.Open(MyUsbDevice) Then                    Console.WriteLine(MyUsbDevice.Info.ToString())                    For iConfig As Integer = 0 To MyUsbDevice.Configs.Count - 1                        Dim configInfo As UsbConfigInfo = MyUsbDevice.Configs(iConfig)                        Console.WriteLine(configInfo.ToString())                        Dim interfaceList As ReadOnlyCollection(Of UsbInterfaceInfo) = configInfo.InterfaceInfoList                        For iInterface As Integer = 0 To interfaceList.Count - 1                            Dim interfaceInfo As UsbInterfaceInfo = interfaceList(iInterface)                            Console.WriteLine(interfaceInfo.ToString())                            Dim endpointList As ReadOnlyCollection(Of UsbEndpointInfo) = interfaceInfo.EndpointInfoList                            For iEndpoint As Integer = 0 To endpointList.Count - 1                                Console.WriteLine(endpointList(iEndpoint).ToString())                            Next                        Next                    Next                End If            Next            ' Free usb resources.            ' This is necessary for libusb-1.0 and Linux compatibility.            UsbDevice.[Exit]()            ' Wait for user input..            Console.ReadKey()        End SubEnd Module我的桌面 USB 設備...
查看完整描述

1 回答

?
一只名叫tom的貓

TA貢獻1906條經驗 獲得超3個贊

我相信我的臺式機太舊了,雖然我最近升級到了 Win 10。所以解決問題,我使用了新的 Win 10 筆記本電腦,安裝并運行過濾器(子)驅動程序并選擇了我的筆記本電腦的網絡攝像頭(作為測試 VID&PID),安裝了 libUsb-Win32,創建了一個 .NET 控制臺項目(我同時使用了 VB 和 C#),做了 VS > proj > Refs > NUGET > 瀏覽了 LibUsbDotNet,安裝了它,粘貼了 Sourceforge 的 libUsbDotNet 中的第一個示例,并且它起作用了很棒:它連接到網絡攝像頭驅動程序(由過濾器子驅動程序選擇),并讀取正確的 VID&PID。(示例報告錯誤,因為網絡攝像頭驅動程序沒有響應輪詢,但這是意料之中的)。


查看完整回答
反對 回復 2021-09-19
  • 1 回答
  • 0 關注
  • 361 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號