[질문]리눅스 터미널에서 Com port를 통한 데이터 전송시, 데이터 손실 관련 질문

ssun3025의 이미지

안녕하세요,
리눅스 초보자인데요~ 2주째 끙하고 있는 문제가 있어 글올립니다. 고수님들의 답변 부탁드려요~ ^^

리눅스 터미널에서 Com port를 통해 Windows PC로 데이터를 전송하는 중에 Windows PC로 유입되는 특정 데이터의 손실이 발생합니다.
그 데이터는 0x11 과 0x13이구요. 0x0A 일 경우, 0x0D가 강제로 붙어서 들어 왔는데 stty driver -opost를 설정하여 해결 하였습니다.)
tty 설정 옵션에 문제가 있는건가해서 왠만한건 다 해보았는데 해결이 안되네요.. ㅜ.ㅜ
(termios를 사용하면서 발생하는 문제 인 것 같은데.....)

Com port에 데이터를 전송하는 Code는 아래와 같습니다. 이와 같이 하면 Windows PC에서 데이터가 모두 0x00으로들어 옵니다.
(전송 데이터에 상관없이)
--------------------------------------------------------------------------------

if( (file = filp_open(TRACE_DEV, O_RDWR| O_NONBLOCK , 0600)) == NULL)
return FALSE;file->f_op->unlocked_ioctl(file, TCGETA, &newtio);
newtio.c_cflag = B115200 | CS8 |CREAD | CLOCAL | HUPCL;
memset(&newtio.c_cc,0x00,sizeof(newtio.c_cc));
newtio.c_lflag = 0; //Local Mode 설정, ICANON이면 널 문자가 들어올때까지 수신

file->f_op->unlocked_ioctl(file, TCSETA, &newtio);

file->f_pos=0
file->f_op->write(file, buf, buf_size, &file->f_pos);

--------------------------------------------------------------------------------

bootmeta의 이미지

0x11과 0x13을 XON/XOFF (software handshaking) control 문자로 windows쪽에서 사용하는 반면, unix쪽에서 사용하지 않도록 되어있는 것으로 보이네요.(사용하지 않거나, 다른 방법 hardware handshaking)

stty 설정들을 조합하면 가능할 것 같습니다.
stty --help 출력에서 아래처럼 XON, XOFF 항목들이 관련있어 보입니다.

[-]ixoff      enable sending of start/stop characters # handshaking input 지원
[-]ixon       enable XON/XOFF flow control            # software handshaking XON/XOFF 사용

굳이 software handshaking이 불필요하다면 windows 쪽에서 설정을 off시키는 것도 한 방법일 것 같습니다.
http://trick14.egloos.com/4588915
실제 해보지 않아 결과 장담은 못합니다.(해본 경험도 없음 --; 무책임 함 --; )

ps)
1. 생각해보니 ixoff, ixon는 input이군요.
2. wiki(http://en.wikipedia.org/wiki/XON)나 다른 문서들을 보니 일단 software handshaking이 사용되면 data로 XON/XOFF 문자는 사용불가라고 나오네요.
굳이 사용해야한다면 escape 처리를 직접해야할 듯

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.