Announce: "rotate" program.

Chris Ball cjb at laptop.org
Wed Aug 20 18:11:20 CEST 2008


Hi Aapo,

On Wed, Aug 20, 2008 at 11:35:12AM +0300, Aapo Rantalainen wrote:
> Hi, nice program.
> Why do you not use xrandr -o inverted? It is there but never called.
> (Is it merged with ORIENTATION_NORMAL, about row 136?)

I did this because the final four bytes coming out of the accelerometer
represent which of the quarters of a circle the phone is oriented in.
The orientations I chose to assign to each quarter were:

       nor|mal 
     ---- * -----
     left | right

Now, the previous eight bytes give more data than that, and it would be
very possible to specify ranges in those data to assign to orientations,
giving something more like:

          n
         \ /
        l * r
         / \
          i

I'd be happy to work on that if people would prefer it.  (I like using
the first "quarters" approach more than I thought I would.) 

> I got lots of: " Didn't process a full packet. ",  Why?
> And "EXPECTED: 2 0: 0 0",  what this means?

This is a confusing bug (not fatal, just a warning).  The accelerometer 
sends us a packet composed of four 16-byte lines, but sometimes we're
getting a line missing and an incomplete packet.  I'm getting the data 
all at once with a single read(2) call into a large buffer, so I don't 
understand how I could miss lines.  Does anyone have suggestions?

In any case, when this happens we just throw away that buffer and
resync.  Not the end of the world.

Thanks,

- Chris.
-- 
Chris Ball   <cjb at laptop.org>



More information about the devel mailing list