adbhid[id]->input.id.version = ADB_KEYBOARD_UNKNOWN; 
input_dev->id.version = ADB_KEYBOARD_UNKNOWN; 
adbhid_input_register(int id, int default_id, int original_handler_id,		      int current_handler_id, int mouse_kind){	int i;	if (adbhid[id]) {		printk(KERN_ERR "Trying to reregister ADB HID on ID %d\n", id);		return;	}	if (!(adbhid[id] = kmalloc(sizeof(struct adbhid), GFP_KERNEL)))		return;	memset(adbhid[id], 0, sizeof(struct adbhid));	sprintf(adbhid[id]->phys, "adb%d:%d.%02x/input", id, default_id, original_handler_id);	init_input_dev(&adbhid[id]->input);	adbhid[id]->id = default_id;	adbhid[id]->original_handler_id = original_handler_id;	adbhid[id]->current_handler_id = current_handler_id;	adbhid[id]->mouse_kind = mouse_kind;	adbhid[id]->flags = 0;	adbhid[id]->input.private = adbhid[id];	adbhid[id]->input.name = adbhid[id]->name;	adbhid[id]->input.phys = adbhid[id]->phys;	adbhid[id]->input.id.bustype = BUS_ADB;	adbhid[id]->input.id.vendor = 0x0001;	adbhid[id]->input.id.product = (id << 12) | (default_id << 8) | original_handler_id;	adbhid[id]->input.id.version = 0x0100;	switch (default_id) {	case ADB_KEYBOARD:		if (!(adbhid[id]->keycode = kmalloc(sizeof(adb_to_linux_keycodes), GFP_KERNEL))) {			kfree(adbhid[id]);			return;		}		sprintf(adbhid[id]->name, "ADB keyboard");		memcpy(adbhid[id]->keycode, adb_to_linux_keycodes, sizeof(adb_to_linux_keycodes));		printk(KERN_INFO "Detected ADB keyboard, type ");		switch (original_handler_id) {		default:			printk("<unknown>.\n");			adbhid[id]->input.id.version = ADB_KEYBOARD_UNKNOWN;			break;		case 0x01: case 0x02: case 0x03: case 0x06: case 0x08:		case 0x0C: case 0x10: case 0x18: case 0x1B: case 0x1C:		case 0xC0: case 0xC3: case 0xC6:			printk("ANSI.\n");			adbhid[id]->input.id.version = ADB_KEYBOARD_ANSI;			break;		case 0x04: case 0x05: case 0x07: case 0x09: case 0x0D:		case 0x11: case 0x14: case 0x19: case 0x1D: case 0xC1:		case 0xC4: case 0xC7:			printk("ISO, swapping keys.\n");			adbhid[id]->input.id.version = ADB_KEYBOARD_ISO;			i = adbhid[id]->keycode[10];			adbhid[id]->keycode[10] = adbhid[id]->keycode[50];			adbhid[id]->keycode[50] = i;			break;		case 0x12: case 0x15: case 0x16: case 0x17: case 0x1A:		case 0x1E: case 0xC2: case 0xC5: case 0xC8: case 0xC9:			printk("JIS.\n");			adbhid[id]->input.id.version = ADB_KEYBOARD_JIS;			break;		}		for (i = 0; i < 128; i++)			if (adbhid[id]->keycode[i])				set_bit(adbhid[id]->keycode[i], adbhid[id]->input.keybit);		adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP);		adbhid[id]->input.ledbit[0] = BIT(LED_SCROLLL) | BIT(LED_CAPSL) | BIT(LED_NUML);		adbhid[id]->input.event = adbhid_kbd_event;		adbhid[id]->input.keycodemax = 127;		adbhid[id]->input.keycodesize = 1;		break;	case ADB_MOUSE:		sprintf(adbhid[id]->name, "ADB mouse");		adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);		adbhid[id]->input.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);		adbhid[id]->input.relbit[0] = BIT(REL_X) | BIT(REL_Y);		break;	case ADB_MISC:		switch (original_handler_id) {		case 0x02: /* Adjustable keyboard button device */			sprintf(adbhid[id]->name, "ADB adjustable keyboard buttons");			adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);			set_bit(KEY_SOUND, adbhid[id]->input.keybit);			set_bit(KEY_MUTE, adbhid[id]->input.keybit);			set_bit(KEY_VOLUMEUP, adbhid[id]->input.keybit);			set_bit(KEY_VOLUMEDOWN, adbhid[id]->input.keybit);			break;		case 0x1f: /* Powerbook button device */			sprintf(adbhid[id]->name, "ADB Powerbook buttons");			adbhid[id]->input.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);			set_bit(KEY_MUTE, adbhid[id]->input.keybit);			set_bit(KEY_VOLUMEUP, adbhid[id]->input.keybit);			set_bit(KEY_VOLUMEDOWN, adbhid[id]->input.keybit);			set_bit(KEY_BRIGHTNESSUP, adbhid[id]->input.keybit);			set_bit(KEY_BRIGHTNESSDOWN, adbhid[id]->input.keybit);			set_bit(KEY_EJECTCD, adbhid[id]->input.keybit);			set_bit(KEY_SWITCHVIDEOMODE, adbhid[id]->input.keybit);			set_bit(KEY_KBDILLUMTOGGLE, adbhid[id]->input.keybit);			set_bit(KEY_KBDILLUMDOWN, adbhid[id]->input.keybit);			set_bit(KEY_KBDILLUMUP, adbhid[id]->input.keybit);			break;		}		if (adbhid[id]->name[0])			break;		/* else fall through */	default:		printk(KERN_INFO "Trying to register unknown ADB device to input layer.\n");		kfree(adbhid[id]);		return;	}	adbhid[id]->input.keycode = adbhid[id]->keycode;	input_register_device(&adbhid[id]->input);	printk(KERN_INFO "input: %s on %s\n",	       adbhid[id]->name, adbhid[id]->phys);	if (default_id == ADB_KEYBOARD) {		/* HACK WARNING!! This should go away as soon there is an utility		 * to control that for event devices.		 */		adbhid[id]->input.rep[REP_DELAY] = 500;   /* input layer default: 250 */		adbhid[id]->input.rep[REP_PERIOD] = 66; /* input layer default: 33 */	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c7f7a569d9b4ea7c53ab6fcd1377895312d8372b/adbhid.c/clean/drivers/macintosh/adbhid.c