| 624 | } |
| 625 | |
| 626 | bool CCECProcessor::StartBootloader(const char *strPort /* = NULL */) |
| 627 | { |
| 628 | bool bReturn(false); |
| 629 | // open a connection if no connection has been opened |
| 630 | if (!m_communication && strPort) |
| 631 | { |
| 632 | CAdapterFactory factory(this->m_libcec); |
| 633 | IAdapterCommunication *comm = factory.GetInstance(strPort); |
| 634 | CTimeout timeout(CEC_DEFAULT_CONNECT_TIMEOUT); |
| 635 | int iConnectTry(0); |
| 636 | while (timeout.TimeLeft() > 0 && (bReturn = comm->Open(timeout.TimeLeft() / CEC_CONNECT_TRIES, true)) == false) |
| 637 | { |
| 638 | m_libcec->AddLog(CEC_LOG_ERROR, "could not open a connection (try %d)", ++iConnectTry); |
| 639 | comm->Close(); |
| 640 | Sleep(CEC_DEFAULT_TRANSMIT_RETRY_WAIT); |
| 641 | } |
| 642 | if (comm->IsOpen()) |
| 643 | { |
| 644 | bReturn = comm->StartBootloader(); |
| 645 | SAFE_DELETE(comm); |
| 646 | } |
| 647 | return bReturn; |
| 648 | } |
| 649 | else |
| 650 | { |
| 651 | m_communication->StartBootloader(); |
| 652 | Close(); |
| 653 | bReturn = true; |
| 654 | } |
| 655 | |
| 656 | return bReturn; |
| 657 | } |
| 658 | |
| 659 | bool CCECProcessor::PingAdapter(void) |
| 660 | { |