none
如何将自制的键盘值传送给内核 RRS feed

  • 问题

  • 自制4×5键盘,按键值通过中断得到,已经编写成dll,同过上层程序调用,但是不知如何把按键值传递给程序。

     

    DWORD KBInit(unsigned char*value)
    {
         HANDLE ent0IST;
       ent0IST=CreateThread(0,0,(LPTHREAD_START_ROUTINE)IRQThread,0,CREATE_SUSPENDED,NULL);
        if(ent0IST==0)
     {
             RETAILMSG(1, (TEXT("::: CreateThread() Fail\r\n")));
     }
     CeSetThreadPriority(ent0IST,120);
     ResumeThread(ent0IST);
       while(1){Sleep(100);}
     return 0;
    }

    void IRQThread()
    {
        RETAILMSG(1,(TEXT("My IRQ is begin!\n")));
        RETAILMSG(1, (TEXT("::: helllo\r\n")));
           int dwIrq=36;
       EINT0init();
       initKbdIOPort();
        g_ENT0interrupt=CreateEvent(NULL,FALSE,FALSE,NULL);
     if(g_ENT0interrupt==NULL)
     {
           RETAILMSG(1, (TEXT("create event failling\r\n")));

     }
     if(!SetEvent(g_ENT0interrupt))
     {
           RETAILMSG(1, (TEXT("set event failling\r\n")));
     
     }
        KernelIoControl(IOCTL_HAL_TRANSLATE_IRQ,&dwIrq,sizeof(dwIrq),&g_dwSysInt,sizeof(g_dwSysInt),NULL);
      RETAILMSG( 1,(TEXT("%d\r\n"),g_dwSysInt));
         if (!(InterruptInitialize(g_dwSysInt,g_ENT0interrupt,NULL,0)))
     {
      RETAILMSG(1, (TEXT("InterruptInitialize failling\r\n")));

     }
     while(1)
     {
         if( WaitForSingleObject(g_ENT0interrupt,INFINITE)==WAIT_OBJECT_0)
      {
         submask=KbValue();          //读取按键值,如何将submask的值传递给上层程序???????
            RETAILMSG(1, (TEXT("%x \n"),submask));
      InterruptDone(g_dwSysInt );
      }
      RETAILMSG(1, (TEXT("333333333333333333333\r\n")));
     }
    }

    submask=KbValue();          //读取按键值,如何将submask的值传递给上层程序???????
    2007年12月15日 6:38

答案