#ifdef CONFIG_INPUT /* Register input device for button */ memset(&cam->input, 0, sizeof(struct input_dev)); cam->input.name = "Konicawc snapshot button"; cam->input.private = cam; cam->input.evbit[0] = BIT(EV_KEY); cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0); usb_to_input_id(dev, &cam->input.id); input_register_device(&cam->input);  usb_make_path(dev, cam->input_physname, 56); strcat(cam->input_physname, "/input0"); cam->input.phys = cam->input_physname; info("konicawc: %s on %s\n", cam->input.name, cam->input.phys); #endif 
 konicawc_register_input(cam, dev); 
static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id *devid){	struct usb_device *dev = interface_to_usbdev(intf);	struct uvd *uvd = NULL;	int ix, i, nas;	int actInterface=-1, inactInterface=-1, maxPS=0;	unsigned char video_ep = 0;	DEBUG(1, "konicawc_probe(%p)", intf);	/* We don't handle multi-config cameras */	if (dev->descriptor.bNumConfigurations != 1)		return -ENODEV;	info("Konica Webcam (rev. 0x%04x)", le16_to_cpu(dev->descriptor.bcdDevice));	RESTRICT_TO_RANGE(speed, 0, MAX_SPEED);	/* Validate found interface: must have one ISO endpoint */	nas = intf->num_altsetting;	if (nas != 8) {		err("Incorrect number of alternate settings (%d) for this camera!", nas);		return -ENODEV;	}	/* Validate all alternate settings */	for (ix=0; ix < nas; ix++) {		const struct usb_host_interface *interface;		const struct usb_endpoint_descriptor *endpoint;		interface = &intf->altsetting[ix];		i = interface->desc.bAlternateSetting;		if (interface->desc.bNumEndpoints != 2) {			err("Interface %d. has %u. endpoints!",			    interface->desc.bInterfaceNumber,			    (unsigned)(interface->desc.bNumEndpoints));			return -ENODEV;		}		endpoint = &interface->endpoint[1].desc;		DEBUG(1, "found endpoint: addr: 0x%2.2x maxps = 0x%4.4x",		    endpoint->bEndpointAddress, le16_to_cpu(endpoint->wMaxPacketSize));		if (video_ep == 0)			video_ep = endpoint->bEndpointAddress;		else if (video_ep != endpoint->bEndpointAddress) {			err("Alternate settings have different endpoint addresses!");			return -ENODEV;		}		if ((endpoint->bmAttributes & 0x03) != 0x01) {			err("Interface %d. has non-ISO endpoint!",			    interface->desc.bInterfaceNumber);			return -ENODEV;		}		if ((endpoint->bEndpointAddress & 0x80) == 0) {			err("Interface %d. has ISO OUT endpoint!",			    interface->desc.bInterfaceNumber);			return -ENODEV;		}		if (le16_to_cpu(endpoint->wMaxPacketSize) == 0) {			if (inactInterface < 0)				inactInterface = i;			else {				err("More than one inactive alt. setting!");				return -ENODEV;			}		} else {			if (i == spd_to_iface[speed]) {				/* This one is the requested one */				actInterface = i;			}		}		if (le16_to_cpu(endpoint->wMaxPacketSize) > maxPS)			maxPS = le16_to_cpu(endpoint->wMaxPacketSize);	}	if(actInterface == -1) {		err("Cant find required endpoint");		return -ENODEV;	}	DEBUG(1, "Selecting requested active setting=%d. maxPS=%d.", actInterface, maxPS);	uvd = usbvideo_AllocateDevice(cams);	if (uvd != NULL) {		struct konicawc *cam = (struct konicawc *)(uvd->user_data);		/* Here uvd is a fully allocated uvd object */		for(i = 0; i < USBVIDEO_NUMSBUF; i++) {			cam->sts_urb[i] = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);			if(cam->sts_urb[i] == NULL) {				while(i--) {					usb_free_urb(cam->sts_urb[i]);				}				err("can't allocate urbs");				return -ENOMEM;			}		}		cam->speed = speed;		RESTRICT_TO_RANGE(size, SIZE_160X120, SIZE_320X240);		cam->width = camera_sizes[size].width;		cam->height = camera_sizes[size].height;		cam->size = size;		uvd->flags = 0;		uvd->debug = debug;		uvd->dev = dev;		uvd->iface = intf->altsetting->desc.bInterfaceNumber;		uvd->ifaceAltInactive = inactInterface;		uvd->ifaceAltActive = actInterface;		uvd->video_endp = video_ep;		uvd->iso_packet_len = maxPS;		uvd->paletteBits = 1L << VIDEO_PALETTE_YUV420P;		uvd->defaultPalette = VIDEO_PALETTE_YUV420P;		uvd->canvas = VIDEOSIZE(320, 240);		uvd->videosize = VIDEOSIZE(cam->width, cam->height);		/* Initialize konicawc specific data */		konicawc_configure_video(uvd);		i = usbvideo_RegisterVideoDevice(uvd);		uvd->max_frame_size = (320 * 240 * 3)/2;		if (i != 0) {			err("usbvideo_RegisterVideoDevice() failed.");			uvd = NULL;		}#ifdef CONFIG_INPUT		/* Register input device for button */		memset(&cam->input, 0, sizeof(struct input_dev));		cam->input.name = "Konicawc snapshot button";		cam->input.private = cam;		cam->input.evbit[0] = BIT(EV_KEY);		cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0);		usb_to_input_id(dev, &cam->input.id);		input_register_device(&cam->input);				usb_make_path(dev, cam->input_physname, 56);		strcat(cam->input_physname, "/input0");		cam->input.phys = cam->input_physname;		info("konicawc: %s on %s\n", cam->input.name, cam->input.phys);#endif	}	if (uvd) {		usb_set_intfdata (intf, uvd);		return 0;	}	return -EIO;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/0259567ad60df13a55583b84d2cddb5526705907/konicawc.c/buggy/drivers/usb/media/konicawc.c