37 if (iforce->
xmit.head == iforce->
xmit.tail) {
39 spin_unlock_irqrestore(&iforce->
xmit_lock, flags);
43 ((
char *)iforce->out->transfer_buffer)[0] = iforce->
xmit.buf[iforce->
xmit.tail];
45 n = iforce->
xmit.buf[iforce->
xmit.tail];
48 iforce->out->transfer_buffer_length = n + 1;
49 iforce->out->
dev = iforce->usbdev;
55 memcpy(iforce->out->transfer_buffer + 1,
56 &iforce->
xmit.buf[iforce->
xmit.tail],
59 memcpy(iforce->out->transfer_buffer + 1 + c,
67 dev_warn(&iforce->intf->
dev,
"usb_submit_urb failed %d\n", n);
73 spin_unlock_irqrestore(&iforce->
xmit_lock, flags);
76 static void iforce_usb_irq(
struct urb *
urb)
82 switch (urb->status) {
90 dev_dbg(dev,
"%s - urb shutting down with status: %d\n",
91 __func__, urb->status);
94 dev_dbg(dev,
"%s - urb has status of: %d\n",
95 __func__, urb->status);
100 (iforce->
data[0] << 8) | (urb->actual_length - 1), iforce->
data + 1);
105 dev_err(dev,
"%s - usb_submit_urb failed with result %d\n",
109 static void iforce_usb_out(
struct urb *urb)
111 struct iforce *iforce = urb->context;
115 dev_dbg(&iforce->intf->
dev,
"urb->status %d, exiting\n",
125 static void iforce_usb_ctrl(
struct urb *urb)
127 struct iforce *iforce = urb->context;
128 if (urb->status)
return;
129 iforce->
ecmd = 0xff00 | urb->actual_length;
136 struct usb_device *dev = interface_to_usbdev(intf);
139 struct iforce *iforce;
142 interface = intf->cur_altsetting;
144 epirq = &interface->endpoint[0].desc;
145 epout = &interface->endpoint[1].desc;
147 if (!(iforce = kzalloc(
sizeof(
struct iforce) + 32,
GFP_KERNEL)))
160 iforce->usbdev =
dev;
164 iforce->cr.wIndex = 0;
167 usb_fill_int_urb(iforce->irq, dev, usb_rcvintpipe(dev, epirq->bEndpointAddress),
168 iforce->
data, 16, iforce_usb_irq, iforce, epirq->bInterval);
170 usb_fill_int_urb(iforce->out, dev, usb_sndintpipe(dev, epout->
bEndpointAddress),
171 iforce + 1, 32, iforce_usb_out, iforce, epout->
bInterval);
173 usb_fill_control_urb(iforce->ctrl, dev, usb_rcvctrlpipe(dev, 0),
174 (
void*) &iforce->cr, iforce->
edata, 16, iforce_usb_ctrl, iforce);
180 usb_set_intfdata(intf, iforce);
194 static void iforce_usb_disconnect(
struct usb_interface *intf)
196 struct iforce *iforce = usb_get_intfdata(intf);
198 usb_set_intfdata(intf,
NULL);
200 input_unregister_device(iforce->
dev);
210 { USB_DEVICE(0x044f, 0xa01c) },
211 { USB_DEVICE(0x046d, 0xc281) },
212 { USB_DEVICE(0x046d, 0xc291) },
213 { USB_DEVICE(0x05ef, 0x020a) },
214 { USB_DEVICE(0x05ef, 0x8884) },
215 { USB_DEVICE(0x05ef, 0x8888) },
216 { USB_DEVICE(0x061c, 0xc0a4) },
217 { USB_DEVICE(0x061c, 0xc084) },
218 { USB_DEVICE(0x06f8, 0x0001) },
219 { USB_DEVICE(0x06f8, 0x0003) },
220 { USB_DEVICE(0x06f8, 0x0004) },
221 { USB_DEVICE(0x06f8, 0xa302) },
229 .probe = iforce_usb_probe,
230 .disconnect = iforce_usb_disconnect,
231 .id_table = iforce_usb_ids,