Hi Jan,
Thank you for the response.
This issue is occurring after I do a reset and somewhere while I'm re-enumerating via the FindTheHid. My code is as follows:
1. reset the unit
2. Wait 6 seconds
3. re-enumerate via FindTheHid
4. launch the unit (start communicating)
The exception window "ObjectDisposedException occured" is openning with "Safe handle has been closed" and Troubleshooting tips: "Make sure you have not released a resource before attempting to use it."
Stack Trace: at XXXX_Test_Program.Hid.HidD_SetFeature(SafeFileHandle HidDeviceObject, Byte[] lpReportBuffer, Int32 ReportBufferLength)
at XXXX_Test_Program.Hid.OutFeatureReport.Write(Byte[] outFeatureReportBuffer, SafeFileHandle hidHandle) in C:\Users\vgomes\Desktop\XXXX Final Test Program\Hid.cs:line
This is the code that this is occurring on (the code is copied from Hid.cs of generic 4.6):
internal override Boolean Write( Byte[] outFeatureReportBuffer, SafeFileHandle hidHandle )
{
Boolean success = false;
try
{
// ***
// API function: HidD_SetFeature
// Purpose: Attempts to send a Feature report to the device.
// Accepts:
// A handle to a HID
// A pointer to a buffer containing the report ID and report
// The size of the buffer.
// Returns: true on success, false on failure.
// ***
success = HidD_SetFeature(hidHandle, outFeatureReportBuffer, outFeatureReportBuffer.Length);
Debug.Print( "HidD_SetFeature success = " + success );
return success;
}
catch ( Exception ex )
{
DisplayException( MODULE_NAME, ex );
throw ;
}
}
}
This is the line of code that this is occurring on above:
success = HidD_SetFeature(hidHandle, outFeatureReportBuffer, outFeatureReportBuffer.Length);
This is a USB trace using the Ellisys USB Tracker:
Type Title Device Endpoint Direction Status Speed Errors Size Data Container Class request OUT (0x09) 4 0 Out OK FS 8 05 0C 00 99 2B 68 11 29 Transaction SETUP 4 0 Out ACK FS 8 21 09 00 03 00 00 08 00 Transaction OUT 4 0 Out ACK FS 8 05 0C 00 99 2B 68 11 29 Transaction IN 4 0 In ACK FS 0 Transaction IN 4 1 In ACK FS 64 05 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Container Class request OUT (0x09) 4 0 Out OK FS 8 01 07 00 00 00 00 00 00 Transaction SETUP 4 0 Out ACK FS 8 21 09 00 03 00 00 08 00 Transaction OUT 4 0 Out ACK FS 8 01 07 00 00 00 00 00 00 Transaction IN 4 0 In ACK FS 0 Transaction IN 4 1 In ACK FS 64 01 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Bus state Reset 755.8 milliseconds 0 Bus state Suspended 111.2 milliseconds 0 Bus state Reset 15.0 milliseconds 0 Container GetDescriptor (Device) 0 (4) 0 In OK FS 8 12 01 00 02 00 00 00 08 Transaction SETUP 0 (4) 0 Out ACK FS 8 80 06 00 01 00 00 40 00 Transaction IN 0 (4) 0 In ACK FS 8 12 01 00 02 00 00 00 08 Transaction OUT 0 (4) 0 Out ACK FS 0 Bus state Reset 15.0 milliseconds 0 Container SetAddress (4) 0 (4) 0 Out OK FS 0 Transaction SETUP 0 (4) 0 Out ACK FS 8 00 05 04 00 00 00 00 00 Transaction IN 0 (4) 0 In ACK FS 0 Container GetDescriptor (Device) 4 0 In OK FS 18 12 01 00 02 00 00 00 08 1B 0F 29 11 07 03 01 02 03 01 Transaction SETUP 4 0 Out ACK FS 8 80 06 00 01 00 00 12 00 Transaction IN 4 0 In ACK FS 8 12 01 00 02 00 00 00 08 Transaction IN 4 0 In ACK FS 8 1B 0F 29 11 07 03 01 02 Transaction IN 4 0 In ACK FS 2 03 01 Transaction OUT 4 0 Out ACK FS 0 Container GetDescriptor (Configuration) 4 0 In OK FS 34 09 02 22 00 01 01 00 C0 32 09 04 00 00 01 03 00 00 00 09 21 11 01 00 01 22 22 00 07 05 81 03 40 00 01 Transaction SETUP 4 0 Out ACK FS 8 80 06 00 02 00 00 FF 00 Transaction IN 4 0 In ACK FS 8 09 02 22 00 01 01 00 C0 Transaction IN 4 0 In ACK FS 8 32 09 04 00 00 01 03 00 Transaction IN 4 0 In ACK FS 8 00 00 09 21 11 01 00 01 Transaction IN 4 0 In ACK FS 8 22 22 00 07 05 81 03 40 Transaction IN 4 0 In ACK FS 2 00 01 Transaction OUT 4 0 Out ACK FS 0 Container GetDescriptor (String lang IDs) 4 0 In OK FS 4 04 03 09 04 Transaction SETUP 4 0 Out ACK FS 8 80 06 00 03 00 00 FF 00 Transaction IN 4 0 In ACK FS 4 04 03 09 04 Transaction OUT 4 0 Out ACK FS 0 Container GetDescriptor (Device) 4 0 In OK FS 18 12 01 00 02 00 00 00 08 1B 0F 29 11 07 03 01 02 03 01 Transaction SETUP 4 0 Out ACK FS 8 80 06 00 01 00 00 12 00 Transaction IN 4 0 In ACK FS 8 12 01 00 02 00 00 00 08 Transaction IN 4 0 In ACK FS 8 1B 0F 29 11 07 03 01 02 Transaction IN 4 0 In ACK FS 2 03 01 Transaction OUT 4 0 Out ACK FS 0 Container GetDescriptor (Configuration) 4 0 In OK FS 9 09 02 22 00 01 01 00 C0 32 Transaction SETUP 4 0 Out ACK FS 8 80 06 00 02 00 00 09 00 Transaction IN 4 0 In ACK FS 8 09 02 22 00 01 01 00 C0 Transaction IN 4 0 In ACK FS 1 32 Transaction OUT 4 0 Out ACK FS 0 Container GetDescriptor (Configuration) 4 0 In OK FS 34 09 02 22 00 01 01 00 C0 32 09 04 00 00 01 03 00 00 00 09 21 11 01 00 01 22 22 00 07 05 81 03 40 00 01 Transaction SETUP 4 0 Out ACK FS 8 80 06 00 02 00 00 22 00 Transaction IN 4 0 In ACK FS 8 09 02 22 00 01 01 00 C0 Transaction IN 4 0 In ACK FS 8 32 09 04 00 00 01 03 00 Transaction IN 4 0 In ACK FS 8 00 00 09 21 11 01 00 01 Transaction IN 4 0 In ACK FS 8 22 22 00 07 05 81 03 40 Transaction IN 4 0 In ACK FS 2 00 01 Transaction OUT 4 0 Out ACK FS 0 Container SetConfiguration (1) 4 0 Out OK FS 0 Transaction SETUP 4 0 Out ACK FS 8 00 09 01 00 00 00 00 00 Transaction IN 4 0 In ACK FS 0 Container Class request OUT (0x0A) 4 0 Out OK FS 0 Transaction SETUP 4 0 Out ACK FS 8 21 0A 00 00 00 00 00 00 Transaction IN 4 0 In ACK FS 0 Container GetDescriptor (Class: 0x22) 4 0 In OK FS 34 06 A0 FF 09 01 A1 01 09 03 15 00 26 FF 00 75 08 95 40 81 02 09 05 15 00 26 FF 00 75 08 95 08 B1 02 C0 Transaction SETUP 4 0 Out ACK FS 8 81 06 00 22 00 00 62 00 Transaction IN 4 0 In ACK FS 8 06 A0 FF 09 01 A1 01 09 Transaction IN 4 0 In ACK FS 8 03 15 00 26 FF 00 75 08 Transaction IN 4 0 In ACK FS 8 95 40 81 02 09 05 15 00 Transaction IN 4 0 In ACK FS 8 26 FF 00 75 08 95 08 B1 Transaction IN 4 0 In ACK FS 2 02 C0 Transaction OUT 4 0 Out ACK FS 0 Container GetDescriptor (String iSerialNumber) 4 0 In OK FS 18 12 03 31 00 30 00 30 00 33 00 38 00 31 00 32 00 30 00 Transaction SETUP 4 0 Out ACK FS 8 80 06 03 03 09 04 16 00 Transaction IN 4 0 In ACK FS 8 12 03 31 00 30 00 30 00 Transaction IN 4 0 In ACK FS 8 33 00 38 00 31 00 32 00 Transaction IN 4 0 In ACK FS 2 30 00 Transaction OUT 4 0 Out ACK FS 0 Container Class request OUT (0x09) 4 0 Out OK FS 8 06 10 00 00 01 00 00 01 Transaction SETUP 4 0 Out ACK FS 8 21 09 00 03 00 00 08 00 Transaction OUT 4 0 Out NAK FS 8 06 10 00 00 01 00 00 01 Transaction OUT 4 0 Out ACK FS 8 06 10 00 00 01 00 00 01 Transaction IN 4 0 In ACK FS 0 Transaction IN 4 1 In ACK FS 64 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
I compared a good run to the above failed run and didn't see anything, but I'm not sure what I should be looking for. Please give me some feedback.
Thank you