> Date: Tue, 22 Dec 2015 12:42:38 +0100
> From: Joerg Jung <[email protected]>
> 
> On Mon, Dec 21, 2015 at 10:38:24PM +0100, Mark Kettenis wrote:
> > There were two reasons for this slowness:
> > 
> > 1. The asmc_command() function does additional reads as a "sanity
> >    flush".  We had to wait for these reads to time out, which took a
> >    significant fraction of a second.  On my system, I neversaw any of
> >    these flusing reads succeed.  So I removed that bit of code.
> 
> I added this sanity flush, because Apple seems to keep changing the
> returned number of bytes for some keys depending on the firmware
> revision.  An example for are the light sensors keys "ALVn": on newer
> Macbooks they return 10 bytes, while on older they return only 6 Bytes.
> The reason is that newer Macbooks provide the Lux value directly
> (instead of ADC raw data) in the added four bytes (see asmc_light).
> 
> So from my understanding: if the buffer is not emptied/flushed you might
> read the data from previous command with the next key? Maybe I got that
> wrong?

I actually suspect that the SMC will clear the OBF flag whenever you
send it a new command.  If that is indeed the case, flushing the read
buffer should not be necessary.

Reply via email to