root/trunk/freebob/src/avdevice.cpp

Revision 40, 17.2 kB (checked in by pieterpalmers, 19 years ago)

Added:
- Information retrieval functions for several infoblocks
- Status printing functions for several infoblocks
- debugPrintShort to print debug comments without leading context info
- optional ANSI colored output of debug commands (see debugmodule.h)
- optional colored HTML output of debug commands for e.g. printouts (see debugmodule.h)
- AvDeviceSubunit?->Reserve() / unReserve() / isReserved()
- AvDevice::[set|get][Input|Output]PlugSignalFormat? functions (incomplete)
- added preliminary detection of internal connections

Changed:
- removed a lot of obsolete test code from ieee1394service.cpp
- added some other test code to ieee1394service.cpp

Bugfixes:
- Corrected bug in AvClusterInfoBlock?. This originated from an error in the spec.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* avdevice.cpp
2  * Copyright (C) 2004 by Daniel Wagner, Pieter Palmers
3  *
4  * This file is part of FreeBob.
5  *
6  * FreeBob is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * FreeBob is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with FreeBob; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA.
19  */
20 #include <errno.h>
21 #include <libavc1394/avc1394.h>
22 #include <libavc1394/avc1394_vcr.h>
23 #include "debugmodule.h"
24 #include "avdevice.h"
25 #include "avdevicesubunit.h"
26 #include "avdeviceaudiosubunit.h"
27 #include "avdevicemusicsubunit.h"
28
29 AvDevice::AvDevice(int port, int node)
30 {
31         iNodeId=node;
32         m_iPort=port;
33
34         // check to see if a device is really present?
35
36         // probably initialisation would be better done here
37
38         // Port and node id are not distinct.  The node id
39         // can change after a bus reset, therefore the
40         // device id has to be taken for identifiction.
41 }
42
43 FBReturnCodes
44 AvDevice::Initialize() {
45        
46         if (!m_bInitialised) {
47
48         m_handle = raw1394_new_handle();
49         if ( !m_handle ) {
50             if ( !errno ) {
51                 debugPrint(DEBUG_LEVEL_DEVICE,  "libraw1394 not compatible.\n" );
52             } else {
53                 perror ("Could not get 1394 handle");
54                 debugPrint(DEBUG_LEVEL_DEVICE, "Is ieee1394 and raw1394 driver loaded?\n");
55             }
56             return eFBRC_Creating1394HandleFailed;
57         }
58
59         raw1394_set_userdata( m_handle, this );
60
61         if ( raw1394_set_port( m_handle,  m_iPort ) < 0 ) {
62             perror( "Could not set port" );
63             return eFBRC_Setting1394PortFailed;
64         }
65    }
66
67    // enumerate the subunits present in this device, create an AvDeviceSubunit for them, and add this object to the cSubUnits vector
68         unsigned char table_entry;
69         unsigned char subunit_maxid;
70         unsigned char subunit_type;
71         quadlet_t table_entries; // buffer these table entries, because the memory content pointed to by
72                                  // the response pointer can change due to other libraw operations on this handle
73
74         quadlet_t request[6];
75         quadlet_t *response;
76         AvDeviceSubunit *tmpAvDeviceSubunit=NULL;
77
78         // check the number of I/O plugs
79
80         request[0] = AVC1394_CTYPE_STATUS | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE
81                                         | AVC1394_COMMAND_PLUG_INFO | 0x00;
82         request[1] = 0xFFFFFFFF;
83         response = avcExecuteTransaction(request, 2, 2);
84         if (response != NULL) {
85                 iNbIsoDestinationPlugs= (unsigned char) ((response[1]>>24) & 0xff);
86                 iNbIsoSourcePlugs= (unsigned char) ((response[1]>>16) & 0xff);
87                 iNbExtDestinationPlugs= (unsigned char) ((response[1]>>8) & 0xff);
88                 iNbExtSourcePlugs= (unsigned char) ((response[1]>>0) & 0xff);
89         }
90         request[0] = AVC1394_CTYPE_STATUS | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE
91                                         | AVC1394_COMMAND_PLUG_INFO | 0x01;
92         request[1] = 0xFFFFFFFF;
93         response = avcExecuteTransaction(request, 2, 2);
94         if (response != NULL) {
95                 iNbAsyncDestinationPlugs= (unsigned char) ((response[1]>>24) & 0xff);
96                 iNbAsyncSourcePlugs= (unsigned char) ((response[1]>>16) & 0xff);
97         }
98
99         debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: %d Isochronous source plugs, %d Isochronous destination plugs\n",iNbIsoSourcePlugs,iNbIsoDestinationPlugs);
100         debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: %d External source plugs, %d External destination plugs\n",iNbExtSourcePlugs,iNbExtDestinationPlugs);
101         debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: %d Asynchronous source plugs, %d Asynchronous destination plugs\n",iNbAsyncSourcePlugs,iNbAsyncDestinationPlugs);
102
103         // create the subunits
104         for (unsigned int i=0;i<8;i++) { // cycle through the 8 pages (max 32 subunits; 4 subunits/page)
105                 request[0] = AVC1394_CTYPE_STATUS | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE
106                                 | AVC1394_COMMAND_SUBUNIT_INFO | ((i<<4) & 0xF0) | 0x07;
107                 request[1] = 0xFFFFFFFF;
108                 response = avcExecuteTransaction(request, 6, 2);
109
110                 table_entries=response[1];
111
112                 if (response != NULL) {
113                         // this way of processing the table entries assumes that the subunit type is not "extended"
114
115                         // stop processing when a "not implemented" is received (according to spec)
116                         if((response[0]&0xFF000000) == AVC1394_RESPONSE_NOT_IMPLEMENTED) break;
117
118                         // warning: don't do unsigned int j! comparison >= 0 is always true for uint
119                         for (int j=3;j>=0;j--) { // cycle through the 8 pages (max 32 subunits; 4 subunits/page)
120                                 table_entry=(table_entries >> (j*8)) & 0xFF;
121                                 subunit_maxid=table_entry& 0x07;
122                                 subunit_type=(table_entry >> 3) & 0x1F;
123                                 //debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: Page %d, item %d: Table entry=0x%02X, subunit_maxid=0x%02X, subunit_type=0x%02X\n",i,j,table_entry,subunit_maxid,subunit_type);
124
125                                 // according to spec we could stop processing
126                                 // at the first 0xFF entry, but doing it this way
127                                 // is a little more robust
128                                 if (table_entry != 0xFF) {
129                                         for (unsigned char subunit_id=0;subunit_id<subunit_maxid+1;subunit_id++) {
130
131                                                 // only two types of specific subunits are supported: audio and music
132                                                 switch (subunit_type) {
133                                                         case 0x01: // audio subunit
134                                                                 tmpAvDeviceSubunit=new AvDeviceAudioSubunit(this,subunit_id);
135                                                                 if (tmpAvDeviceSubunit) { // test code
136                                                                         //tmpAvDeviceSubunit->printOutputPlugConnections();
137                                                                 }
138                                                         break;
139                                                         case 0x0C: // music subunit
140                                                                 tmpAvDeviceSubunit=new AvDeviceMusicSubunit(this,subunit_id);
141                                                                 /*{ // just a test
142                                                                 AvDeviceMusicSubunit tmpAvDeviceSubunit2(this,subunit_id);
143                                                                 tmpAvDeviceSubunit2.printMusicPlugInfo();
144                                                                 tmpAvDeviceSubunit2.printMusicPlugConfigurations();
145                                                                 tmpAvDeviceSubunit2.printOutputPlugConnections();
146                                                                 tmpAvDeviceSubunit2.test();
147                                                                 }*/
148                                                         break;
149
150                                                         default: // generic
151                                                                 tmpAvDeviceSubunit=new AvDeviceSubunit(this,subunit_type,subunit_id);
152                                                         break;
153                                                 }
154
155                                                 if(tmpAvDeviceSubunit && tmpAvDeviceSubunit->isValid()) {
156                                                         cSubUnits.push_back(tmpAvDeviceSubunit);
157                                                         //setDebugLevel(DEBUG_LEVEL_ALL);
158                                                         debugPrint (DEBUG_LEVEL_DEVICE, "Trying to reserve the subunit...\n");
159                                                         tmpAvDeviceSubunit->reserve(0x01);
160                                                         debugPrint (DEBUG_LEVEL_DEVICE, "  isReserved?: %d\n",tmpAvDeviceSubunit->isReserved());
161                                                         tmpAvDeviceSubunit->unReserve();
162                                                         //setDebugLevel(DEBUG_LEVEL_MODERATE);
163                                                        
164
165                                                 } else {
166                                                         if (tmpAvDeviceSubunit) {
167                                                                 debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: Unsupported AvDeviceSubunit encountered. Page %d, item %d: Table entry=0x%02X, subunit_maxid=0x%02X, subunit_type=0x%02X, subunit_id=%0x02X\n",i,j,table_entry,subunit_maxid,subunit_type,subunit_id);
168
169                                                                 delete tmpAvDeviceSubunit;
170                                                         } else {
171                                                                 debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: Could not create AvDeviceSubunit object.\n");
172                                                         }
173                                                 }
174                                         }
175                                 }
176                         }
177                 }
178         }
179
180    m_bInitialised = true;
181    return eFBRC_Success;
182
183 }
184
185 bool AvDevice::isInitialised() {
186         return m_bInitialised;
187 }
188
189 AvDevice::~AvDevice()
190 {
191
192         vector<AvDeviceSubunit *>::iterator it;
193         for( it = cSubUnits.begin(); it != cSubUnits.end(); it++ ) {
194                 delete *it;
195         }
196
197     if ( m_handle ) {
198         raw1394_destroy_handle( m_handle );
199         m_handle = 0;
200     }
201 }
202
203 /* Function to execute an AVC transaction, i.e. send command/status and get response
204  * main purpose is wrapping the avc1394 function call to output some debugging comments.
205  */
206 quadlet_t * AvDevice::avcExecuteTransaction(quadlet_t *request, unsigned int request_len, unsigned int response_len) {
207         quadlet_t *response;
208         unsigned char *request_pos;
209         unsigned int i;
210         response = avc1394_transaction_block(m_handle, iNodeId, request, request_len, 2);
211         if (request != NULL) {
212                 debugPrint (DEBUG_LEVEL_TRANSFERS, "------- TRANSACTION START -------\n");
213                 debugPrint (DEBUG_LEVEL_TRANSFERS,"  REQUEST:     ");
214                 /* request is in machine byte order. this function is for intel architecure */
215                 for (i=0;i<request_len;i++) {
216                         request_pos=(unsigned char *)(request+i);
217                         debugPrintShort (DEBUG_LEVEL_TRANSFERS, "0x%02X%02X%02X%02X ", *(request_pos),*(request_pos+1),*(request_pos+2),*(request_pos+3));
218                 }
219                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"\n");
220                 debugPrint (DEBUG_LEVEL_TRANSFERS,"      => ");
221                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"                     ");
222                 request_pos=(unsigned char *)(request);
223                 debugPrintShort (DEBUG_LEVEL_TRANSFERS, "subunit_type=%02X  subunit_id=%02X  opcode=%02X",((*(request_pos+1))>>3)&0x1F,(*(request_pos+1))&0x07,(*(request_pos+2))&0xFF);
224                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"\n");
225         }
226         if (response != NULL) {
227                 /* response is in order of receiving, i.e. msb first */
228                 debugPrint (DEBUG_LEVEL_TRANSFERS,"  -> RESPONSE: ");
229                 for (i=0;i<response_len;i++) {
230                         debugPrintShort (DEBUG_LEVEL_TRANSFERS, "0x%08X ", response[i]);
231                 }
232                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"\n");
233                 debugPrint (DEBUG_LEVEL_TRANSFERS,"      => ");
234                 switch (response[0]&0xFF000000) {
235                         case AVC1394_RESPONSE_NOT_IMPLEMENTED:
236                                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"Not Implemented      ");
237                         break;
238                         case AVC1394_RESPONSE_ACCEPTED:
239                                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"Accepted             ");
240                         break;
241                         case AVC1394_RESPONSE_REJECTED:
242                                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"Rejected             ");
243                         break;
244                         case AVC1394_RESPONSE_IN_TRANSITION:
245                                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"In Transition        ");
246                         break;
247                         case AVC1394_RESPONSE_IMPLEMENTED:
248                                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"Implemented / Stable ");
249                         break;
250                         case AVC1394_RESPONSE_CHANGED:
251                                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"Changed              ");
252                         break;
253                         case AVC1394_RESPONSE_INTERIM:
254                                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"Interim              ");
255                         break;
256                         default:
257                                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"Unknown response     ");
258                         break;
259                 }
260                 debugPrintShort (DEBUG_LEVEL_TRANSFERS, "subunit_type=%02X  subunit_id=%02X  opcode=%02X",(response[0]>>19)&0x1F,(response[0]>>16)&0x07,(response[0]>>8)&0xFF);
261                 debugPrintShort (DEBUG_LEVEL_TRANSFERS,"\n");
262         }
263         debugPrint (DEBUG_LEVEL_TRANSFERS, "------- TRANSACTION END -------\n");
264         return response;
265
266 }
267
268 FBReturnCodes AvDevice::setInputPlugSignalFormat(unsigned char plug, unsigned char fmt, quadlet_t fdf) {
269         quadlet_t request[6];
270         quadlet_t *response;
271
272         request[0] = AVC1394_CTYPE_CONTROL | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE
273                                         | AVC1394_COMMAND_INPUT_PLUG_SIGNAL_FORMAT | plug;
274         request[1] = (0x80000000) | ((fmt & 0x3F)<<24) | (fdf & 0x00FFFFFF);
275         response = avcExecuteTransaction(request, 2, 2);
276         if (response != NULL) {
277        
278         }
279
280 }
281
282 FBReturnCodes AvDevice::getInputPlugSignalFormat(unsigned char plug, unsigned char *fmt, quadlet_t *fdf) {
283         quadlet_t request[6];
284         quadlet_t *response;
285
286         request[0] = AVC1394_CTYPE_STATUS | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE
287                                         | AVC1394_COMMAND_INPUT_PLUG_SIGNAL_FORMAT | plug;
288         request[1] = 0xFFFFFFFF;
289         response = avcExecuteTransaction(request, 2, 2);
290         if (response != NULL) {
291                 *fmt=((response[1] >> 24) & 0x3F);
292                 *fdf=response[1]& 0x00FFFFFF;
293         }
294
295 }
296 FBReturnCodes AvDevice::setOutputPlugSignalFormat(unsigned char plug, unsigned char fmt, quadlet_t fdf) {
297         quadlet_t request[6];
298         quadlet_t *response;
299
300         request[0] = AVC1394_CTYPE_CONTROL | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE
301                                         | AVC1394_COMMAND_OUTPUT_PLUG_SIGNAL_FORMAT | plug;
302         request[1] = (0x80000000) | ((fmt & 0x3F)<<24) | (fdf & 0x00FFFFFF);
303         response = avcExecuteTransaction(request, 2, 2);
304         if (response != NULL) {
305        
306         }
307
308 }
309
310 FBReturnCodes AvDevice::getOutputPlugSignalFormat(unsigned char plug, unsigned char *fmt, quadlet_t *fdf) {
311         quadlet_t request[6];
312         quadlet_t *response;
313
314         request[0] = AVC1394_CTYPE_STATUS | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE
315                                         | AVC1394_COMMAND_OUTPUT_PLUG_SIGNAL_FORMAT | plug;
316         request[1] = 0xFFFFFFFF;
317         response = avcExecuteTransaction(request, 2, 2);
318         if (response != NULL) {
319                 *fmt=((response[1] >> 24) & 0x3F);
320                 *fdf=response[1]& 0x00FFFFFF;
321         }
322
323 }
324
325 AvDeviceSubunit *AvDevice::getSubunit(unsigned char type, unsigned char id) {
326         vector<AvDeviceSubunit *>::iterator it;
327         for( it = cSubUnits.begin(); it != cSubUnits.end(); it++ ) {
328                 if ((*it) && ((*it)->getType()==type) && ((*it)->getId()==id)) {
329                         return *it;
330                 }
331         }
332         return NULL;
333
334 }
335
336 #define AVC1394_COMMAND_SIGNAL_SOURCE 0x00001A00
337
338 void AvDevice::printConnections() {
339         quadlet_t request[6];
340         quadlet_t *response;
341                         //setDebugLevel(DEBUG_LEVEL_ALL);
342                        
343         debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: ISO source connections:\n"); 
344
345         for (unsigned int i=0;i<getNbIsoSourcePlugs();i++) {
346                 request[0] = AVC1394_CTYPE_STATUS | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE
347                                                 | AVC1394_COMMAND_SIGNAL_SOURCE | 0xFF;
348                 request[1]=0xFFFEFF00 | ((i & 0xFF));
349                
350                 response = avcExecuteTransaction(request, 2, 2);
351        
352                 if (response != NULL) {
353                         unsigned char output_status=(response[0]&0xE0) >> 5;
354                         unsigned char conv=(response[0]&0x10) >> 4;
355                         unsigned char signal_status=(response[0]&0x0F);
356                        
357                         unsigned int signal_source=((response[1]>>16)&0xFFFF);
358                        
359                         unsigned char source_subunit_type=(signal_source>>11)&0x1F;
360                         unsigned char source_subunit_id=(signal_source>>8)&0x07;
361                         unsigned char source_plug=signal_source&0xFF;
362                        
363                         debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice:   OPCR 0x%02X <- subunit: 0x%02X/0x%02X, plug: 0x%02X (0x%02X / %d / 0x%02X)\n",i, source_subunit_type,source_subunit_id,source_plug,output_status,conv,signal_status);
364                         // find the subunit this plug is connected to
365                         AvDeviceSubunit *tmpSubunit=getSubunit(source_subunit_type,source_subunit_id);
366                         if(tmpSubunit) {
367                                 tmpSubunit->printSourcePlugConnections(source_plug);
368                         }
369                        
370                 }
371         }
372        
373         debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: External source connections:\n");     
374
375         for (unsigned int i=0;i<getNbExtSourcePlugs();i++) {
376                 request[0] = AVC1394_CTYPE_STATUS | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE
377                                                 | AVC1394_COMMAND_SIGNAL_SOURCE | 0xFF;
378                 request[1]=0xFFFEFF00 | ((i & 0xFF)|0x80);
379                
380                 response = avcExecuteTransaction(request, 2, 2);
381        
382                 if (response != NULL) {
383                         unsigned char output_status=(response[0]&0xE0) >> 5;
384                         unsigned char conv=(response[0]&0x10) >> 4;
385                         unsigned char signal_status=(response[0]&0x0F);
386                        
387                         unsigned int signal_source=((response[1]>>16)&0xFFFF);
388                        
389                         unsigned char source_subunit_type=(signal_source>>11)&0x1F;
390                         unsigned char source_subunit_id=(signal_source>>8)&0x07;
391                         unsigned char source_plug=signal_source&0xFF;
392                        
393                         debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice:   EXTOUT 0x%02X <- subunit: 0x%02X/0x%02X, plug: 0x%02X (0x%02X / %d / 0x%02X)\n",i, source_subunit_type,source_subunit_id,source_plug,output_status,conv,signal_status);     
394                        
395                         // find the subunit this plug is connected to
396                         AvDeviceSubunit *tmpSubunit=getSubunit(source_subunit_type,source_subunit_id);
397                         if(tmpSubunit) {
398                                 tmpSubunit->printSourcePlugConnections(source_plug);
399                         }                       
400                 }
401         }
402
403         debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: ISO sink connections:\n");   
404
405         for (unsigned int i=0;i<getNbIsoDestinationPlugs();i++) {
406                 request[0] = AVC1394_CTYPE_STATUS | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE
407                                                 | AVC1394_COMMAND_SIGNAL_SOURCE | 0xFF;
408                 request[1]=0xFFFEFF00 | ((i & 0xFF));
409                
410                 response = avcExecuteTransaction(request, 2, 2);
411        
412                 if (response != NULL) {
413                         unsigned char output_status=(response[0]&0xE0) >> 5;
414                         unsigned char conv=(response[0]&0x10) >> 4;
415                         unsigned char signal_status=(response[0]&0x0F);
416                        
417                         unsigned int signal_source=((response[1]>>16)&0xFFFF);
418                        
419                         unsigned char source_subunit_type=(signal_source>>11)&0x1F;
420                         unsigned char source_subunit_id=(signal_source>>8)&0x07;
421                         unsigned char source_plug=signal_source&0xFF;
422                        
423                         debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice:   OPCR 0x%02X <- subunit: 0x%02X/0x%02X, plug: 0x%02X (0x%02X / %d / 0x%02X)\n",i, source_subunit_type,source_subunit_id,source_plug,output_status,conv,signal_status);
424                         // find the subunit this plug is connected to
425                         AvDeviceSubunit *tmpSubunit=getSubunit(source_subunit_type,source_subunit_id);
426                         if(tmpSubunit) {
427                                 //tmpSubunit->printDestinationPlugConnections(source_plug);
428                         }
429                        
430                 }
431         }
432        
433         debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: External sink connections:\n");       
434
435         for (unsigned int i=0;i<getNbExtDestinationPlugs();i++) {
436                 request[0] = AVC1394_CTYPE_STATUS | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE
437                                                 | AVC1394_COMMAND_SIGNAL_SOURCE | 0xFF;
438                 request[1]=0xFFFEFF00 | ((i & 0xFF)|0x80);
439                
440                 response = avcExecuteTransaction(request, 2, 2);
441        
442                 if (response != NULL) {
443                         unsigned char output_status=(response[0]&0xE0) >> 5;
444                         unsigned char conv=(response[0]&0x10) >> 4;
445                         unsigned char signal_status=(response[0]&0x0F);
446                        
447                         unsigned int signal_source=((response[1]>>16)&0xFFFF);
448                        
449                         unsigned char source_subunit_type=(signal_source>>11)&0x1F;
450                         unsigned char source_subunit_id=(signal_source>>8)&0x07;
451                         unsigned char source_plug=signal_source&0xFF;
452                        
453                         debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice:   EXTOUT 0x%02X <- subunit: 0x%02X/0x%02X, plug: 0x%02X (0x%02X / %d / 0x%02X)\n",i, source_subunit_type,source_subunit_id,source_plug,output_status,conv,signal_status);     
454                        
455                         // find the subunit this plug is connected to
456                         AvDeviceSubunit *tmpSubunit=getSubunit(source_subunit_type,source_subunit_id);
457                         if(tmpSubunit) {
458                                 //tmpSubunit->printDestinationPlugConnections(source_plug);
459                         }                       
460                 }
461         }
462        
463 }
Note: See TracBrowser for help on using the browser.