From: johann d. <jd...@us...> - 2002-02-03 19:37:40
|
Update of /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick/iforce In directory usw-pr-cvs1:/tmp/cvs-serv8775 Modified Files: iforce-main.c iforce-usb.c iforce.h Log Message: Got rid of name and open members of struct iforce. They duplicate data available somewhere else. Small USB fixes. Index: iforce-main.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick/iforce/iforce-main.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- iforce-main.c 2002/02/02 19:28:35 1.10 +++ iforce-main.c 2002/02/03 19:37:37 1.11 @@ -221,23 +221,21 @@ { struct iforce *iforce = dev->private; +printk(KERN_DEBUG "In iforce_open\n"); + switch (iforce->bus) { #ifdef IFORCE_USB case IFORCE_USB: - if (!iforce->open) { - iforce->irq.dev = iforce->usbdev; - if (usb_submit_urb(&iforce->irq)) - return -EIO; - } +printk(KERN_DEBUG "Submitting irq URB\n"); + iforce->irq.dev = iforce->usbdev; + if (usb_submit_urb(&iforce->irq)) + return -EIO; break; #endif } /* Enable force feedback */ - if (!iforce->open) - iforce_send_packet(iforce, FF_CMD_ENABLE, "\004"); - - iforce->open++; + iforce_send_packet(iforce, FF_CMD_ENABLE, "\004"); return 0; } @@ -275,26 +273,24 @@ /* Disable force feedback playback */ iforce_send_packet(iforce, FF_CMD_ENABLE, "\001"); - switch (iforce->bus) { #ifdef IFORCE_USB case IFORCE_USB: - if (!--iforce->open) { - usb_unlink_urb(&iforce->irq); - usb_unlink_urb(&iforce->out); +printk(KERN_DEBUG "Unlinking irq URB\n"); + usb_unlink_urb(&iforce->irq); + usb_unlink_urb(&iforce->out); - /* The device was unplugged before the file - * was released */ - if (iforce->usbdev == NULL) { - iforce_delete(iforce); - } + /* The device was unplugged before the file + * was released */ + if (iforce->usbdev == NULL) { + iforce_delete_device(iforce); } - break; + break; #endif } } -void iforce_delete(struct iforce *iforce) +void iforce_delete_device(struct iforce *iforce) { #ifdef IFORCE_USB iforce_usb_delete(iforce); @@ -351,7 +347,7 @@ if (i == 20) { /* 5 seconds */ printk(KERN_ERR "iforce.c: Timeout waiting for response from device.\n"); - iforce_delete(iforce); + iforce_delete_device(iforce); return -1; } @@ -401,8 +397,6 @@ iforce->type = iforce_device + i; - strncpy(iforce->name, iforce->type->name, 64); - /* * Set input device bitfields and ranges. */ @@ -462,6 +456,8 @@ */ input_register_device(&iforce->dev); + + printk(KERN_DEBUG "iforce->dev.open = %p\n", iforce->dev.open); printk(KERN_INFO "input: %s [%d effects, %ld bytes memory]\n", iforce->dev.name, iforce->dev.ff_effects_max, Index: iforce-usb.c =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick/iforce/iforce-usb.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- iforce-usb.c 2002/02/02 19:28:35 1.10 +++ iforce-usb.c 2002/02/03 19:37:37 1.11 @@ -1,8 +1,8 @@ /* * $Id$ * - * Copyright (c) 2000-2001 Vojtech Pavlik <vo...@uc...> - * Copyright (c) 2001 Johann Deneux <de...@if...> + * Copyright (c) 2000-2002 Vojtech Pavlik <vo...@uc...> + * Copyright (c) 2001-2002 Johann Deneux <de...@if...> * * USB/RS232 I-Force joysticks and wheels. */ @@ -118,14 +118,13 @@ iforce->cr.wIndex = 0; iforce->cr.wLength = 16; - /* FIXME: use lower-case versions instead with 2.5 */ - FILL_INT_URB(&iforce->irq, dev, usb_rcvintpipe(dev, epirq->bEndpointAddress), + usb_fill_int_urb(&iforce->irq, dev, usb_rcvintpipe(dev, epirq->bEndpointAddress), iforce->data, 16, iforce_usb_irq, iforce, epirq->bInterval); - FILL_BULK_URB(&iforce->out, dev, usb_sndbulkpipe(dev, epout->bEndpointAddress), + usb_fill_bulk_urb(&iforce->out, dev, usb_sndbulkpipe(dev, epout->bEndpointAddress), iforce + 1, 32, iforce_usb_out, iforce); - FILL_CONTROL_URB(&iforce->ctrl, dev, usb_rcvctrlpipe(dev, 0), + usb_fill_control_urb(&iforce->ctrl, dev, usb_rcvctrlpipe(dev, 0), (void*) &iforce->cr, iforce->edata, 16, iforce_usb_ctrl, iforce); if (iforce_init_device(iforce)) { @@ -147,11 +146,13 @@ static void iforce_usb_disconnect(struct usb_device *dev, void *ptr) { struct iforce *iforce = ptr; + int open = iforce->dev.handle->open; + iforce->usbdev = NULL; input_unregister_device(&iforce->dev); - if (iforce->open <= 0) - iforce_delete(iforce); + if (!open) + iforce_delete_device(iforce); } static struct usb_device_id iforce_usb_ids [] = { Index: iforce.h =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/drivers/input/joystick/iforce/iforce.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- iforce.h 2002/02/02 19:28:35 1.8 +++ iforce.h 2002/02/03 19:37:37 1.9 @@ -122,8 +122,6 @@ struct iforce { struct input_dev dev; /* Input device interface */ struct iforce_device *type; - char name[64]; - int open; int bus; unsigned char data[IFORCE_MAX_LENGTH]; @@ -177,7 +175,7 @@ /* iforce-main.c */ int iforce_init_device(struct iforce *iforce); -void iforce_delete(struct iforce *iforce); +void iforce_delete_device(struct iforce *iforce); /* iforce-packets.c */ int iforce_control_playback(struct iforce*, u16 id, unsigned int); |