我想知道,如果一个特定接口(USB调试)的(安卓)USB设备连接到我的Windows电脑上。
For this, I'm trying to use .Net with this code:
const string GUID_DEVINTERFACE_ANDROID = "f72fe0d4-cbcb-407d-8814-9ed673d0dd6b";
const string usbDeviceSelector = "System.Devices.InterfaceClassGuid:=\"{" + GUID_DEVINTERFACE_ANDROID + "}\" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True";
_usbDeviceWatcher = DeviceInformation.CreateWatcher(
usbDeviceSelector,
new string[] { "System.Devices.InterfaceEnabled" },
DeviceInformationKind.AssociationEndpoint);
_usbDeviceWatcher.Updated += UsbDeviceWatcher_Updated;
不幸的是,该事件不会被抛给我的UsbDeviceWatcher_Update函数。
我不想被告知某个特定的设备,我想被告知所有支持这个接口的设备。
如果带有这种特殊接口的设备将与我的计算机连接/断开,我怎样才能得到一个事件?
如果有一个WinUsb的解决方案,我也会很高兴。