ENTTECProUSB, Linux serial read needs improvement

オープン
#2,055 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
cpp, linux

調査の方向性

Start in common/io/Descriptor.cpp at the Linux-specific Receiver function and inspect how nonblocking serial reads and partial data are handled. Reproduce the ENTTEC Pro USB behavior on Linux if possible, then verify that read readiness and EAGAIN handling prevent checksum errors during discovery and RDM SET/GET operations.

索引モデルが issue の本文から書いたものです。

説明

Hi,
I have a project making a ENTTECproUSB compatible device running on a Linux Box to play with LEDDimmer controls via RDM.
With my workstation an Intel XEON I had little trouble getting the Discovery work reliable but with my Lenovo have the device connected to USB it failed very badly. All kind of Checksum errors happens. I dug deep and found the problem in the common/io/Descriptor.cpp exactly in the Receiver function.
There are two improvements I have done.

  • Populate a EAGAIN error to inform the upper stack about a "do it again kernel wasn't ready"
  • Add an ipctl() to read if they're the amount of data available we want to read and if not wait and check again (exhaust wait time 110ms)

Below the snippet with some other improvements not show here fix the checksum errors and problems with discovery and all RDM SET/GET entirely.

I have sometime in the coming days and will file a pull request.
Regards
Chris

uint32_t available;
uint8_t loop=10;
int fd = ReadDescriptor();
wait_loop:
ret = ioctl(fd, FIONREAD, &available);
if (available < size) {
usleep(100);
loop--;
if (loop>0)
goto wait_loop;
}
ret = read(ReadDescriptor(), data, size - data_read);
if (ret<0) {
if (errno == EAGAIN || errno == EWOULDBLOCK)
return -EAGAIN;
if (errno != EINTR) {
OLA_WARN << "read failed, " << strerror(errno);
return -1;
}
return ret;
}
else if (ret == 0) {
return 0;
}
data_read += ret;
data += data_read;
}
#endif // _WIN32
return 0;

主要言語
C++
スター
773
フォーク
233
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenLightingProject/ola のほかの issue

OpenLightingProject/ola の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。