44 if (iforce->
xmit.head == iforce->
xmit.tail) {
46 spin_unlock_irqrestore(&iforce->
xmit_lock, flags);
52 serio_write(iforce->serio, 0x2b);
54 serio_write(iforce->serio, iforce->
xmit.buf[iforce->
xmit.tail]);
55 cs ^= iforce->
xmit.buf[iforce->
xmit.tail];
58 for (i=iforce->
xmit.buf[iforce->
xmit.tail]; i >= 0; --i) {
59 serio_write(iforce->serio, iforce->
xmit.buf[iforce->
xmit.tail]);
60 cs ^= iforce->
xmit.buf[iforce->
xmit.tail];
64 serio_write(iforce->serio, cs);
71 spin_unlock_irqrestore(&iforce->
xmit_lock, flags);
74 static void iforce_serio_write_wakeup(
struct serio *
serio)
93 if (data > 3 && data != 0xff)
110 if (iforce->idx < iforce->len) {
111 iforce->csum += iforce->
data[iforce->idx++] =
data;
115 if (iforce->idx == iforce->len) {
127 static int iforce_serio_connect(
struct serio *serio,
struct serio_driver *drv)
129 struct iforce *iforce;
132 iforce = kzalloc(
sizeof(
struct iforce),
GFP_KERNEL);
137 iforce->serio = serio;
139 serio_set_drvdata(serio, iforce);
152 fail1: serio_set_drvdata(serio,
NULL);
157 static void iforce_serio_disconnect(
struct serio *serio)
159 struct iforce *iforce = serio_get_drvdata(serio);
161 input_unregister_device(iforce->
dev);
163 serio_set_drvdata(serio,
NULL);
183 .description =
"RS232 I-Force joysticks and wheels driver",
184 .id_table = iforce_serio_ids,
185 .write_wakeup = iforce_serio_write_wakeup,
186 .interrupt = iforce_serio_irq,
187 .connect = iforce_serio_connect,
188 .disconnect = iforce_serio_disconnect,