root/trunk/libffado/src/maudio/maudio_avdevice.cpp

Revision 1154, 3.4 kB (checked in by ppalmers, 14 years ago)

add expat based parsing of the device cache. add compile-time selection between libxml++ and expat. will allow to get rid of the libxml++ dependency on the long run. scons SERIALIZE_USE_EXPAT=0Only compile testedscons SERIALIZE_USE_EXPAT=0

Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #include "maudio/maudio_avdevice.h"
25 #include "bebob/bebob_avdevice.h"
26
27 #include "libieee1394/configrom.h"
28 #include "libieee1394/ieee1394service.h"
29
30 #include "libavc/avc_definitions.h"
31
32 #include "debugmodule/debugmodule.h"
33
34 #include <string>
35 #include <stdint.h>
36
37 namespace MAudio {
38
39 AvDevice::AvDevice( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom ))
40     : BeBoB::AvDevice( d, configRom)
41     , m_model ( NULL )
42 {
43     debugOutput( DEBUG_LEVEL_VERBOSE, "Created MAudio::AvDevice (NodeID %d)\n",
44                  getConfigRom().getNodeId() );
45 }
46
47 AvDevice::~AvDevice()
48 {
49 }
50
51 static VendorModelEntry supportedDeviceList[] =
52 {
53     //{FW_VENDORID_BRIDGECO, 0x00010048, "BridgeCo", "RD Audio1", "refdesign.xml"},
54
55     {FW_VENDORID_MAUDIO, 0x00010046, "M-Audio", "FW 410", "fw410.xml"},
56     {FW_VENDORID_MAUDIO, 0x00010058, "M-Audio", "FW 410", "fw410.xml"},       // Version 5.10.0.5036
57     {FW_VENDORID_MAUDIO, 0x00010060, "M-Audio", "FW Audiophile", "fwap.xml"},
58 };
59
60 bool
61 AvDevice::probe( ConfigRom& configRom )
62 {
63     unsigned int iVendorId = configRom.getNodeVendorId();
64     unsigned int iModelId = configRom.getModelId();
65
66     for ( unsigned int i = 0;
67           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
68           ++i )
69     {
70         if ( ( supportedDeviceList[i].vendor_id == iVendorId )
71              && ( supportedDeviceList[i].model_id == iModelId ) )
72         {
73             return true;
74         }
75     }
76     return false;
77 }
78
79 FFADODevice *
80 AvDevice::createDevice(DeviceManager& d, std::auto_ptr<ConfigRom>( configRom ))
81 {
82     return new AvDevice( d, configRom );
83 }
84
85 bool
86 AvDevice::discover()
87 {
88     unsigned int vendorId = getConfigRom().getNodeVendorId();
89     unsigned int modelId = getConfigRom().getModelId();
90
91     for ( unsigned int i = 0;
92           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
93           ++i )
94     {
95         if ( ( supportedDeviceList[i].vendor_id == vendorId )
96              && ( supportedDeviceList[i].model_id == modelId )
97            )
98         {
99             m_model = &(supportedDeviceList[i]);
100             break;
101         }
102     }
103
104     if (m_model != NULL) {
105         debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n",
106                 m_model->vendor_name, m_model->model_name);
107     } else return false;
108
109     return true;
110 }
111
112 bool
113 AvDevice::setSamplingFrequency( int eSamplingFrequency )
114 {
115     // not supported
116     return false;
117 }
118
119 int AvDevice::getSamplingFrequency( ) {
120     return 44100;
121 }
122
123 int
124 AvDevice::getConfigurationId()
125 {
126     return 0;
127 }
128
129 void
130 AvDevice::showDevice()
131 {
132 }
133
134 bool
135 AvDevice::prepare() {
136
137     return true;
138 }
139
140 }
Note: See TracBrowser for help on using the browser.