lkml.org 
[lkml]   [2011]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [RFC PATCH] input: Add wiichuck driver
    On Mon, May 16, 2011 at 1:44 PM, Dmitry Torokhov
    <dmitry.torokhov@gmail.com> wrote:
    > On Mon, May 16, 2011 at 12:31:24PM -0600, Grant Likely wrote:
    >> > > + struct i2c_msg data_msg =
    >> > > +         { .addr = i2c->addr, .flags = I2C_M_RD, .len = 6, .buf = b };
    >> > > + int jx, jy, ax, ay, az;
    >> > > + bool c, z;
    >> > > +
    >> > > + switch (wiichuck->state) {
    >> > > + case 0:
    >> > > +         i2c_transfer(i2c->adapter, &cmd_msg, 1);
    >> > > +         wiichuck->state = 1;
    >> >
    >> > Do you really need to have a state machine here? Why not do both
    >> > transfers in one poll invocation?
    >>
    >> Mostly because there needs to a gap between setting up the data
    >> capture and reading the data back.
    >
    > How long is the gap? You should be able simply sleep in the poll().

    50ms (from what information I've been able to gleen; it might be
    faster). Since I'm already polling the controller at 100ms, a 50ms
    sleep in the poll routine would pretty much completely consume the
    workqueue if 2 or more wii extension devices were attached to the
    system. Voluntarily giving it up is the right thing to do.

    That said, the problem is moot since I've modified the read state to
    setup the next transfer immediately after reading the data. :-)

    Revised patch posted shortly...

    g.
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2011-05-16 23:05    [W:0.022 / U:30.804 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site