Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

My USB bulk device driver hangs and requires a restart of machine? Experts and Guru's please comment.





Dear All,
 
I am writing USB bulk device driver using IOKit framework. My machine configuration is
 
+++++++++++++++++++
Mac OS X Version 10.4.5
Processor: Dual 800 MHz Power PC G4 , 1MB L3 cache per processor
Memory: 256 MB DDR SDRAM
+++++++++++++++++++
 
My user application communicates with my framework which in turns communicates with the device and returns back the required data. The framework works fine most of the time, but "HANGS unexpectedly" at times when I communicates very frequently with my USB device.
 
In order to run my application again, I load my framework again, but that doesnot help me, it  requires a RESTART of the machine inorder to start the whole process again.
 
At the framework code level, below is steps i am performing:::
 
A) I enumerate the devices  attached (i.e my device only) and store the device handle in my structure.
 
B) During communication process , I call my_dataexchange function having following routines. This is the actual function that communicates with the device
 
//////////////////////////////////////////////////
1. Open the USB device
status = (*device->deviceInterface)->USBDeviceOpen(device->deviceInterface); // Here, device is my structure in which i stored the deviceinterface, while enumarting the devices attached.
 
2. Claim the interface using following functions (i.e the way given in USB example)
 
GetNumberOfConfigurations, GetConfigurationDescriptorPtr, SetConfiguration, CreateInterfaceIterator,IOCreatePlugInInterfaceForService, QueryInterface
 
3. Now Open the interface
status = (*intf)->USBInterfaceOpen(intf) // Here intf is defined globally i.e IOUSBInterfaceInterface** intf = NULL;
 
4. Get the pipes (again the standard way)
GetNumEndpoints, GetPipeProperties
 
5. Now writing and reading processing using WritePipe and ReadPipe
 
6. Close the interface  using
USBInterfaceClose
 
7. Now Release the interface
 status = (*intf)->Release(intf);
 
8. Finally close the device
 status = (*device->deviceInterface)->USBDeviceClose (device->deviceInterface);
 
//////////////////////////////////////////////////
 
Now, the above process works fine normally , whether i run a single application or multiple applications to access the device.(Earlier i had some issue with multiple applications but resolved that issue by claiming the interface everytime and releasing it while communicating)
 
But , when used very frequently, on debugging, it hangs before Opening the interface, Step 3. (i.e after opening device, claiming interface)
and needs a restart of the machine to start my app again. Can claiming the device interface and releasing it again and again be the reason behind hanging ???
 
Below are my queries:::
1. What may be the possible reason of hanging ???
2. Has any body encountered similiar situation ???
3. Am I missing something ??? (I have properly released IOUSBDeviceInterface, IOUSBInterfaceInterface and IOCFPluginInterface also)
4. Can USB logger in any manner help me ? How ?I tried using it but when ever i try to click on Start button, it asks for a restart of machine.
5. Is there any debug mechanism to exactly know what is actually crashing under the hood ?
 

All suggestions/ comments/ pointers/ references are most welcome. Awaiting your replies,
 
Thanks in advance,
Regards,
--
Rohit Dhamija(M) 9818446545



--
Rohit Dhamija(M) 9818446545
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.