Beispiel #1
0
void wii_mouse_init()
{
	if (!mouse_initialized) {

		if (!mousequeue) {
			mousequeue = (lwp_queue*)malloc(sizeof(lwp_queue));	
			__lwp_queue_initialize(mousequeue,0,0,0);
		}
		
		if (wii_find_mouse()!=0) return;

		if (USB_OpenDevice("oh0",mouse_vid,mouse_pid,&mousefd)<0) {
			return;
		}
		if (!mousedata) {
			mousedata = (signed char*)memalign(32, 20);
		}
		
		//set boot protocol
		USB_WriteCtrlMsg(mousefd,USB_REQTYPE_SET,USB_REQ_SETPROTOCOL,0,0,0,0);
		USB_ReadIntrMsgAsync(mousefd, 0x81 ,4, mousedata, mousecallback, 0);

		mouse_initialized  = 1;
	} 
}
Beispiel #2
0
void wii_keyboard_init()
{
	if (!keyboard_initialized) {
		//printf("init keyboard");
		initkeymap();
		queue = (lwp_queue*)malloc(sizeof(lwp_queue));	
		__lwp_queue_initialize(queue,0,0,0);
		keyboard_kb=IOS_Open("/dev/usb/kbd", 1);
		/*
		if (keyboard_kb>=0) {
			printf("keyboard kb ok\n");
		} else{
			printf("keyboard kb not ok\n");
			}*/
		sleep(2);
		key_data.message=0x0;
		key_data1.id=0;
		key_data2.id=0;
		keyboard_stop = 0;
		if(keyboard_kb>=0) 
			IOS_IoctlAsync(keyboard_kb,1,(void *) &key_data, 16,(void *) &key_data, 16, keyboard_callback, NULL);
		keyboard_initialized  = 1;
	} else {
		if(keyboard_kb>=0) 
			IOS_IoctlAsync(keyboard_kb,1,(void *) &key_data, 16,(void *) &key_data, 16, keyboard_callback, NULL);

	}
}
Beispiel #3
0
static void __exi_initmap(exibus_priv *exim)
{
	s32 i;
	exibus_priv *m;

	__lwp_queue_initialize(&_lckdev_queue,lckdevs,EXI_LOCK_DEVS,sizeof(struct _lck_dev));
	
	for(i=0;i<EXI_MAX_CHANNELS;i++) {
		m = &exim[i];
		m->CallbackEXI = NULL;
		m->CallbackEXT = NULL;
		m->CallbackTC = NULL;
		m->imm_buff = NULL;
		m->exi_id = 0;
		m->exi_idtime = 0;
		m->flags = 0;
		m->imm_len = 0;
		m->lck_cnt = 0;
		m->lockeddev = 0;
		m->lckd_dev_bits = 0;
		__lwp_queue_init_empty(&m->lckd_dev);
	}
}