btlejack icon indicating copy to clipboard operation
btlejack copied to clipboard

Use select() to avoid burning the CPU when reading from the UARTs

Open nviennot opened this issue 6 years ago • 2 comments

nviennot avatar May 13 '19 03:05 nviennot

I tried to use select() when I was developping Btlejack, but always had a bigger latency and sometimes Btlejack missed some packets ... Anyway, I'll give your version a try and see if it saves my CPU :)

virtualabs avatar May 14 '19 04:05 virtualabs

Arguably, the latency should be better with the select() version when using multi devices, because the client will know which devices to read from, as opposed to try them all round robin. So if we have three devices, and only the third device has data to read, then we just return from the select() call, and invoke read() on the right device immediately.

Having said that, I have not benchmarked the latency.

nviennot avatar May 14 '19 04:05 nviennot