From: ymhuang on
All,

Have any one get error in WinUSB_Free(), and never success to get
success in WinUSB_Free() any more in same power cycle?

Anyone can give a light about how to enable debug log inside WinUSB to
understand why WinUSB_Free() always return error? Or any other thing/
clue can follow?

It'll be a great help to me. Thanks.


The story is -

Somehow, in a heavy test for S3 and its resume, WinUSB_Initialize()
always return fail to my service application after several
iterations.

When putting more debug message inside service application, I found
WinUSB_Free() somehow failed inside its process, and whether how many
time I re-call WinUSB_Free(), it just only return error. And it cause
WinUSB_Initialize() unable to work in next power cycle (it seems
InterfaceHandle was locked).

When symptom happen, I'd check the device still alive, and restart
system can recovery it.

ymhuang.
From: Doron Holan [MSFT] on
WinUsb_Free in its current form only returns TRUE, so your logs are not
correct in that it is returning error. note that the value of
GetLastError() is undefined if the function returns TRUE

d

--

This posting is provided "AS IS" with no warranties, and confers no rights.


"ymhuang" <yaomin.huang(a)gmail.com> wrote in message
news:31e59f00-9c74-4be6-bfa6-e8a003aa9e7b(a)u16g2000pru.googlegroups.com...
> All,
>
> Have any one get error in WinUSB_Free(), and never success to get
> success in WinUSB_Free() any more in same power cycle?
>
> Anyone can give a light about how to enable debug log inside WinUSB to
> understand why WinUSB_Free() always return error? Or any other thing/
> clue can follow?
>
> It'll be a great help to me. Thanks.
>
>
> The story is -
>
> Somehow, in a heavy test for S3 and its resume, WinUSB_Initialize()
> always return fail to my service application after several
> iterations.
>
> When putting more debug message inside service application, I found
> WinUSB_Free() somehow failed inside its process, and whether how many
> time I re-call WinUSB_Free(), it just only return error. And it cause
> WinUSB_Initialize() unable to work in next power cycle (it seems
> InterfaceHandle was locked).
>
> When symptom happen, I'd check the device still alive, and restart
> system can recovery it.
>
> ymhuang.

From: ymhuang on
Dear Doron,

Indeed, we'd check the error via GetLastError(), but it doesn't
indicate any useful information to explain why WinUSB_Initialize()
return error code 183(ERROR_ALREADY_EXISTS) in next power cycle.

We suspect something inside WinUSB.sys is not clean up, OR WinUSB.sys
keep something while receive S3 indication, and cause WinUSB_Initialize
() fail in next power cycle. And it'll continue to repeat same error
in any next power cycle unless we restart service appilcation.

There seems no way to dig into WinUSB.sys to understand what's going
on. Any way we can do to help ourselves?

Appreciate for your kindly answer.

The environment which we know have higher fail rate -
OS: Win7 RTM x86
CPU: ATOM N270
(Don't know why, but CULV, Montevina, Calpella never show this
problem, and N280 also have it, but in lower fail rate)
SB Chip: ICH9-M
Device: USB 1.1 supported.

Break down the testing procedure, the WinUSB API accessing as below:
1. Calling WinUSB_ReadPipe() & WinUSB_WritePipe()
2. Got S3 Event
3. Calling WinUSB_ResetPipe() for each pipe
4. Calling WinUSB_Free().
5. Calling CloseHandle() to release device
6. System go into S3.
7. Resume event coming.
8. Calling CreateFile() to create device.
9. Calling WinUSB_Initialize() to get interface, then back to step 1
to do pipe operation.

After several time, WinUSB_Initialize() will return error code 183.

Recently, we did more test with WinUSB. We found below things -
1. If turn off selective suspend, the symptom come out in higher fail
rate.
2. The flush pipe before calling WinUSB_Free() no help. Still
encounter same symptom.
3. Unload WinUSB.dll after WinUSB_Free() in same power cycle is
useless for next power cycle.


Thank again.
ymhuang.

On Oct 8, 5:43 am, "Doron Holan [MSFT]"
<doron.ho...(a)online.microsoft.com> wrote:
> WinUsb_Free in its current form only returns TRUE, so your logs are not
> correct in that it is returning error.  note that the value of
> GetLastError() is undefined if the function returns TRUE
>
> d
>
> --
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "ymhuang" <yaomin.hu...(a)gmail.com> wrote in message
>
> news:31e59f00-9c74-4be6-bfa6-e8a003aa9e7b(a)u16g2000pru.googlegroups.com...
>
>
>
> > All,
>
> > Have any one get error in WinUSB_Free(), and never success to get
> > success in WinUSB_Free() any more in same power cycle?
>
> > Anyone can give a light about how to enable debug log inside WinUSB to
> > understand why WinUSB_Free() always return error?  Or any other thing/
> > clue can follow?
>
> > It'll be a great help to me.  Thanks.
>
> > The story is -
>
> > Somehow, in a heavy test for S3 and its resume, WinUSB_Initialize()
> > always return fail to my service application after several
> > iterations.
>
> > When putting more debug message inside service application, I found
> > WinUSB_Free() somehow failed inside its process, and whether how many
> > time I re-call WinUSB_Free(), it just only return error.  And it cause
> > WinUSB_Initialize() unable to work in next power cycle (it seems
> > InterfaceHandle was locked).
>
> > When symptom happen, I'd check the device still alive, and restart
> > system can recovery it.
>
> >ymhuang.

