By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,529 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,529 IT Pros & Developers. It's quick & easy.

Putting a character in keyboard buffer

P: 3
Hi,

Can someone plz tell me the name of the function, which can put characters in keyboard buffer using C. The platform is Linux (Red Hat 9).

What I need to accomplish is: to read characters from serial port and put them in keyboard buffer

Many thanks in advance.
Aug 6 '07 #1
Share this Question
Share on Google+
5 Replies


P: 3
The function I've found so far is: SendInput
http://msdn2.microsoft.com/en-us/library/ms646310.aspx

But the problem is, it is a WINAPI function :(

Still lookin' for Posix C function ...


Hi,

Can someone plz tell me the name of the function, which can put characters in keyboard buffer using C. The platform is Linux (Red Hat 9).

What I need to accomplish is: to read characters from serial port and put them in keyboard buffer

Many thanks in advance.
Aug 10 '07 #2

RRick
Expert 100+
P: 463
In Linux the serial ports are attached to devices with names like: /dev/ttySx where x=0...n. You should be able to treat the device name just like a file name (i.e. "/dev/ttyS0") and use any/most of the C/C++ routines. Things like seek usually don't work with serial ports, but open and read should work fine.

That's the theory, at least, since I've haven't tried it my self. On my linux box I have 8 (0 .. 7) devices, so you're going to have to figure out which one you're using.
Aug 10 '07 #3

P: 3
Thats right. I am able to pick characters from serial port, but so far, unable to write them on keyboard buffer.
Aug 20 '07 #4

RRick
Expert 100+
P: 463
What do you mean by keyboard buffer? Are you talking about the input channels (i.e stdin, cin) to a program? A console window? Do you want to spoof the keyboard with other values?

The reason I ask is because the keyboard buffer/values are usually passed to different programs/shells by the window manager.
Aug 20 '07 #5

Expert 100+
P: 181
have a look at how key board loggers work in linux. you just need to do reverse of that. or else u need to have a psuedo driver in place. Its something similiar to have a ssh connection to pc. I think if you have look at ssh and keyboard loggers would help you alot.
Aug 21 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.