Reading /dev/input/eventx

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mikaelD
    New Member
    • Oct 2008
    • 8

    Reading /dev/input/eventx

    I'm currently trying to read the output from a BarCode scanner. It is recognized by the system as a keyboard and I can access to its output through one of the /dev/input/eventx file.
    The problem is that I don't understand the output and that I would like to know how to read it with a Java program.

    Thanks lot for help

    System :
    Mandriva Linux 2009.0
    Kernel : 2.6.27-desktop-0.rc8.2mnb
    JDK 1.6.0sun
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #2
    Hi!
    I think, this old thread should help - and if you don't know how to do what it says there, check this howto.

    Greetings,
    Nepomuk

    Comment

    • mikaelD
      New Member
      • Oct 2008
      • 8

      #3
      Thanks for your Answer.

      I had already found this old thread but what I really want to know is in which format is the information written in this "file".

      Moreover, as I see it, it does not really look like a normal file as what it contains changes according to what I type. So I think, it's going to be harder than just reading a normal file.

      Comment

      • Nepomuk
        Recognized Expert Specialist
        • Aug 2007
        • 3111

        #4
        Originally posted by mikaelD
        Thanks for your Answer.

        I had already found this old thread but what I really want to know is in which format is the information written in this "file".

        Moreover, as I see it, it does not really look like a normal file as what it contains changes according to what I type. So I think, it's going to be harder than just reading a normal file.
        Ah, now that's something different.

        The reading part of it shouldn't actually be the problem, that should work similar to how you read a normal file. The difficult part will be understanding the information, as you realised correctly. But for information on that, I guess you'll have to maybe check the scanners manual or search on Google for what type of output you'll be getting. It might even vary from model to model.

        Greetings,
        Nepomuk

        Comment

        • mikaelD
          New Member
          • Oct 2008
          • 8

          #5
          Thanks for answering.

          In fact, the problem should not be with the Device but with the /dev/input/eventx file. After much research, I found that it produces about 200 bytes for each keystrock eg for each number that the scanner reads. My problem is to interpret them.
          Here is an Example of what I get when I use the od command and read a simple 0001 BarCode

          Code:
          od -tx /dev/input/by-id/usb-PS2_to_USB_Ver_8D82_PS2_to_USB_Ver_8D82-event-kbd
          0000000 49097226 00016c75 00040004 000700e1
          0000020 49097226 00016c94 002a0001 00000001
          0000040 49097226 00016ca3 00000000 00000000
          0000060 49097226 00018bbd 00040004 00070027
          0000100 49097226 00018bda 000b0001 00000001
          Here a 0 is read
          0000120 49097226 00018be1 00000000 00000000
          0000140 49097226 0001aafe 00040004 00070027 
          0000160 49097226 0001ab1a 000b0001 00000000 
          0000200 49097226 0001ab22 00000000 00000000 
          0000220 49097226 0001ca35 00040004 000700e1 
          0000240 49097226 0001ca50 002a0001 00000000 
          0000260 49097226 0001ca5e 00000000 00000000 
          0000300 49097226 0001e977 00040004 000700e1 
          0000320 49097226 0001e997 002a0001 00000001 
          0000340 49097226 0001e9a6 00000000 00000000 
          0000360 49097226 000208b9 00040004 00070027 
          0000400 49097226 000208d6 000b0001 00000001 
          0000420 49097226 000208dd 00000000 00000000 
          0000440 49097226 0002280b 00040004 00070027 
          0000460 49097226 00022824 000b0001 00000000 
          0000500 49097226 0002282b 00000000 00000000 
          0000520 49097226 0002473b 00040004 000700e1 
          0000540 49097226 00024763 002a0001 00000000 
          0000560 49097226 00024773 00000000 00000000 
          0000600 49097226 00026665 00040004 000700e1 
          0000620 49097226 0002667e 002a0001 00000001 
          0000640 49097226 00026687 00000000 00000000 
          0000660 49097226 000285a3 00040004 00070027 
          0000700 49097226 000285b5 000b0001 00000001 
          0000720 49097226 000285b9 00000000 00000000 
          0000740 49097226 0002a4e5 00040004 00070027 
          0000760 49097226 0002a4f8 000b0001 00000000 
          0001000 49097226 0002a4fd 00000000 00000000 
          0001020 49097226 0002c41f 00040004 000700e1 
          0001040 49097226 0002c432 002a0001 00000000 
          0001060 49097226 0002c43a 00000000 00000000
          0001100 49097226 0002e364 00040004 000700e1
          0001120 49097226 0002e37c 002a0001 00000001
          0001140 49097226 0002e384 00000000 00000000
          Here a 00 is read
          0001160 49097226 000302bd 00040004 0007001e
          0001200 49097226 000302de 00020001 00000001
          0001220 49097226 000302e3 00000000 00000000
          Here a 1 is read
          0001240 49097226 000321fc 00040004 0007001e
          0001260 49097226 0003221a 00020001 00000000
          0001300 49097226 00032220 00000000 00000000
          0001320 49097226 00034134 00040004 000700e1
          0001340 49097226 00034152 002a0001 00000000
          0001360 49097226 0003415c 00000000 00000000
          0001400 49097226 0003607b 00040004 00070028
          0001420 49097226 0003609b 001c0001 00000001
          0001440 49097226 000360a0 00000000 00000000
          0001460 49097226 00037fbc 00040004 00070028
          0001500 49097226 00037fd5 001c0001 00000000
          0001520 49097226 00037fdb 00000000 00000000
          I addded information about what was read.

          Clearly, the first column is a indication of time, the second one does not vary so it does not seem important.

          Thanks for help

          Comment

          • mikaelD
            New Member
            • Oct 2008
            • 8

            #6
            I'm still looking for a solution

            I found a few keylogger for linux among which POC Keylogger but I have to admin that I don't understand the source code. The time I knew how to code in C is long past.

            Comment

            Working...