Mailing Lists: Apple Mailing Lists

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

[OS X] Is ResetPipe() asyncronous...?



Hi,

since the company, which sells the usb device I wrote a userland driver for, changed the hardware of the device I'm encountering a problem and am wondering again if this is an issue of Mac OS X which dislikes this specific device or if the device I have the following problem with just isn't a good USB-citizen.

The device in question got just one configuration with two bulk-endpoints (one in--pipe, one out-pipe).

Before any bulk endpoints are used, the userland-driver does USBDeviceOpen(), GetNumberOfConfigurations(), GetConfigurationDescriptorPtr(), SetConfiguration(), CreateInterfaceInterface(), USBInterfaceOpen() and ResetPipes() with a subsequent DeviceRequest() (with bRequest = kUSBRqClearFeature and wValue = kUSBFeatureEndpointStall) to synchronize the data-toggle.

The first time the userclient-process tries to connect to the device, it's all working very good; the data transfers are made via calls to CreateInterfaceAsyncEventSource(), CFRunLoopAddSource(), WritePipeAsync(), CFRunLoopRun() and, after the completion routine called CFRunLoopStop(), CFRunLoopRemoveSource().
But after hot-unplugging, repluggging and doing the normal deviceopen/configure/interfaceopen/resetpipes-cycle again, something is going wrong:
immediately after resetting the bulk pipes, data is to be transferred to the device; this combination of actions confuses the device heavily, it ends up in kind of a deadlock.



After talking to the technician and reviewing USB-Prober logs, the scenario seems to look like the bulk writes and reads which were sent *after* finishing the reset/sync-cycle are received by the device *before* resetting/syncing has indeed finished, thus bringing down the device.


Everything's working fine when calling 'sleep(1)' between resetting/syncing the pipes and the next bulk write to come; so I'm guessing:

- the device is doing something very odd (technician: "...with MS-Windows, we have seen no similiar problems."  but, well, as far as I've heard in different OSs the USB specs are interpreted in different manners)
- the ResetPipe() method is asyncronous which isn't said in the docs
- some WritePipeAsync() calls are faster than light =B^)


OK, I know it's probably an issue the technician (who doesn't seem to know anything about MacOS X) has to fight with, but I'm hoping someone has already seen similiar problems and knows a better work-around then letting the process have a nap of some millions of cpu cycles until the ResetPipe() is *supposed* to have finished it's business with the device...


Here are some further information I can provide:

- running 10.2.3 (though we tested and saw this behaviour in 10.2.x and 10.1.5 also)
- using IOUSBDeviceInterface182 and IOUSBInterfaceInterface183
(I tried to change to IOUSBDeviceInterface187 and IOUSBInterfaceInterface190, and
calling ClearPipeStall() or ClearPipeStallBothEnds() instead of DeviceRequest(), but that didn't help)
- the device has a PHILIPS controller (a "SmartCard" programmable chip) which is officially tested for USB-conformance (the technician said he was told so by the manufacturer)
- if desired I can provide some level-7 logs



Thanks for your time & any suggestions which could point me into a direction leading to another more stable USB device on OS X,
Dirk Stegemann
_______________________________________________
usb mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/usb
Do not post admin requests to the list. They will be ignored.



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.