LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-19-2008, 09:57 PM   #1
kevin123
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Rep: Reputation: 0
how to access usb data in linux 2.4


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.
 
Old 04-20-2008, 08:30 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,669

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
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.
 
Old 04-20-2008, 02:31 PM   #3
kevin123
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Original Poster
Rep: Reputation: 0
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.
 
Old 04-20-2008, 05:18 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,669

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
Quote:
input: USB HID RFIDea Keyboard on usb1:2.0
Appears to be a normal message.

Quote:
usb_control/bulk_msg: timeout
Could be a problem.

Does the RFID reader work at all?

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.

Last edited by michaelk; 04-20-2008 at 05:22 PM.
 
Old 04-20-2008, 11:43 PM   #5
kevin123
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Original Poster
Rep: Reputation: 0
yea, I tried the RFID reader on a window xp machine and pc with linux installed, they both work.
 
Old 04-21-2008, 06:49 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,669

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
To elaborate it works on a x86 linux PC but not the SBC?
 
Old 04-21-2008, 06:36 PM   #7
kevin123
LQ Newbie
 
Registered: Apr 2008
Posts: 4

Original Poster
Rep: Reputation: 0
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.

Last edited by kevin123; 04-21-2008 at 09:05 PM.
 
Old 04-22-2008, 06:11 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,669

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
I would contact Technologic Systems for help.
 
Old 04-22-2008, 10:27 AM   #9
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux application to access Garmin Forerunner 305 data jonbvgood Linux - Software 1 09-23-2007 03:54 PM
DISCUSSION: Moving MS Access Data to Linux rickh LinuxAnswers Discussion 0 03-04-2006 12:21 PM
USB data link cables that work with linux? Norman2 Linux - Hardware 1 08-15-2005 05:50 PM
Porting MS Access data to Linux doulos05 Linux - Software 8 05-10-2005 11:04 PM
USB LexarMedia 32MB Data-Key + KDE 3.2=USB/HD Access problems that_guy Slackware 0 02-03-2005 08:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration