[BRLTTY] screen driver in brlapi

Tage Johansson frans.tage at gmail.com
Mon Nov 5 16:23:37 EST 2018


Ok, so I got alot of tips how to solve the problem regarding poll. How 
ever, poll still returns instantly. It returns with POLLIN and POLLERR, 
so something is probably wrong. I'm not a c-program expert, so maybe 
someone can tell me what's wrong.

Here's what I've come up with so far:


#include <stdio.h>
#include <sys/poll.h>
#include <stdint.h>

int main () {
     struct pollfd fd;
     FILE *vcsa = fopen("/dev/vcsa", "rb");
     uint8_t header[4];
     fread(header, 0, sizeof(header), vcsa);
     fd.fd = fileno(vcsa);
     fd.events = POLLIN;
     for(int i = 0; i < 30; i++) {
         int ret = poll(&fd, 1, -1);
         printf("%d ", fd.revents);
     }
     printf("\nPOLLIN = %d POLLERR = %d\n", POLLIN, POLLERR);
     return 0;
}

On my machine, the program prints 30 9s and "POLLIN = 1 POLLERR = 8". It 
terminates instantly, even if I set the number of iterations to 1000. 
Something is clearly wrong!


I am running arch linux with kernel 4.18.16.


Tage



More information about the BRLTTY mailing list