i need to send an HEX String to the ps/2 port.
i have a special keyboard connected to the ps/2 port and i want to
send it
some stuff to control his tone indicator.
using c or c++ in linux os. how can i do?
If the port is mapped into the filesystem namespace somehow,
you can fopen() the appropriate filename, and you can
fwrite() or fprintf() any data you want. fprintf() with a %02x format
might be easier than fwrite(), but it depends on how you are building
the string.
That's the limit of what you can do using the standard C libraries.
In practice, it -probably- will not be enough, and you will
-probably- have to use operating-system specific extensions.
Specifically, you will probably have to set the I/O rate
("baud rate") and you may have to set other characteristics as well,
such as indicating that you want "raw" data transfers, and setting
the size of characters and the number of stop bits. The means for
setting particular device characteristics are not part of the C
standard library. Likely, you could use the facilities provided
by POSIX.1 to handle those device conditioning operations.
To start you on your way, I will point you to the POSIX.1 functions
(not part of C itself) tcsetattr() and tcgetattr().