I'm working on a virtual USB bus driver for MacOSX (Windows already running) connected via network with a linux box. It works fine under 10.6 and 10.7 with a mass storage device and HID devices like mice or keyboards.
But removing devices (unplugging) or more simple unload the kext fails for HID devices under 10.7(.5) because of one remaining instance (retain count does not go down to zero after detach). My 10.6 and 10.7 test environments are identically MacBooksPro 8.2 i7.
Sometimes after a while (5-50minutes) the kext becomes free without an action from my side. It seems not to depend an changing power mode.
Yes, I have USBFamily logging lib and a lot of output, but between working (kextunload ok) and not working run I find no difference in the loggings, even with logging level 7.
Because of mass storage devices seem to work well, I guess the problem is inside die HID driver stack especially under 10.7?
Are there any known differences to remove an USB HID device driver stack between 10.6 and 10.7?
My kext is a (virtual) ControllerV3 derivated class establishing/creating an USBDevice for any real plugged (at the remote linux box) USB device. Using XCode 4.4.1.
Thanks in advance for any idea or hint, regards Markus
PS: Looks a little bit odd to me that under 10.7 so many HID objects are on top of the driver stack. After kextunload (with failure "..VirDevice has 1 instance") they seem still alive. But this in 100% the same a local plugged and unplugged Logitech mouse.
From me are only the lowest both objects MsVirBus (virtual USB bus, derivated from IOUSBControllerV3 ) and the Mouse@xaffe003f with is an IOUSBDevice derivated object.