UsbDevice.SendControlOutTransferAsync results in "A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)"

1

I am working on a UWP sample app that connects a windows desktop to an android device via USB. I am using UsbDevice class. I can successfully discover the devices and get the device object too(i.e. establish a connection with the device). But when I try to send a control transfer packet i.e. at this line, "device.SendOutControlTransferAsync(initSetupPacket);" I get this: Exception thrown: 'System.Exception' in System.Private.CoreLib.ni.dll An exception of type 'System.Exception' occurred in System.Private.CoreLib.ni.dll but was not handled in user code A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)

What can be the reason for this error? I tried updating the USB drivers, rebooting the system, trying other android devices. Still no luck.

string aqs = UsbDevice.GetDeviceSelector(vid, pid);

var myDevices = await 
Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(aqs, null);

if (myDevices.Count == 0)
{
    ShowError("Device not found!");
    return;
}

//get the device object 
UsbDevice device = await UsbDevice.FromIdAsync(myDevices[0].Id);

// Send a control transfer. 

UsbSetupPacket initSetupPacket = new UsbSetupPacket() 
{ 
   Request = initRequest,
   RequestType = new UsbControlRequestType() { 

       Recipient = UsbControlRecipient.DefaultInterface,

       ControlTransferType = UsbControlTransferType.Vendor 
   } 
 };
await device.SendOutControlTransferAsync(initSetupPacket);
uwp
usb
asked on Stack Overflow Jul 23, 2018 by si889 • edited Jul 23, 2018 by si889

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0