From: Don Miller[MS] on
Hi YmHuang,

What is the return value on the CloseHandle() call leading up to the failing
case? Also, what is the return value of the CreateFile() call in the
failing case? As already mentioned, WinUSB_Free() will always return TRUE.
Do you ever call WinUsb_GetAssociatedInterface()? if so, do you match it
with a corresponding WinUSB_Free()?

Thanks,

-Don Miller [MS]

"ymhuang" <yaomin.huang(a)gmail.com> wrote in message
news:c8759730-58a6-4bc4-847c-a4efeef2b3fd(a)r24g2000prf.googlegroups.com...
> Dear Doron,
>
> Indeed, we'd check the error via GetLastError(), but it doesn't
> indicate any useful information to explain why WinUSB_Initialize()
> return error code 183(ERROR_ALREADY_EXISTS) in next power cycle.
>
> We suspect something inside WinUSB.sys is not clean up, OR WinUSB.sys
> keep something while receive S3 indication, and cause WinUSB_Initialize
> () fail in next power cycle. And it'll continue to repeat same error
> in any next power cycle unless we restart service appilcation.
>
> There seems no way to dig into WinUSB.sys to understand what's going
> on. Any way we can do to help ourselves?
>
> Appreciate for your kindly answer.
>
> The environment which we know have higher fail rate -
> OS: Win7 RTM x86
> CPU: ATOM N270
> (Don't know why, but CULV, Montevina, Calpella never show this
> problem, and N280 also have it, but in lower fail rate)
> SB Chip: ICH9-M
> Device: USB 1.1 supported.
>
> Break down the testing procedure, the WinUSB API accessing as below:
> 1. Calling WinUSB_ReadPipe() & WinUSB_WritePipe()
> 2. Got S3 Event
> 3. Calling WinUSB_ResetPipe() for each pipe
> 4. Calling WinUSB_Free().
> 5. Calling CloseHandle() to release device
> 6. System go into S3.
> 7. Resume event coming.
> 8. Calling CreateFile() to create device.
> 9. Calling WinUSB_Initialize() to get interface, then back to step 1
> to do pipe operation.
>
> After several time, WinUSB_Initialize() will return error code 183.
>
> Recently, we did more test with WinUSB. We found below things -
> 1. If turn off selective suspend, the symptom come out in higher fail
> rate.
> 2. The flush pipe before calling WinUSB_Free() no help. Still
> encounter same symptom.
> 3. Unload WinUSB.dll after WinUSB_Free() in same power cycle is
> useless for next power cycle.
>
>
> Thank again.
> ymhuang.
>
> On Oct 8, 5:43 am, "Doron Holan [MSFT]"
> <doron.ho...(a)online.microsoft.com> wrote:
>> WinUsb_Free in its current form only returns TRUE, so your logs are not
>> correct in that it is returning error. note that the value of
>> GetLastError() is undefined if the function returns TRUE
>>
>> d
>>
>> --
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "ymhuang" <yaomin.hu...(a)gmail.com> wrote in message
>>
>> news:31e59f00-9c74-4be6-bfa6-e8a003aa9e7b(a)u16g2000pru.googlegroups.com...
>>
>>
>>
>> > All,
>>
>> > Have any one get error in WinUSB_Free(), and never success to get
>> > success in WinUSB_Free() any more in same power cycle?
>>
>> > Anyone can give a light about how to enable debug log inside WinUSB to
>> > understand why WinUSB_Free() always return error? Or any other thing/
>> > clue can follow?
>>
>> > It'll be a great help to me. Thanks.
>>
>> > The story is -
>>
>> > Somehow, in a heavy test for S3 and its resume, WinUSB_Initialize()
>> > always return fail to my service application after several
>> > iterations.
>>
>> > When putting more debug message inside service application, I found
>> > WinUSB_Free() somehow failed inside its process, and whether how many
>> > time I re-call WinUSB_Free(), it just only return error. And it cause
>> > WinUSB_Initialize() unable to work in next power cycle (it seems
>> > InterfaceHandle was locked).
>>
>> > When symptom happen, I'd check the device still alive, and restart
>> > system can recovery it.
>>
>> >ymhuang.
>
From: ymhuang on
Hi Don,

It is great to have your help.

