Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

login4vinay

macrumors newbie
Original poster
May 20, 2013
2
0
I am developing a device driver on mac. my question is how can we make a device request asynchronous to synchronous. like i send a send encapsulated command to device and get it response using get encapsulated command after getting a notification on interrupt pipe. so how can i make my thread will wait until all above request is not completed (both send and get) . but the function from get encap is called is a virtual function and called by upper layer. so if i process a wait in that virtual function then i am not able to get response till my tread is in waiting process. please help me to resolve this problem.

example:
bool class::USBSetPacketFilter()
{
IOReturn Value;
.... .................
value = send_Encasulated_command(* of structure, length);
IOLockSleepDeadline(x, y, z, w);
global variable which is updated when get_Encap is completed. if (Value == IOSuccess &&XVZ == true)
return true;
else r
eturn false }
}
in other function to readinterrupt pipe pipe->Read(mMemDes,&m_CommInfo,NULL);
in call back function we check it is a device response or not then we call get_encapsulated function to complete the request

thnks in advanc
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.