문제

직렬 포트를 사용하는 일부 모노 코드를 디버깅하고 있습니다. 어느 시점에서 모노는 다음 코드로 테이블을 작성합니다.

   // Send the 1024 byte (256 word) CRC table

    progressBar = new ProgressBar();

    progressBar.Update(0.0,"Sending CRC table...");

    for (int i = 0; i < MyCRC.Length; i++)

    {

        MySP.Write(MyCRC[i].ToString("x8"));

        progressBar.Percent = (((Double)(i+1))/MyCRC.Length);

    }

    progressBar.Update(100.0,"CRC table sent.");

MySP는 시리얼 포트 인스턴스입니다. 그러나 Strace를 사용 하여이 코드를 추적 할 때 다음은 결과 시스템 호출이라고 생각합니다.

16620 write(3, "3ab551ce", 8)           = -1 EAGAIN (Resource temporarily unavailable)
16620 write(3, "\0003ab551c", 8)        = -1 EAGAIN (Resource temporarily unavailable)
16620 write(3, "\0\0003ab551", 8)       = -1 EAGAIN (Resource temporarily unavailable)
16620 write(3, "\0\0\0003ab55", 8)      = -1 EAGAIN (Resource temporarily unavailable)
16620 write(3, "\10\0\0\0003ab5", 8)    = -1 EAGAIN (Resource temporarily unavailable)
16620 write(3, "\0\10\0\0\0003ab", 8)   = -1 EAGAIN (Resource temporarily unavailable)

...

16620 write(3, "\0005\0\230O+\10\0", 8) = -1 EAGAIN (Resource temporarily unavailable)
16620 write(3, "E\0005\0\230O+\10", 8)  = -1 EAGAIN (Resource temporarily unavailable)
16620 write(3, "\0E\0005\0\230O+", 8)   = -1 EAGAIN (Resource temporarily unavailable)
16620 write(3, "\0\0E\0005\0\230O", 8)  = -1 EAGAIN (Resource temporarily unavailable)
16620 write(3, "\0\0\0E\0005\0\230", 8) = -1 EAGAIN (Resource temporarily unavailable)
16620 write(3, "4\0\0\0E\0005\0", 8)    = 8
16620 write(3, "\230O+\10\0\0\0\0", 8)  = 8
16620 write(3, "\0\0\0\0\10\0\0\0", 8)  = -1 EAGAIN (Resource temporarily unavailable)

내 이해는 Serialport Writ 각 시도 후, 원래 버퍼의 내용은 하나의 바이트만큼 이동되기 때문입니다.

내 질문은 알려진 문제입니까, 세 리알 포트 클래스를 어떻게 수정하여 올바르게 작동하거나 직렬 포트를 차단 방식으로 사용하도록하는 방법은 무엇입니까?

그만큼 Serialport 클래스를위한 모노 문서 그다지 도움이되지 않습니다

추가 정보 : 모노 -V 출력 :

Mono JIT compiler version 1.2.6 (tarball)
Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com
    TLS:           __thread
    GC:            Included Boehm (with typed GC)
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  x86
    Disabled:      none
도움이 되었습니까?

해결책

최신 버전으로 업그레이드하는 것을 고려하십시오.

버그가 고정되었습니다 여기.

다른 팁

해결 방법이 있지만 좋은 해결책이라고 생각하지 않습니다.

progressBar = new ProgressBar();

progressBar.Update(0.0,"Sending CRC table...");

for (int i = 0; i < MyCRC.Length; i++)

{

    MySP.Write(MyCRC[i].ToString("x8"));
    while(WySP.BytesToWrite != 0)
    {
        ;
    }
    progressBar.Percent = (((Double)(i+1))/MyCRC.Length);

}

progressBar.Update(100.0,"CRC table sent.");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top