最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Is it expected for an android device to only be detected by a computer on No Data Transfer mode? - Stack Overflow

programmeradmin1浏览0评论

I am developing an app in C# to send through Bulk Endpoint Transfer data to an android-powered device (a tablet in this case).

My tablet is configured to use USB for "No data transfer", with developer options an USB debugging on, since the other options doesn't even show the device on the list on Windows.

I am currently trying the Bulk Read/Write example within LibUsbDotNet documentation.

Constantly fails reading, throwing "Read failed:ErrorPipe".

Doesn't even show if any mode besides "No data transfer" is selected in the code shown below:

 public static void Main(string[] args)
 {
     UsbRegDeviceList allDevices = UsbDevice.AllDevices;
     foreach (UsbRegistry usbRegistry in allDevices)
     {
         if (usbRegistry.Open(out MyUsbDevice))
         {
             Console.WriteLine(MyUsbDevice.Info.ToString());
             for (int iConfig = 0; iConfig < MyUsbDevice.Configs.Count; iConfig++)
             {
                 UsbConfigInfo configInfo = MyUsbDevice.Configs[iConfig];
                 Console.WriteLine(configInfo.ToString());

                 ReadOnlyCollection<UsbInterfaceInfo> interfaceList = configInfo.InterfaceInfoList;
                 for (int iInterface = 0; iInterface < interfaceList.Count; iInterface++)
                 {
                     UsbInterfaceInfo interfaceInfo = interfaceList[iInterface];
                     Console.WriteLine(interfaceInfo.ToString());

                     ReadOnlyCollection<UsbEndpointInfo> endpointList = interfaceInfo.EndpointInfoList;
                     for (int iEndpoint = 0; iEndpoint < endpointList.Count; iEndpoint++)
                     {
                         Console.WriteLine(endpointList[iEndpoint].ToString());
                     }
                 }
             }
         }
     }

To give more info, it uses a ADB interface, which I think might be the problem, but I'm not sure anymore what the problem is and how can I solve it/work around it.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论