ENTTECProUSB, Linux serial read needs improvement

Aperta
#2,055 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
cpp, linux

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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;

Lingua principale
C++
Stelle
771
Fork
234
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenLightingProject/ola

Tutte le issue di OpenLightingProject/ola

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.