Package: bluez
Version: all

tools/rfcomm.c has a ppoll() with 200ns timeout. It just appears to be
there to detect when the program should end, and takes about 35% CPU
on a raspberry pi 4.

If I change it to 10'000'000 (10ms) it seems to not have any
functional impact aside from making the CPU problems go away.

E.g. running:
 sudo tools/rfcomm watch hci0 1 getty rfcomm0 115200 vt100
doesn't take any CPU initially, but if one connects to the port it
busyloops. It works, but it busyloops.

The fix is simple. Change line 260 of tools/rfcomm.c to read:
                            ts.tv_nsec = 10000000;

Reply via email to