473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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
Oct 29 '08 #1
5 8819
Nepomuk
3,112 Expert 2GB
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
Oct 29 '08 #2
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.
Oct 29 '08 #3
Nepomuk
3,112 Expert 2GB
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
Oct 29 '08 #4
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

Expand|Select|Wrap|Line Numbers
  1. od -tx /dev/input/by-id/usb-PS2_to_USB_Ver_8D82_PS2_to_USB_Ver_8D82-event-kbd
  2. 0000000 49097226 00016c75 00040004 000700e1
  3. 0000020 49097226 00016c94 002a0001 00000001
  4. 0000040 49097226 00016ca3 00000000 00000000
  5. 0000060 49097226 00018bbd 00040004 00070027
  6. 0000100 49097226 00018bda 000b0001 00000001
  7. Here a 0 is read
  8. 0000120 49097226 00018be1 00000000 00000000
  9. 0000140 49097226 0001aafe 00040004 00070027 
  10. 0000160 49097226 0001ab1a 000b0001 00000000 
  11. 0000200 49097226 0001ab22 00000000 00000000 
  12. 0000220 49097226 0001ca35 00040004 000700e1 
  13. 0000240 49097226 0001ca50 002a0001 00000000 
  14. 0000260 49097226 0001ca5e 00000000 00000000 
  15. 0000300 49097226 0001e977 00040004 000700e1 
  16. 0000320 49097226 0001e997 002a0001 00000001 
  17. 0000340 49097226 0001e9a6 00000000 00000000 
  18. 0000360 49097226 000208b9 00040004 00070027 
  19. 0000400 49097226 000208d6 000b0001 00000001 
  20. 0000420 49097226 000208dd 00000000 00000000 
  21. 0000440 49097226 0002280b 00040004 00070027 
  22. 0000460 49097226 00022824 000b0001 00000000 
  23. 0000500 49097226 0002282b 00000000 00000000 
  24. 0000520 49097226 0002473b 00040004 000700e1 
  25. 0000540 49097226 00024763 002a0001 00000000 
  26. 0000560 49097226 00024773 00000000 00000000 
  27. 0000600 49097226 00026665 00040004 000700e1 
  28. 0000620 49097226 0002667e 002a0001 00000001 
  29. 0000640 49097226 00026687 00000000 00000000 
  30. 0000660 49097226 000285a3 00040004 00070027 
  31. 0000700 49097226 000285b5 000b0001 00000001 
  32. 0000720 49097226 000285b9 00000000 00000000 
  33. 0000740 49097226 0002a4e5 00040004 00070027 
  34. 0000760 49097226 0002a4f8 000b0001 00000000 
  35. 0001000 49097226 0002a4fd 00000000 00000000 
  36. 0001020 49097226 0002c41f 00040004 000700e1 
  37. 0001040 49097226 0002c432 002a0001 00000000 
  38. 0001060 49097226 0002c43a 00000000 00000000
  39. 0001100 49097226 0002e364 00040004 000700e1
  40. 0001120 49097226 0002e37c 002a0001 00000001
  41. 0001140 49097226 0002e384 00000000 00000000
  42. Here a 00 is read
  43. 0001160 49097226 000302bd 00040004 0007001e
  44. 0001200 49097226 000302de 00020001 00000001
  45. 0001220 49097226 000302e3 00000000 00000000
  46. Here a 1 is read
  47. 0001240 49097226 000321fc 00040004 0007001e
  48. 0001260 49097226 0003221a 00020001 00000000
  49. 0001300 49097226 00032220 00000000 00000000
  50. 0001320 49097226 00034134 00040004 000700e1
  51. 0001340 49097226 00034152 002a0001 00000000
  52. 0001360 49097226 0003415c 00000000 00000000
  53. 0001400 49097226 0003607b 00040004 00070028
  54. 0001420 49097226 0003609b 001c0001 00000001
  55. 0001440 49097226 000360a0 00000000 00000000
  56. 0001460 49097226 00037fbc 00040004 00070028
  57. 0001500 49097226 00037fd5 001c0001 00000000
  58. 0001520 49097226 00037fdb 00000000 00000000
  59.  
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
Oct 30 '08 #5
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.
Nov 3 '08 #6

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

Similar topics

1
by: fabrice | last post by:
Hello, I've got trouble reading a text file (event viewer dump) by using the getline() function... After 200 - 300 lines that are read correctly, it suddenly stops reading the rest of the...
12
by: Anna | last post by:
Hi all, I posted the same question this afternoon but my message isn't showing up, so I thought I'd give it another try.... in case you should see it later I apologize for posting the same...
18
by: Michael | last post by:
Hi, I moved to c++ from c, and wanted to know what the best way to read data from files is in c++. Any thoughts? fscanf() is possible but fairly painful! Regards Michael
3
by: SB | last post by:
Hello. I have an input file which is laid out in the following manner... Name Day 1 am time 1 am time 2 appointment pm time 1 pm time 2 appointment Day 2
3
by: Max | last post by:
Yea this is probably a n00b question, but I haven't programmed C++ in at least 2 years and have never programmed for unix, sorry :) Anyway, I have a project in which a program is required to read...
8
by: dbuser | last post by:
Hi, I need help on a problem, as described below. I am reading a file "input.txt"which has data like this: abc def gh izk lmnopq rst uvwxyz I am using fstream object to read the file and...
40
by: googler | last post by:
I'm trying to read from an input text file and print it out. I can do this by reading each character, but I want to implement it in a more efficient way. So I thought my program should read one...
21
by: Stephen.Schoenberger | last post by:
Hello, My C is a bit rusty (.NET programmer normally but need to do this in C) and I need to read in a text file that is setup as a table. The general form of the file is 00000000 USNIST00Z...
6
by: efrenba | last post by:
Hi, I came from delphi world and now I'm doing my first steps in C++. I'm using C++builder because its ide is like delphi although I'm trying to avoid the vcl. I need to insert new features...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.