Changeset 1545 for branches/libffado-2.0/src/devicemanager.cpp
- Timestamp:
- 04/26/09 08:21:42 (15 years ago)
- Files:
-
- branches/libffado-2.0/src/devicemanager.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/libffado-2.0/src/devicemanager.cpp
r1524 r1545 644 644 // a device id always corresponds to the same device 645 645 sort(m_avDevices.begin(), m_avDevices.end(), FFADODevice::compareGUID); 646 647 // first map the devices to a position using the device spec strings 648 std::map<fb_octlet_t, int> positionMap; 649 for ( FFADODeviceVectorIterator it = m_avDevices.begin(); 650 it != m_avDevices.end(); 651 ++it ) 652 { 653 int pos = m_deviceStringParser->matchPosition((*it)->getConfigRom()); 654 fb_octlet_t guid = (*it)->getConfigRom().getGuid(); 655 positionMap[guid] = pos; 656 debugOutput( DEBUG_LEVEL_VERBOSE, "Mapping %s to position %d...\n", (*it)->getConfigRom().getGuidString().c_str(), pos ); 657 } 658 659 // now run over all positions, and add the devices that belong to it 660 FFADODeviceVector sorted; 661 int nbPositions = m_deviceStringParser->countDeviceStrings(); 646 662 int i=0; 663 for (i=0; i < nbPositions; i++) { 664 for ( FFADODeviceVectorIterator it = m_avDevices.begin(); 665 it != m_avDevices.end(); 666 ++it ) 667 { 668 fb_octlet_t guid = (*it)->getConfigRom().getGuid(); 669 if(positionMap[guid] == i) { 670 sorted.push_back(*it); 671 } 672 } 673 } 674 675 // assign the new vector 676 assert(sorted.size() == m_avDevices.size()); 677 m_avDevices = sorted; 678 679 // set device id's 680 i = 0; 647 681 for ( FFADODeviceVectorIterator it = m_avDevices.begin(); 648 682 it != m_avDevices.end();