iforce->dev.ff_effects_max, FF_EFFECTS_MAX); iforce->dev.ff_effects_max = FF_EFFECTS_MAX; 
iforce->dev->ff_effects_max, FF_EFFECTS_MAX); iforce->dev->ff_effects_max = FF_EFFECTS_MAX; 
int iforce_init_device(struct iforce *iforce){	unsigned char c[] = "CEOV";	int i;	init_waitqueue_head(&iforce->wait);	spin_lock_init(&iforce->xmit_lock);	init_MUTEX(&iforce->mem_mutex);	iforce->xmit.buf = iforce->xmit_data;	iforce->dev.ff_effects_max = 10;/* * Input device fields. */	switch (iforce->bus) {#ifdef CONFIG_JOYSTICK_IFORCE_USB	case IFORCE_USB:		iforce->dev.id.bustype = BUS_USB;		iforce->dev.dev = &iforce->usbdev->dev;		break;#endif#ifdef CONFIG_JOYSTICK_IFORCE_232	case IFORCE_232:		iforce->dev.id.bustype = BUS_RS232;		iforce->dev.dev = &iforce->serio->dev;		break;#endif	}	iforce->dev.private = iforce;	iforce->dev.name = "Unknown I-Force device";	iforce->dev.open = iforce_open;	iforce->dev.close = iforce_release;	iforce->dev.flush = iforce_flush;	iforce->dev.event = iforce_input_event;	iforce->dev.upload_effect = iforce_upload_effect;	iforce->dev.erase_effect = iforce_erase_effect;/* * On-device memory allocation. */	iforce->device_memory.name = "I-Force device effect memory";	iforce->device_memory.start = 0;	iforce->device_memory.end = 200;	iforce->device_memory.flags = IORESOURCE_MEM;	iforce->device_memory.parent = NULL;	iforce->device_memory.child = NULL;	iforce->device_memory.sibling = NULL;/* * Wait until device ready - until it sends its first response. */	for (i = 0; i < 20; i++)		if (!iforce_get_id_packet(iforce, "O"))			break;	if (i == 20) { /* 5 seconds */		printk(KERN_ERR "iforce-main.c: Timeout waiting for response from device.\n");		return -1;	}/* * Get device info. */	if (!iforce_get_id_packet(iforce, "M"))		iforce->dev.id.vendor = (iforce->edata[2] << 8) | iforce->edata[1];	else		printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet M\n");	if (!iforce_get_id_packet(iforce, "P"))		iforce->dev.id.product = (iforce->edata[2] << 8) | iforce->edata[1];	else		printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet P\n");	if (!iforce_get_id_packet(iforce, "B"))		iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1];	else		printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet B\n");	if (!iforce_get_id_packet(iforce, "N"))		iforce->dev.ff_effects_max = iforce->edata[1];	else		printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet N\n");	/* Check if the device can store more effects than the driver can really handle */	if (iforce->dev.ff_effects_max > FF_EFFECTS_MAX) {		printk(KERN_WARNING "input??: Device can handle %d effects, but N_EFFECTS_MAX is set to %d in iforce.h\n",			iforce->dev.ff_effects_max, FF_EFFECTS_MAX);		iforce->dev.ff_effects_max = FF_EFFECTS_MAX;	}/* * Display additional info. */	for (i = 0; c[i]; i++)		if (!iforce_get_id_packet(iforce, c + i))			iforce_dump_packet("info", iforce->ecmd, iforce->edata);/* * Disable spring, enable force feedback. * FIXME: We should use iforce_set_autocenter() et al here. */	iforce_send_packet(iforce, FF_CMD_AUTOCENTER, "\004\000");/* * Find appropriate device entry */	for (i = 0; iforce_device[i].idvendor; i++)		if (iforce_device[i].idvendor == iforce->dev.id.vendor &&		    iforce_device[i].idproduct == iforce->dev.id.product)			break;	iforce->type = iforce_device + i;	iforce->dev.name = iforce->type->name;/* * Set input device bitfields and ranges. */	iforce->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_FF) | BIT(EV_FF_STATUS);	for (i = 0; iforce->type->btn[i] >= 0; i++) {		signed short t = iforce->type->btn[i];		set_bit(t, iforce->dev.keybit);	}	set_bit(BTN_DEAD, iforce->dev.keybit);	for (i = 0; iforce->type->abs[i] >= 0; i++) {		signed short t = iforce->type->abs[i];		set_bit(t, iforce->dev.absbit);		switch (t) {			case ABS_X:			case ABS_Y:			case ABS_WHEEL:				iforce->dev.absmax[t] =  1920;				iforce->dev.absmin[t] = -1920;				iforce->dev.absflat[t] = 128;				iforce->dev.absfuzz[t] = 16;				set_bit(t, iforce->dev.ffbit);				break;			case ABS_THROTTLE:			case ABS_GAS:			case ABS_BRAKE:				iforce->dev.absmax[t] = 255;				iforce->dev.absmin[t] = 0;				break;			case ABS_RUDDER:				iforce->dev.absmax[t] = 127;				iforce->dev.absmin[t] = -128;				break;			case ABS_HAT0X:			case ABS_HAT0Y:		        case ABS_HAT1X:		        case ABS_HAT1Y:				iforce->dev.absmax[t] =  1;				iforce->dev.absmin[t] = -1;				break;		}	}	for (i = 0; iforce->type->ff[i] >= 0; i++)		set_bit(iforce->type->ff[i], iforce->dev.ffbit);/* * Register input device. */	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,		iforce->device_memory.end);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/17dd3f0f7aa729a042af5d3318ff9b3e7781b45b/iforce-main.c/buggy/drivers/input/joystick/iforce/iforce-main.c