Putting a character in keyboard buffer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajakhurram
    New Member
    • Aug 2007
    • 3

    Putting a character in keyboard buffer

    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.
  • rajakhurram
    New Member
    • Aug 2007
    • 3

    #2
    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 ...


    Originally posted by Raja Khurram
    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.

    Comment

    • RRick
      Recognized Expert Contributor
      • Feb 2007
      • 463

      #3
      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.

      Comment

      • rajakhurram
        New Member
        • Aug 2007
        • 3

        #4
        Thats right. I am able to pick characters from serial port, but so far, unable to write them on keyboard buffer.

        Comment

        • RRick
          Recognized Expert Contributor
          • Feb 2007
          • 463

          #5
          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.

          Comment

          • svlsr2000
            Recognized Expert New Member
            • Feb 2007
            • 181

            #6
            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.

            Comment

            Working...