Ticket #4133: myth_tone_switch_r14623.diff
File myth_tone_switch_r14623.diff, 6.5 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/diseqc.h
224 224 kTypeLegacySW21 = 3, 225 225 kTypeLegacySW42 = 4, 226 226 kTypeLegacySW64 = 5, 227 kTypeVoltage = 6, 228 kTypeMiniDiSEqC = 7, 227 229 }; 228 230 void SetType(dvbdev_switch_t type) { m_type = type; } 229 231 void SetNumPorts(uint num_ports); … … 252 254 253 255 254 256 protected: 255 bool ExecuteLegacy(const DiSEqCDevSettings&, const DTVMultiplex&, uint pos); 256 bool ExecuteTone( const DiSEqCDevSettings&, const DTVMultiplex&, uint pos); 257 bool ExecuteDiseqc(const DiSEqCDevSettings&, const DTVMultiplex&, uint pos); 257 bool ExecuteLegacy( const DiSEqCDevSettings&, const DTVMultiplex&, uint pos); 258 bool ExecuteTone( const DiSEqCDevSettings&, const DTVMultiplex&, uint pos); 259 bool ExecuteVoltage( const DiSEqCDevSettings&, const DTVMultiplex&, uint pos); 260 bool ExecuteMiniDiSEqC(const DiSEqCDevSettings&, const DTVMultiplex&, uint pos); 261 bool ExecuteDiseqc( const DiSEqCDevSettings&, const DTVMultiplex&, uint pos); 258 262 259 int GetPosition( const DiSEqCDevSettings&) const;263 int GetPosition( const DiSEqCDevSettings&) const; 260 264 261 265 private: 262 266 dvbdev_switch_t m_type; … … 266 270 uint m_last_horizontal; 267 271 dvbdev_vec_t m_children; 268 272 269 static const TypeTable SwitchTypeTable[ 7];273 static const TypeTable SwitchTypeTable[9]; 270 274 }; 271 275 272 276 class DiSEqCDevRotor : public DiSEqCDevDevice -
libs/libmythtv/diseqcsettings.cpp
147 147 148 148 addSelection(DeviceTree::tr("Tone"), 149 149 QString::number((uint) DiSEqCDevSwitch::kTypeTone)); 150 addSelection(DeviceTree::tr("Voltage"), 151 QString::number((uint) DiSEqCDevSwitch::kTypeVoltage)); 152 addSelection(DeviceTree::tr("Mini DiSEqC"), 153 QString::number((uint) DiSEqCDevSwitch::kTypeMiniDiSEqC)); 150 154 addSelection(DeviceTree::tr("DiSEqC"), 151 155 QString::number((uint) 152 156 DiSEqCDevSwitch::kTypeDiSEqCCommitted)); … … 232 236 switch ((DiSEqCDevSwitch::dvbdev_switch_t) m_type->getValue().toUInt()) 233 237 { 234 238 case DiSEqCDevSwitch::kTypeTone: 239 case DiSEqCDevSwitch::kTypeVoltage: 240 case DiSEqCDevSwitch::kTypeMiniDiSEqC: 235 241 case DiSEqCDevSwitch::kTypeLegacySW21: 236 242 case DiSEqCDevSwitch::kTypeLegacySW42: 237 243 m_ports->setValue("2"); -
libs/libmythtv/diseqc.cpp
936 936 * \brief Switch class, including tone, legacy and DiSEqC switches. 937 937 */ 938 938 939 const DiSEqCDevDevice::TypeTable DiSEqCDevSwitch::SwitchTypeTable[ 7] =939 const DiSEqCDevDevice::TypeTable DiSEqCDevSwitch::SwitchTypeTable[9] = 940 940 { 941 941 { "legacy_sw21", kTypeLegacySW21 }, 942 942 { "legacy_sw42", kTypeLegacySW42 }, … … 944 944 { "tone", kTypeTone }, 945 945 { "diseqc", kTypeDiSEqCCommitted }, 946 946 { "diseqc_uncom", kTypeDiSEqCUncommitted }, 947 { "voltage", kTypeVoltage }, 948 { "mini_diseqc", kTypeMiniDiSEqC }, 947 949 { QString::null, kTypeTone }, 948 950 }; 949 951 … … 987 989 case kTypeTone: 988 990 success = ExecuteTone(settings, tuning, pos); 989 991 break; 992 case kTypeVoltage: 993 success = ExecuteVoltage(settings, tuning, pos); 994 break; 995 case kTypeMiniDiSEqC: 996 success = ExecuteMiniDiSEqC(settings, tuning, pos); 997 break; 990 998 case kTypeDiSEqCCommitted: 991 999 case kTypeDiSEqCUncommitted: 992 1000 success = ExecuteDiseqc(settings, tuning, pos); … … 1320 1328 } 1321 1329 1322 1330 #ifdef USING_DVB 1331 static bool set_tone(int fd, fe_sec_tone_mode tone) 1332 { 1333 (void) fd; 1334 (void) tone; 1335 1336 bool success = false; 1337 1338 for (uint retry = 0; !success && (retry < TIMEOUT_RETRIES); retry++) 1339 { 1340 if(ioctl(fd, FE_SET_TONE, tone) == 0) 1341 success = true; 1342 else 1343 usleep(TIMEOUT_WAIT); 1344 } 1345 1346 if(!success) 1347 { 1348 VERBOSE(VB_IMPORTANT, "set_tone failed" + ENO); 1349 } 1350 1351 return success; 1352 } 1353 1354 static bool set_voltage(int fd, fe_sec_voltage volt) 1355 { 1356 (void) fd; 1357 (void) volt; 1358 1359 bool success = false; 1360 1361 for (uint retry = 0; !success && (retry < TIMEOUT_RETRIES); retry++) 1362 { 1363 if (ioctl(fd, FE_SET_VOLTAGE, volt) == 0) 1364 success = true; 1365 else 1366 usleep(TIMEOUT_WAIT); 1367 } 1368 1369 if (!success) 1370 { 1371 VERBOSE(VB_IMPORTANT, "FE_SET_VOLTAGE failed" + ENO); 1372 } 1373 1374 return success; 1375 } 1376 1323 1377 static bool mini_diseqc(int fd, fe_sec_mini_cmd cmd) 1324 1378 { 1325 1379 (void) fd; … … 1352 1406 QString("%1/2").arg(pos + 1)); 1353 1407 1354 1408 #ifdef USING_DVB 1355 if ( mini_diseqc(m_tree.GetFD(), pos == 0 ? SEC_MINI_A : SEC_MINI_B))1409 if (set_tone(m_tree.GetFD(), pos == 0 ? SEC_TONE_OFF : SEC_TONE_ON)) 1356 1410 return true; 1357 1411 #endif // USING_DVB 1358 1412 … … 1360 1414 return false; 1361 1415 } 1362 1416 1417 bool DiSEqCDevSwitch::ExecuteVoltage(const DiSEqCDevSettings &/*settings*/, 1418 const DTVMultiplex &/*tuning*/, 1419 uint pos) 1420 { 1421 VERBOSE(VB_CHANNEL, LOC + "Changing to Voltage Switch port " + 1422 QString("%1/2").arg(pos + 1)); 1423 1424 #ifdef USING_DVB 1425 if (set_voltage(m_tree.GetFD(), pos == 0 ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18)) 1426 return true; 1427 #endif // USING_DVB 1428 VERBOSE(VB_IMPORTANT, LOC_ERR + "Setting Voltage Switch failed." + ENO); 1429 return false; 1430 } 1431 1432 bool DiSEqCDevSwitch::ExecuteMiniDiSEqC(const DiSEqCDevSettings &/*settings*/, 1433 const DTVMultiplex &/*tuning*/, 1434 uint pos) 1435 { 1436 VERBOSE(VB_CHANNEL, LOC + "Changing to MiniDiSEqC Switch port " + 1437 QString("%1/2").arg(pos + 1)); 1438 1439 #ifdef USING_DVB 1440 if (mini_diseqc(m_tree.GetFD(), pos == 0 ? SEC_MINI_A : SEC_MINI_B)) 1441 return true; 1442 #endif // USING_DVB 1443 VERBOSE(VB_IMPORTANT, LOC_ERR + "Setting Mini DiSEqC Switch failed." + ENO); 1444 return false; 1445 } 1446 1363 1447 bool DiSEqCDevSwitch::ShouldSwitch(const DiSEqCDevSettings &settings, 1364 1448 const DTVMultiplex &tuning) const 1365 1449 {