Communication with keyboard with PS2 display

Asked

Viewed 80 times

1

I need to develop communication with the display of a keyboard (44key keytec mark) using windows.

In C, for linux, using #include , the inb() and outb() functions works correctly.

For windows, the closest I got was to find the inpout32.dll, but no success so far.

Example of tested code:

#include <stdio.h>
#include <conio.h>
#include <windows.h>


/* Definitions in the build of inpout32.dll are:            */
/*   short _stdcall Inp32(short PortAddress);               */
/*   void _stdcall Out32(short PortAddress, short data);    */


/* prototype (function typedef) for DLL function Inp32: */

typedef short _stdcall (*inpfuncPtr)(short portaddr);
typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum);

void TxKbd(char dado, inpfuncPtr inp32, oupfuncPtr oup32);
void vDispStr(char *s, inpfuncPtr inp32, oupfuncPtr oup32);

int main(void)
{
     HINSTANCE hLib;
     inpfuncPtr inp32;
     oupfuncPtr oup32;

     char dado[81] = "";

     short x;
     int i;

     /* Load the library */
     hLib = LoadLibrary("inpout32.dll");

     if (hLib == NULL) {
          printf("LoadLibrary Failed.\n");
          return -1;
     }

     /* get the address of the function */

     inp32 = (inpfuncPtr) GetProcAddress(hLib, "Inp32");

    printf("1");

     if (inp32 == NULL) {
          printf("GetProcAddress for Inp32 Failed.\n");
          return -1;
     }

    printf("2");

     oup32 = (oupfuncPtr) GetProcAddress(hLib, "Out32");

     if (oup32 == NULL) {
          printf("GetProcAddress for Oup32 Failed.\n");
          return -1;
     }


    printf("3\n");
    //while (0){ SEMPRE RETORNA 0x64
    //   printf( "digitando %i", (inp32)(0x64) );
    //   
    //   sleep(2);
//  }

    oup32(0x60, 40);
}

Someone had to do something like this?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.