Beispiel #1
0
        async void ShowConnectedDevices()
        {
            await CMDHelper.Adb_KillServer();

            UsbRegDeviceList allDevices = UsbDevice.AllDevices;

            m_log.Add($"find devices {allDevices.Count}");
            for (int index = 0; index < allDevices.Count; index++)
            {
                var device = (WinUsbRegistry)allDevices[index];

                UsbDevice usbDevice;
                if (device.Open(out usbDevice))
                {
                    //lbl_deviceInfo.Text += device.DeviceID + "\r\n";
                    lbl_deviceInfo.Text += "Serial Number: " + usbDevice.Info.SerialString + "\r\n";
                    string[] locationPaths = (string[])device.DeviceProperties["LocationPaths"];

                    P_ID p_id = P_ID.NULL;
                    V_ID v_id = V_ID.NULL;
                    Enum.TryParse <P_ID>(device.Pid.ToString(), out p_id);
                    Enum.TryParse <V_ID>(device.Vid.ToString(), out v_id);
                    DeviceManufactory man = new DeviceManufactory();
                    man.p_id             = p_id;
                    man.v_id             = v_id;
                    man.company_name     = device.FullName;
                    lbl_deviceInfo.Text += "USB Port: " + filterUsbPort(locationPaths[0], man) + "\r\n";
                    lbl_deviceInfo.Text += "\r\n";
                }
            }
        }