Mailing Lists: Apple Mailing Lists

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

Why 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 ?
 
Below is the log that apple generates upon the restart. I could get anything out of this log, but may be some experts over this newgroup and gather some useful information out of it.
////////////////////////////////

Unresolved kernel trap(cpu 1): 0x300 - Data access DAR=0x0000000000000000 PC=0x00000000002B7A58

Latest crash info for cpu 1:

   Exception state (sv=0x1C178000)

      PC=0x002B7A58; MSR=0x00009030; DAR=0x00000000; DSISR=0x40000000; LR=0x002B8558; R1=0x0832BBD0; XCP=0x0000000C (0x300 - Data access)

      Backtrace:

0x0000009C 0x002B8558 0x002BB0C8 0x211EA6AC 0x002E9B90 0x0008BFC8

         0x000291C0 0x000233AC 0x000AC02C 0x00000000

      Kernel loadable modules in backtrace (with dependencies):

         com.apple.iokit.KLog(1.0.6)@0x211e9000

Proceeding back via exception chain:

   Exception state (sv=0x1C178000)

      previously dumped as "Latest" state. skipping...

   Exception state (sv=0x1C159A00)

      PC=0x9000B1E8; MSR=0x0200F030; DAR=0x02F28000; DSISR=0x42000000; LR=0x9000B13C; R1=0xF0080460; XCP=0x00000030 (0xC00 - System call)

 

Kernel version:

Darwin Kernel Version 8.5.0: Sun Jan 22 10:38:46 PST 2006; root:xnu-792.6.61.obj~1/RELEASE_PPC

panic(cpu 1 caller 0xFFFF0003): 0x300 - Data access

Latest stack backtrace for cpu 1:

      Backtrace:

         0x00095718 0x00095C30 0x0002683C 0x000A8384 0x000ABD00

Proceeding back via exception chain:

   Exception state (sv=0x1C178000)

      PC=0x002B7A58; MSR=0x00009030; DAR=0x00000000; DSISR=0x40000000; LR=0x002B8558; R1=0x0832BBD0; XCP=0x0000000C (0x300 - Data access)

      Backtrace:

0x0000009C 0x002B8558 0x002BB0C8 0x211EA6AC 0x002E9B90 0x0008BFC8

         0x000291C0 0x000233AC 0x000AC02C 0x00000000

      Kernel loadable modules in backtrace (with dependencies):

         com.apple.iokit.KLog(1.0.6)@0x211e9000

   Exception state (sv=0x1C159A00)

      PC=0x9000B1E8; MSR=0x0200F030; DAR=0x02F28000; DSISR=0x42000000; LR=0x9000B13C; R1=0xF0080460; XCP=0x00000030 (0xC00 - System call)

 

Kernel version:

Darwin Kernel Version 8.5.0: Sun Jan 22 10:38:46 PST 2006; root:xnu-792.6.61.obj~1/RELEASE_PPC

////////////////////////////////
 

All suggestions/ comments/ pointers/ references are most welcome. Awaiting your replies,
 
Thanks in advance,
Regards,
--
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.