33 } iforce_hat_to_axis[16] = {{ 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
41 for (i = 0; i <
LO(cmd); i++)
63 head = iforce->
xmit.head;
64 tail = iforce->
xmit.tail;
69 "not enough space in xmit buffer to send new packet\n");
70 spin_unlock_irqrestore(&iforce->
xmit_lock, flags);
98 spin_unlock_irqrestore(&iforce->
xmit_lock, flags);
102 switch (iforce->
bus) {
104 #ifdef CONFIG_JOYSTICK_IFORCE_232
110 #ifdef CONFIG_JOYSTICK_IFORCE_USB
113 if (iforce->usbdev && empty &&
127 unsigned char data[3];
130 data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0;
141 if (!iforce->
dev->ff)
144 for (i = 0; i < iforce->
dev->ff->max_effects; ++
i) {
152 dev_warn(&iforce->
dev->dev,
"unused effect %04x updated !!!\n", addr);
158 struct input_dev *
dev = iforce->
dev;
160 static int being_used = 0;
164 "re-entrant call to iforce_process %d\n", being_used);
167 #ifdef CONFIG_JOYSTICK_IFORCE_232
186 input_report_abs(dev,
ABS_X, (
__s16) (((
__s16)data[1] << 8) | data[0]));
187 input_report_abs(dev,
ABS_Y, (
__s16) (((
__s16)data[3] << 8) | data[2]));
193 input_report_abs(dev,
ABS_GAS, 255 - data[2]);
194 input_report_abs(dev,
ABS_BRAKE, 255 - data[3]);
197 input_report_abs(dev,
ABS_HAT0X, iforce_hat_to_axis[data[6] >> 4].
x);
198 input_report_abs(dev,
ABS_HAT0Y, iforce_hat_to_axis[data[6] >> 4].
y);
200 for (i = 0; iforce->
type->btn[
i] >= 0; i++)
201 input_report_key(dev, iforce->
type->btn[i], data[(i >> 3) + 5] & (1 << (i & 7)));
207 if (btns & 8) input_report_abs(dev,
ABS_HAT1X, -1);
208 else if (btns & 2) input_report_abs(dev,
ABS_HAT1X, 1);
209 else input_report_abs(dev,
ABS_HAT1X, 0);
212 if (btns & 1) input_report_abs(dev,
ABS_HAT1Y, -1);
213 else if (btns & 4) input_report_abs(dev,
ABS_HAT1Y, 1);
214 else input_report_abs(dev,
ABS_HAT1Y, 0);
223 input_report_key(dev,
BTN_DEAD, data[0] & 0x02);
228 if (data[1] & 0x80) {
239 for (j = 3; j <
LO(cmd); j += 2)
240 mark_core_as_ready(iforce, data[j] | (data[j+1]<<8));
249 switch (iforce->
bus) {
252 #ifdef CONFIG_JOYSTICK_IFORCE_USB
255 iforce->cr.bRequest = packet[0];
256 iforce->ctrl->
dev = iforce->usbdev;
261 "usb_submit_urb failed %d\n", status);
268 if (iforce->ctrl->status) {
270 "iforce->ctrl->status = %d\n",
271 iforce->ctrl->status);
283 #ifdef CONFIG_JOYSTICK_IFORCE_232
296 "iforce_get_id_packet: iforce->bus = SERIO!\n");
302 "iforce_get_id_packet: iforce->bus = %d\n",
307 return -(iforce->
edata[0] != packet[0]);