LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-18-2009, 02:20 PM   #1
v333k
Member
 
Registered: Apr 2004
Location: 127.0.0.1
Posts: 38

Rep: Reputation: 15
USB keyboard - Capture key strokes/input


Hi everyone,
I have this weird experiment I would like to do.
I am running Ubuntu 9.04 and I would like to run this little experiment.

Can anyone tell me where do USB keyboards mount themselves or get initialized (a brief explanation will be great)?

How can I capture key strokes without using the standard IO libraries in C language or whichever way it is done in bash script?

For example:
I would like to connect two USB keyboards to my system, and I would like to write a small script that will only accept a specific keyboard's input. Therefore, using standard in will not quite do it for me.

Thanks in advance!
 
Old 10-19-2009, 12:34 PM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Sometimes people ask a question that's the "wrong" question for the solution to the problem they are trying to solve. So it is very difficult to answer.

What we'd like to know is: "What, exactly, are you trying to achieve?". Tell us the scenario, not why you are trying "only accept a specific keyboard's input."

Then, maybe, we can give you a simple answer.
 
Old 10-19-2009, 01:44 PM   #3
v333k
Member
 
Registered: Apr 2004
Location: 127.0.0.1
Posts: 38

Original Poster
Rep: Reputation: 15
thank you tredegar,
Here is what I am trying to do. I'll put it in simpler terms as well as the exact senario I am working to acheive.

I plugged my USB keyboard into the Ubuntu system, and when I type the follow command (dmesg | tail) I get the following:


root@ubuntu:~# dmesg | tail
sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
eth0: link up, 10 Mb/s, half duplex, flow control disabled
NET: Registered protocol family 10
eth0: no IPv6 routers present
usb 1-1: USB disconnect, address 2
usb 1-1: new low speed USB device using orion-ehci and address 3
usb 1-1: configuration #1 chosen from 1 choice
input: DELL DELL USB Keyboard as /devices/platform/orion-ehci.0/usb1/1-1/1-1:1.0/input/input0
generic-usb 0003:413C:2005.0001: input: USB HID v1.10 Keyboard [DELL DELL USB Keyboard] on usb-orion
-ehci.0-1/input0
root@ubuntu:~#


I would like to write some C program or script that will listen to this input specifically (input0).

I know that in C, I can write a simple scanf() statement, but I would like to be able to specify the input instead (input0) - no dependency on standard IO in C.

Is this doable?

I hope this makes my question clearer.
 
  


Reply



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
Capturing Keystrokes in linux. APIs or System calls to capture keyboard strokes abhinav.zoso Programming 3 01-10-2009 11:14 AM
Midnight Commander requires twice the key-strokes jsmith6 Slackware 13 05-19-2006 03:47 PM
problem recognising key strokes himateja Programming 3 05-27-2005 05:54 AM
Identifying and Mapping/Binding key strokes mikeyt_333 Linux - General 3 10-02-2003 10:42 PM
Repeating key strokes toxic53 Linux - General 1 12-11-2002 09:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:53 AM.

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