ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, I'm very new to Linux and a beginner in C programing. Currently I am trying to write a program for an RFID reader that connects to a USB port. The RFID reader acts as an keyboard input in that whatever is scanned is displayed as if it is typed on the keyboard. I have currently written a C code that picks up the data read in by the RFID reader. I ran this code on windowxp system and it works fine, the code executes in the cmd window and displays the numbers read in by the RFID reader. However, the problem is that I am writing this code to work for a embedded single board computer(SBC) (TS-7250). The board runs on a Linux 2.4 OS and only has terminal interface , no GUI. There is no vga output so the only way to input commands to the SBC is through the hyper terminal or telnet. Here is the problem (the reader is connected to the SBC now), when I try to program through the hyperterminal or telnet, the program doesn't know to actually get the data from the reader but expects input from the computer I am run hyperterminal or telnet from. Can anyone provide me with a solution to this? Any help would be greatly appreciately, thanks in advance.
From the manual you can connect a USB mouse and keyboard so you should be able to use your RFID reader. Look at the TS-ARM users guide for the particular modules that are required or contact Technologic Systems for help.
BTW depending on what functions/API you used in your windows code may not be directly portable to linux.
I've loaded all the usb, hid, and keyboard modules according to the manual they've provided. I added lines to the init.d file so that it will auto load the modules during start up. One thing I forgot to mention in the previous post is that I get a message like this when loading the modules:
usb_control/bulk_msg: timeout
input: USB HID RFIDea Keyboard on usb1:2.0
Do you know what that means?
Also does anyone know how to write a C program that can read data straight from the usb port? Thanks in advance.
For a good starting point look at http://www.linux-usb.org/ A generic library (libhid) exists however I do not know if it is directly portable to the ARM.
The program, if ran from a regular (ubuntu) linux pc or winxp pc, would work perfectly. The RFID reader is plugged into the pc in both of these cases, and the program is ran directly from the pc's. However, since the single board computer doesn't have a vga output, it is required that I use telnet or hyperterminal to access the sbc then run the program from there. However when I do it this way, the program doesn't pick up the input from the RFID reader that is connected to the single board but instead looks for input from the other PC.
The RFID reader functions like a keyboard, so whatever is read is outputted into the current window/console that is being used. (i.e if notepad is focused, the output would be displayed in notepad) So I think the problem is when the program is ran through telnet or hyperterminal, the data is read, however not to the right place and I have no idea of how to fix this. I've been reading stuff around the net to find a solution with no success.
Hope that clarifies my question Thanks in advance.
I am in no way acquainted with the device you are using, however it sounds to me that you have seized upon the essence of the problem. When you use a local console, you are using 'real' devices; the local keyboard, monitor and pointing device. Logging in through a telnet or ssh session creates a virtual (pseudo) terminal, hence the names like /dev/pts0, /dev/pts1... Your HID device(s) should be accessible through the device file /dev/console, I think. Perhaps you can achieve what you want to do by writing some code to read/write/ioctl the console device. Or perhaps your driver(s) have created a new device file. If so, you may be able to access the hardware through that interface.
Hope this makes sense. Maybe someone more intimately familiar with the device & drivers can expand on the concept.
--- rod.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.