From: Jonathan W. <jw...@ph...> - 2007-08-19 23:54:13
|
Hi guys I've just committed svn rev525 which fixes detection of MOTU interfaces. It was broken by the recently committed device caching code added to devicemanager.cpp. The root of the problem was that DeviceManager::discover() was changed to unconditionally call loadFromCache() and saveCache() no matter what the interface is. Both of these end up calling functions which send AVC commands to the interface in order to construct an ID for the cache lookup. While this works nicely for interfaces which accept AVC commands, it completely breaks for those which don't - such as the MOTU. libiec61883 gives a series of "send oops"s and things go downhill from there. Svn rev 525 commits two small changes - one to each of DeviceManager::loadFromCache() and DeviceManager::saveCache() - which prevent this from happening. Basically we call BeBoB::AvDevice::probe() to find out whether the device is a known BeBoB device. This can work because this probe() method essentially only tests standard device GGIDs, so its return value is a definitive answer to the question of whether the interface is a BeBoB device. According to comments in devicemanager.cpp BeBoB interfaces are the only ones which require the cache at present, so this change shouldn't break things for anyone. Having said that, calling probe() in loadFromCache() and saveCache() might not be considered a neat enough solution. However, given the structure of DeviceManager I can't immediately see any other way of preventing the AVC commands being issued to non-AVC hardware other than to test for GGIDs - something probe() already does. Finally I note that saveCache() did have a test for BeBoB devices but "reinterpret_cast" does not seem to be doing what it was intended to do (whatever c++ magic that happens to be). With a MOTU interface, pBeBoBDevice was set such that the !pBeBoBDevice test failed so the code wrongly concluded it was a rea BeBoB device. I have a 3-line FIXME note in place in saveCache() explaining this, followed with a more detailed note as to why we need to protect non-BeBoB devices from the AVC commands. Regards jonathan |