Changeset 197
- Timestamp:
- 05/16/06 10:29:09 (16 years ago)
- Files:
-
- branches/libfreebob-motu/libfreebob/freebob.h (modified) (1 diff)
- branches/libfreebob-motu/libfreebob/freebob_bounce.h (added)
- branches/libfreebob-motu/src/bounce/bounce_avdevice.cpp (modified) (5 diffs)
- branches/libfreebob-motu/src/bounce/bounce_avdevice.h (modified) (2 diffs)
- branches/libfreebob-motu/src/configrom.cpp (modified) (1 diff)
- branches/libfreebob-motu/src/configrom.h (modified) (1 diff)
- branches/libfreebob-motu/src/devicemanager.cpp (modified) (4 diffs)
- branches/libfreebob-motu/src/devicemanager.h (modified) (1 diff)
- branches/libfreebob-motu/src/freebob.cpp (modified) (1 diff)
- branches/libfreebob-motu/src/Makefile.am (modified) (1 diff)
- branches/libfreebob-motu/src/motu (added)
- branches/libfreebob-motu/src/motu/motu_avdevice.cpp (added)
- branches/libfreebob-motu/src/motu/motu_avdevice.h (added)
- branches/libfreebob-motu/tests/freebob-server.c (modified) (10 diffs)
- branches/libfreebob-motu/tests/test-freebob.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/libfreebob-motu/libfreebob/freebob.h
r185 r197 28 28 #define FREEBOB_BOUNCE_SERVER_VENDORNAME "FreeBoB Server" 29 29 #define FREEBOB_BOUNCE_SERVER_MODELNAME "freebob-server" 30 31 #define FREEBOB_BOUNCE_SERVER_GETXMLDESCRIPTION_CMD 32 #define AVC1394_SUBUNIT_TYPE_FREEBOB_BOUNCE_SERVER 0x0D 30 33 31 34 enum freebob_direction { branches/libfreebob-motu/src/bounce/bounce_avdevice.cpp
r185 r197 30 30 #include <string> 31 31 #include <stdint.h> 32 #include <iostream> 33 #include <netinet/in.h> 32 34 33 35 namespace Bounce { … … 53 55 BounceDevice::~BounceDevice() 54 56 { 55 57 delete m_configRom; 56 58 } 57 59 … … 65 67 BounceDevice::discover() 66 68 { 67 std::string vendor = std::string(FREEBOB_BOUNCE_SERVER_VENDORNAME); 68 std::string model = std::string(FREEBOB_BOUNCE_SERVER_MODELNAME); 69 unsigned int resp_len=0; 70 quadlet_t request[6]; 71 quadlet_t *resp; 69 72 70 if (m_configRom->getVendorName().compare(0,vendor.length(),vendor,0,vendor.length())==0) { 71 if(m_configRom->getModelName().compare(0,model.length(),model,0,model.length())==0) { 72 return true; 73 } 74 } 75 return false; 73 std::string vendor=std::string(FREEBOB_BOUNCE_SERVER_VENDORNAME); 74 std::string model=std::string(FREEBOB_BOUNCE_SERVER_MODELNAME); 75 76 if (!(m_configRom->getVendorName().compare(0,vendor.length(),vendor,0,vendor.length())==0) 77 || !(m_configRom->getModelName().compare(0,model.length(),model,0,model.length())==0)) { 78 return false; 79 } 80 81 // AVC1394_COMMAND_INPUT_PLUG_SIGNAL_FORMAT 82 request[0] = htonl( AVC1394_CTYPE_STATUS | (AVC1394_SUBUNIT_TYPE_FREEBOB_BOUNCE_SERVER << 19) | (0 << 16) 83 | AVC1394_COMMAND_INPUT_PLUG_SIGNAL_FORMAT | 0x00); 84 85 request[1] = 0xFFFFFFFF; 86 resp = m_1394Service->transactionBlock( m_nodeId, 87 request, 88 2, 89 &resp_len ); 90 // hexDump((unsigned char *)request,6*4); 91 if(resp) { 92 char *buffer=(char *)&resp[1]; 93 xmlDescription=buffer; 94 // hexDump((unsigned char *)resp,6*4); 95 } 96 97 return true; 76 98 } 77 99 … … 86 108 { 87 109 printf( "\nI am the bouncedevice, the bouncedevice I am...\n" ); 88 printf( "Vendor : %s\n", m_configRom->getVendorName().c_str()); 89 printf( "Model : %s\n", m_configRom->getModelName().c_str()); 90 printf( "GUID : 0x%016llX\n", m_configRom->getGuid()); 110 printf( "Vendor : %s\n", m_configRom->getVendorName().c_str()); 111 printf( "Model : %s\n", m_configRom->getModelName().c_str()); 112 printf( "Node : %d\n", m_nodeId); 113 printf( "GUID : 0x%016llX\n", m_configRom->getGuid()); 114 printf( "ACV test response : %s\n", xmlDescription.c_str()); 91 115 printf( "\n" ); 92 116 } … … 95 119 BounceDevice::addXmlDescription( xmlNodePtr deviceNode ) 96 120 { 121 122 xmlDocPtr doc; 123 xmlNodePtr cur; 124 xmlNodePtr copy; 125 126 doc = xmlParseFile("freebob_bouncedevice.xml"); 127 128 if (doc == NULL ) { 129 debugError( "freebob_bouncedevice.xml not parsed successfully. \n"); 130 return false; 131 } 132 133 cur = xmlDocGetRootElement(doc); 134 135 if (cur == NULL) { 136 debugError( "empty document\n"); 137 xmlFreeDoc(doc); 138 return false; 139 } 140 141 if (xmlStrcmp(cur->name, (const xmlChar *) "FreeBobBounceDevice")) { 142 debugError( "document of the wrong type, root node != FreeBobBounceDevice\n"); 143 xmlFreeDoc(doc); 144 return false; 145 } 146 147 cur = cur->xmlChildrenNode; 148 while (cur != NULL) { 149 char *result; 150 151 copy=xmlCopyNode(cur,1); 152 153 // debugOutput(DEBUG_LEVEL_NORMAL,"copying %s\n",cur->name); 154 155 156 if (!copy || !xmlAddChild(deviceNode, copy)) { 157 debugError( "could not add child node\n"); 158 cur = cur->next; 159 continue; 160 } 161 162 // add the node id 163 // if (xmlStrcmp(copy->name, (const xmlChar *) "ConnectionSet")) { 164 // asprintf( &result, "%d", m_nodeId); 165 // if ( !xmlNewChild( copy, 0, 166 // BAD_CAST "Node", BAD_CAST result ) ) { 167 // debugError( "Couldn't create 'Node' node\n" ); 168 // return false; 169 // free(result); 170 // } 171 // free(result); 172 // } 173 174 cur = cur->next; 175 } 176 177 xmlFreeDoc(doc); 178 97 179 return true; 98 180 } branches/libfreebob-motu/src/bounce/bounce_avdevice.h
r185 r197 29 29 #include "libfreebobavc/avc_extended_cmd_generic.h" 30 30 #include "libfreebob/xmlparser.h" 31 #include "libfreebob/freebob_bounce.h" 31 32 32 33 class ConfigRom; … … 54 55 int m_verboseLevel; 55 56 57 private: 58 std::string xmlDescription; 59 60 56 61 DECLARE_DEBUG_MODULE; 57 62 }; branches/libfreebob-motu/src/configrom.cpp
r185 r197 354 354 return m_vendorName; 355 355 } 356 357 const unsigned int 358 ConfigRom::getModelId() const 359 { 360 return m_modelId; 361 } 362 363 const unsigned int 364 ConfigRom::getVendorId() const 365 { 366 return m_vendorId; 367 } branches/libfreebob-motu/src/configrom.h
r185 r197 44 44 const std::string getModelName() const; 45 45 const std::string getVendorName() const; 46 46 const unsigned int getModelId() const; 47 const unsigned int getVendorId() const; 47 48 48 49 protected: branches/libfreebob-motu/src/devicemanager.cpp
r188 r197 30 30 #include "bebob_light/bebob_light_avdevice.h" 31 31 #include "bounce/bounce_avdevice.h" 32 #include "motu/motu_avdevice.h" 32 33 33 34 #include <iostream> … … 40 41 : m_1394Service( 0 ) 41 42 { 42 m_probeList.push_back( probeBeBoB ); 43 m_probeList.push_back( probeBounce ); 43 m_probeList.push_back( probeMotu ); 44 // m_probeList.push_back( probeBeBoB ); 45 m_probeList.push_back( probeBounce ); 44 46 } 45 47 … … 137 139 IAvDevice* avDevice = new BeBoB_Light::AvDevice( service, id, level ); 138 140 if ( !avDevice ) { 139 return 0;141 return NULL; 140 142 } 141 143 142 144 if ( !avDevice->discover() ) { 143 145 delete avDevice; 144 return 0;146 return NULL; 145 147 } 146 148 return avDevice; … … 152 154 IAvDevice* avDevice = new Bounce::BounceDevice( service, id, level ); 153 155 if ( !avDevice ) { 154 return 0;156 return NULL; 155 157 } 156 158 157 159 if ( !avDevice->discover() ) { 158 160 delete avDevice; 159 return 0; 161 return NULL; 162 } 163 return avDevice; 164 } 165 166 IAvDevice* 167 DeviceManager::probeMotu(Ieee1394Service& service, int id, int level) 168 { 169 IAvDevice* avDevice = new Motu::MotuDevice( service, id, level ); 170 if ( !avDevice ) { 171 return NULL; 172 } 173 174 if ( !avDevice->discover() ) { 175 delete avDevice; 176 return NULL; 160 177 } 161 178 return avDevice; branches/libfreebob-motu/src/devicemanager.h
r185 r197 59 59 static IAvDevice* probeBeBoB(Ieee1394Service& service, int id, int level); 60 60 static IAvDevice* probeBounce(Ieee1394Service& service, int id, int level); 61 static IAvDevice* probeMotu(Ieee1394Service& service, int id, int level); 61 62 62 63 protected: branches/libfreebob-motu/src/freebob.cpp
r186 r197 1 /* freebob. h1 /* freebob.cpp 2 2 * Copyright (C) 2005 Pieter Palmers, Daniel Wagner 3 3 * branches/libfreebob-motu/src/Makefile.am
r188 r197 52 52 bebob_light/bebob_light_avplug.cpp \ 53 53 bounce/bounce_avdevice.h \ 54 bounce/bounce_avdevice.cpp 54 bounce/bounce_avdevice.cpp \ 55 motu/motu_avdevice.h \ 56 motu/motu_avdevice.cpp 55 57 56 58 libfreebob_la_LDFLAGS = -version-info $(LT_VERSION) -lpthread $(LIBSIGC_LIBS) \ branches/libfreebob-motu/tests/freebob-server.c
r185 r197 37 37 #include <libavc1394/rom1394.h> 38 38 39 #include "../libfreebob/freebob.h" 40 #include "../libfreebob/freebob_bounce.h" 41 39 42 const char not_compatible[] = "\n" 40 43 "This libraw1394 does not work with your version of Linux. You need a different\n" … … 47 50 48 51 49 unsigned char g_signal_mode = 0x05; // SD 525-60, TODO: get from media50 unsigned char g_transport_mode = AVC1394_VCR_CMD_WIND;51 unsigned char g_transport_state = AVC1394_VCR_OPERAND_WIND_STOP;52 53 52 static int g_done = 0; 54 53 … … 64 63 switch ( cr->opcode ) 65 64 { 66 case AVC1394_VCR_CMD_PLAY: 67 switch ( cr->operand[0] ) 68 { 69 case AVC1394_VCR_OPERAND_PLAY_FORWARD: 70 g_transport_mode = AVC1394_GET_OPCODE( AVC1394_VCR_RESPONSE_TRANSPORT_STATE_PLAY ); 71 g_transport_state = AVC1394_VCR_OPERAND_PLAY_FORWARD; 72 cr->status = AVC1394_RESP_ACCEPTED; 73 printf("PLAY FORWARD\n"); 74 break; 65 default: 66 fprintf( stderr, "subunit control command 0x%02x non supported\n", cr->opcode ); 67 return 0; 68 } 69 return 1; 70 } 71 72 int subunit_status( avc1394_cmd_rsp *cr ) 73 { 74 75 fprintf( stderr, "subunit STATUS\n"); 76 char *buffer; 77 switch ( cr->opcode ) 78 { 79 case (AVC1394_CMD_INPUT_PLUG_SIGNAL_FORMAT): 80 81 cr->status = AVC1394_RESP_STABLE; 82 buffer=(char*)&cr->operand[1]; 83 fprintf( stderr, "subunit AVC1394_COMMAND_INPUT_PLUG_SIGNAL_FORMAT\n"); 75 84 76 case AVC1394_VCR_OPERAND_PLAY_FASTEST_FORWARD: 77 g_transport_mode = AVC1394_GET_OPCODE( AVC1394_VCR_RESPONSE_TRANSPORT_STATE_PLAY ); 78 g_transport_state = AVC1394_VCR_OPERAND_PLAY_FASTEST_FORWARD; 79 cr->status = AVC1394_RESP_ACCEPTED; 80 printf("PLAY FASTEST FORWARD\n"); 81 break; 82 83 case AVC1394_VCR_OPERAND_PLAY_REVERSE_PAUSE: 84 g_transport_mode = AVC1394_GET_OPCODE( AVC1394_VCR_RESPONSE_TRANSPORT_STATE_PLAY ); 85 g_transport_state = cr->operand[0]; 86 cr->status = AVC1394_RESP_ACCEPTED; 87 printf("PAUSE PLAY\n"); 88 break; 89 90 case AVC1394_VCR_OPERAND_PLAY_REVERSE: 91 g_transport_mode = AVC1394_GET_OPCODE( AVC1394_VCR_RESPONSE_TRANSPORT_STATE_PLAY ); 92 g_transport_state = AVC1394_VCR_OPERAND_PLAY_REVERSE; 93 cr->status = AVC1394_RESP_ACCEPTED; 94 printf("PLAY REVERSE\n"); 95 break; 96 97 case AVC1394_VCR_OPERAND_PLAY_FASTEST_REVERSE: 98 g_transport_mode = AVC1394_GET_OPCODE( AVC1394_VCR_RESPONSE_TRANSPORT_STATE_PLAY ); 99 g_transport_state = AVC1394_VCR_OPERAND_PLAY_FASTEST_REVERSE; 100 cr->status = AVC1394_RESP_ACCEPTED; 101 printf("PLAY FASTEST REVERSE\n"); 102 break; 103 104 case AVC1394_VCR_OPERAND_PLAY_NEXT_FRAME: 105 g_transport_mode = AVC1394_GET_OPCODE( AVC1394_VCR_RESPONSE_TRANSPORT_STATE_PLAY ); 106 g_transport_state = cr->operand[0]; 107 cr->status = AVC1394_RESP_ACCEPTED; 108 printf("PLAY NEXT FRAME\n"); 109 break; 110 111 case AVC1394_VCR_OPERAND_PLAY_PREVIOUS_FRAME: 112 g_transport_mode = AVC1394_GET_OPCODE( AVC1394_VCR_RESPONSE_TRANSPORT_STATE_PLAY ); 113 g_transport_state = cr->operand[0]; 114 cr->status = AVC1394_RESP_ACCEPTED; 115 printf("PLAY PREVIOUS FRAME\n"); 116 break; 117 118 default: 119 fprintf( stderr, "play mode 0x%02x non supported\n", cr->operand[0] ); 120 return 0; 121 } 85 strncpy(buffer,"TEST123",sizeof(byte_t)*9); 122 86 break; 123 124 default:125 fprintf( stderr, "subunit control command 0x%02x non supported\n", cr->opcode );126 return 0;127 }128 return 1;129 }130 131 132 int subunit_status( avc1394_cmd_rsp *cr )133 {134 switch ( cr->opcode )135 {136 case AVC1394_VCR_CMD_OUTPUT_SIGNAL_MODE:137 cr->status = AVC1394_RESP_STABLE;138 cr->operand[0] = g_signal_mode;139 break;140 87 default: 141 88 fprintf( stderr, "subunit status command 0x%02x not supported\n", cr->opcode ); … … 150 97 switch ( cr->opcode ) 151 98 { 152 case AVC1394_VCR_CMD_PLAY:153 case AVC1394_VCR_CMD_RECORD:154 case AVC1394_VCR_CMD_WIND:155 case AVC1394_VCR_CMD_OUTPUT_SIGNAL_MODE:156 case AVC1394_VCR_CMD_INPUT_SIGNAL_MODE:157 case AVC1394_VCR_CMD_TRANSPORT_STATE:158 case AVC1394_VCR_CMD_TIME_CODE:159 case AVC1394_VCR_CMD_MEDIUM_INFO:160 cr->status = AVC1394_RESP_IMPLEMENTED;161 return 1;162 99 default: 163 100 fprintf( stderr, "subunit inquiry command 0x%02x not supported\n", cr->opcode ); … … 183 120 int unit_status( avc1394_cmd_rsp *cr ) 184 121 { 185 cr->operand[1] = 0x ff;186 cr->operand[2] = 0x ff;187 cr->operand[3] = 0x ff;188 cr->operand[4] = 0x ff;122 cr->operand[1] = 0x00; 123 cr->operand[2] = 0x00; 124 cr->operand[3] = 0x00; 125 cr->operand[4] = 0x00; 189 126 switch ( cr->opcode ) 190 127 { … … 192 129 cr->status = AVC1394_RESP_STABLE; 193 130 cr->operand[0] = AVC1394_OPERAND_UNIT_INFO_EXTENSION_CODE; 194 cr->operand[1] = AVC1394_SUBUNIT_TYPE_ TAPE_RECORDER >> 19;131 cr->operand[1] = AVC1394_SUBUNIT_TYPE_FREEBOB_BOUNCE_SERVER >> 19; 195 132 break; 196 133 case AVC1394_CMD_SUBUNIT_INFO: … … 201 138 cr->status = AVC1394_RESP_STABLE; 202 139 cr->operand[0] = (page << 4) | AVC1394_OPERAND_UNIT_INFO_EXTENSION_CODE; 203 cr->operand[1] = AVC1394_SUBUNIT_TYPE_ TAPE_RECORDER >> 19 << 3;140 cr->operand[1] = AVC1394_SUBUNIT_TYPE_FREEBOB_BOUNCE_SERVER >> 19 << 3; 204 141 } 205 142 … … 239 176 switch ( cr->subunit_type ) 240 177 { 241 case AVC1394_SUBUNIT_T APE_RECORDER:178 case AVC1394_SUBUNIT_TYPE_FREEBOB_BOUNCE_SERVER: 242 179 if ( cr->subunit_id != 0 ) 243 180 { … … 353 290 /* change the vendor description for kicks */ 354 291 i = strlen(dir.textual_leafs[0]); 355 strncpy(dir.textual_leafs[0], "FreeBob Server", i);292 strncpy(dir.textual_leafs[0], FREEBOB_BOUNCE_SERVER_VENDORNAME " ", i); 356 293 retval = rom1394_set_directory(rom, &dir); 357 294 printf("rom1394_set_directory returned %d, romsize %d:",retval,rom_size); … … 369 306 dir.unit_spec_id = 0x0000a02d; 370 307 dir.unit_sw_version = 0x00010001; 371 leaf = "freebob-server";308 leaf = FREEBOB_BOUNCE_SERVER_MODELNAME; 372 309 dir.nr_textual_leafs = 1; 373 310 dir.textual_leafs = &leaf; branches/libfreebob-motu/tests/test-freebob.c
r185 r197 22 22 23 23 #include "libfreebob/freebob.h" 24 #include "libfreebob/freebob_bounce.h" 24 25 25 26 #include <argp.h>