What does this AHI CloseDevice() message mean?

5 posts / 0 new
Last post
hypex
hypex's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2011-09-09 16:20
What does this AHI CloseDevice() message mean?

Hi.

When closing AHI device with debug output on I noticed this message. Does anyone know what it means?

Warning: Expected I/O request 0x00000000.

According to the AHI device source in Device/device.c it stores a pointer to the AHIRequest in a private pointer inside the AHIRequest on open. Then prints the above message if it differs on closing.

When I first saw that it looked scary as I thought it was saying the AHIRequest pointer should be null! I just think the message is badly written. I had to look in the code to see what it means, is that it expected an AHIRequest pointer to be set but it's null instead, in some private pointer, it fails to tell you about.

Still it gives a warning. Have I missed something in my code? My code does a WaitIO() on all pending AHIRequests before closing the device so don't know what this warning is about.

thomas
thomas's picture
Offline
Last seen: 23 hours 32 min ago
Joined: 2011-05-16 14:23
Re: What does this AHI CloseDevice() message mean?

Just a guess: in AHI you often work with copies of the initial AHI request. Maybe you mixed them up? Be sure to call CloseDevice with the same AHI request you used for OpenDevice.

hypex
hypex's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2011-09-09 16:20
Re: What does this AHI CloseDevice() message mean?

Good point, thanks. I did copy the AHIRequest to do double buffering. I did check and am closing the one I am opening. I don't know if the last request sent would affect it. Since I am linkng them together as instructed.

thomas
thomas's picture
Offline
Last seen: 23 hours 32 min ago
Joined: 2011-05-16 14:23
Re: What does this AHI CloseDevice() message mean?

You said you checked the code and found that it compares a private pointer against the provided pointer and prints the message if they don't match.

Could you check what CloseDevice does if the pointers match and the close succeeds?

My next guess would be that CloseDevice, if it succeeds, puts NULL into the private area and that you call CloseDevice twice. The second call issues the message because the first call NULLified the pointer.

Third guess: now that you know that there is a private pointer and where it is, you could regularly print its contents into the debug output and find out when exactly it becomes NULL.

hypex
hypex's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2011-09-09 16:20
Re: What does this AHI CloseDevice() message mean?

CloseDevice routine doesn't do anything different if the pointers match. It just checks it and prints it if debug is on and they don't match.

The private pointer is used elsewhere in device operations.

I added some extra output. What I found is that regardless of it being the original AHIRequest or a copy the private pointer is always set to the original AHIRequest.

I also found something else. In my current testing I'm not getting the message. I think something must have corrupted at the time I got the message. I had to get it from a serial log as AHI was crashing in the sound interrupt. But I've been unable to trace why as when I test my code by sending it audio from another program I wrote it works fine.

Log in or register to post comments