Thread (9 messages) 9 messages, 4 authors, 2011-05-16

Re: [RFC PATCH] input: Add wiichuck driver

flat view

From: Grant Likely <hidden>
Date: 2011-05-16 21:02:11
Also in: lkml

On Mon, May 16, 2011 at 1:44 PM, Dmitry Torokhov
[off-list ref] wrote:
On Mon, May 16, 2011 at 12:31:24PM -0600, Grant Likely wrote:
quoted
quoted
quoted
+ 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-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help