WinUSB_Free(), CloseHandle() and CreateFile() all return no error.
Only WinUSB_Initialize() return error code (183, ERROR_ALREADY_EXISTS)
during heavy S3 resume test.

Now we are using the WINUSB_INTERFACE_HANDLE returned by
WinUSB_Initialize() to each WinUSB.dll export API. and don't call
WinUSB_GetAssociatedInterface().

Any suggestion?


Thanks.
ymhuang.


On Oct 21, 2:54 am, "Don Miller[MS]"
<don...(a)redmond.corp.microsoft.com> wrote:
> Hi YmHuang,
>
> What is the return value on the CloseHandle() call leading up to the failing
> case?  Also, what is the return value of the CreateFile() call in the
> failing case?  As already mentioned, WinUSB_Free() will always return TRUE.
> Do you ever call WinUsb_GetAssociatedInterface()?  if so, do you match it
> with a corresponding WinUSB_Free()?
>
> Thanks,
>
> -Don Miller [MS]
>
> "ymhuang" <yaomin.hu...(a)gmail.com> wrote in message
>
> news:c8759730-58a6-4bc4-847c-a4efeef2b3fd(a)r24g2000prf.googlegroups.com...
>
>
>
> > Dear Doron,
>
> > Indeed, we'd check the error via GetLastError(), but it doesn't
> > indicate any useful information to explain why WinUSB_Initialize()
> > return error code 183(ERROR_ALREADY_EXISTS) in next power cycle.
>
> > We suspect something insideWinUSB.sys is not clean up, ORWinUSB.sys
> > keep something while receive S3 indication, and cause WinUSB_Initialize
> > () fail in next power cycle.  And it'll continue to repeat same error
> > in any next power cycle unless we restart service appilcation.
>
> > There seems no way to dig intoWinUSB.sys to understand what's going
> > on.  Any way we can do to help ourselves?
>
> > Appreciate for your kindly answer.
>
> > The environment which we know have higher fail rate -
> > OS: Win7 RTM x86
> > CPU: ATOM N270
> > (Don't know why, but CULV, Montevina, Calpella never show this
> > problem, and N280 also have it, but in lower fail rate)
> > SB Chip: ICH9-M
> > Device: USB 1.1 supported.
>
> > Break down the testing procedure, theWinUSBAPI accessing as below:
> > 1. Calling WinUSB_ReadPipe() & WinUSB_WritePipe()
> > 2. Got S3 Event
> > 3. Calling WinUSB_ResetPipe() for each pipe
> > 4. Calling WinUSB_Free().
> > 5. Calling CloseHandle() to release device
> > 6. System go into S3.
> > 7. Resume event coming.
> > 8. Calling CreateFile() to create device.
> > 9. Calling WinUSB_Initialize() to get interface, then back to step 1
> > to do pipe operation.
>
> > After several time, WinUSB_Initialize() will return error code 183.
>
> > Recently, we did more test withWinUSB.  We found below things -
> > 1. If turn off selective suspend, the symptom come out in higher fail
> > rate.
> > 2. The flush pipe before calling WinUSB_Free() no help.  Still
> > encounter same symptom.
> > 3. UnloadWinUSB.dll after WinUSB_Free() in same power cycle is
> > useless for next power cycle.
>
> > Thank again.
> > ymhuang.
>
> > On Oct 8, 5:43 am, "Doron Holan [MSFT]"
> > <doron.ho...(a)online.microsoft.com> wrote:
> >> WinUsb_Free in its current form only returns TRUE, so your logs are not
> >> correct in that it is returning error.  note that the value of
> >> GetLastError() is undefined if the function returns TRUE
>
> >> d
>
> >> --
>
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
>
> >> "ymhuang" <yaomin.hu...(a)gmail.com> wrote in message
>
> >>news:31e59f00-9c74-4be6-bfa6-e8a003aa9e7b(a)u16g2000pru.googlegroups.com....
>
> >> > All,
>
> >> > Have any one get error in WinUSB_Free(), and never success to get
> >> > success in WinUSB_Free() any more in same power cycle?
>
> >> > Anyone can give a light about how to enable debug log insideWinUSBto
> >> > understand why WinUSB_Free() always return error?  Or any other thing/
> >> > clue can follow?
>
> >> > It'll be a great help to me.  Thanks.
>
> >> > The story is -
>
> >> > Somehow, in a heavy test for S3 and its resume, WinUSB_Initialize()
> >> > always return fail to my service application after several
> >> > iterations.
>
> >> > When putting more debug message inside service application, I found
> >> > WinUSB_Free() somehow failed inside its process, and whether how many
> >> > time I re-call WinUSB_Free(), it just only return error.  And it cause
> >> > WinUSB_Initialize() unable to work in next power cycle (it seems
> >> > InterfaceHandle was locked).
>
> >> > When symptom happen, I'd check the device still alive, and restart
> >> > system can recovery it.
>
> >> >ymhuang.