Sponsored Content
Full Discussion: How to subdue the keyboard?
Top Forums Shell Programming and Scripting How to subdue the keyboard? Post 302946371 by Don Cragun on Monday 8th of June 2015 08:16:18 PM
Old 06-08-2015
If I understand what you're trying to do, what you want is to get the time elapsed between when a key was pressed and when that key was released so you can determine whether the operator held the key for a short time (dot) or a long time (dash). That is something that the keyboard driver would know, but I don't know of any portable interface that will make that information available to a shell script. The keyboard driver probably also ignores very short duration presses and releases (key bounce) which may be a problem if you can get raw access to keyboard events somehow in a C program or shell script.

With my current keyboard driver settings (which on OS X are settable in the keyboard section of the system preferences app; but not by the stty utility) for key press repeat and time between repeated characters, I can easily manually press and release a about 7 characters/second. And, if I hold a key down for a while, it will generate about 14 characters/second. Trying to detect whether I tried to input two dashes or two (or three) dots or a dot and a dash (in either order) using a .5 second timer isn't likely to work.

If you are using an X application and can turn off key repeat using shell commands (as Chubbier_XL suggested), you still won't know whether a key press was intended to be a dot or a dash.
This User Gave Thanks to Don Cragun For This Post:
 

7 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How can I map Unix keyboard for PC keyboard

A Solaris AXI 440 machine with Solaris 8 version. I have PC users who use an emulation to login to the Solaris server. How can I change the keyboard mapping of the Sun keyboard to fit to the PC keyboard ? Any comment will be appreciated. Thanks (1 Reply)
Discussion started by: simhab
1 Replies

2. SCO

Kill from keyboard

I have a cron job that creates my backup tape. However my commands in this job are timing out, therefore "Retrying job retry" is the loop it is hung into. I cannot telnet to the box nor get a login prompt. What is the kill command keystone stroke sequence that will break a cron job? Thanks, (3 Replies)
Discussion started by: jwideman
3 Replies

3. Linux

mdk 10.2 and keyboard

Hi all, I'm running a mdk 10.2 cooker on my computer. After and update, i've lost the "alt gr" key. How am i supposed to get it back? I've already googled around a bit, testing solutions provided, but nothing can help.. any other suggestions? Thanx all Jason (3 Replies)
Discussion started by: penguin-friend
3 Replies

4. UNIX for Dummies Questions & Answers

Keyboard keeps locking up

First off, let me start by saying that I am a total rookie when it comes to Unix so I will do my best to explain the situation. BACKGROUND:We are running AIX and using a third party Inventory Management software called Acclaim. My main interface terminal is just a "dummy" terminal hooked up to... (1 Reply)
Discussion started by: sstaszak11
1 Replies

5. Solaris

Keyboard problem

Hi to everyone I am new at Solaris world so I need little help. I can not put my keyboard to Croatian layout. I tried to edit /etc/default/init and in that file I changed LC_ALL=hr_HR. Also I tried to change my language settings over GUI (input methods and SCIIM) but with no results. Also tried... (11 Replies)
Discussion started by: microbot
11 Replies

6. What is on Your Mind?

Keyboard vs mouse

Which Input device do you use the most ? for me... keyboard ofcourse !! (56 Replies)
Discussion started by: vpraveen84
56 Replies

7. UNIX for Dummies Questions & Answers

Problem getting vertical bar with British keyboard layout on US (physical) keyboard

Hi, I've got a bit of a ridiculous problem and wasn't sure where to post it. I need to use the vertical bar for piping in Bash but, as per the title, am using a UK layout on a US (physical) keyboard which doesn't have a key for it in the place I'd expect. I've tried using xbindkeys and Unicode... (7 Replies)
Discussion started by: crunchgargoyle
7 Replies
glutKeyboardUpFunc(3GLUT)					       GLUT						 glutKeyboardUpFunc(3GLUT)

NAME
glutKeyboardUpFunc - sets the keyboard up (key release) callback for the current window. SYNTAX
void glutKeyboardUpFunc(void (*func)(unsigned char key, int x, int y)); ARGUMENTS
func The new keyboard up callback function. DESCRIPTION
glutKeyboardFunc sets the keyboard up (key release) callback for the current window. When a user types into the window, each key release matching an ASCII character will generate a keyboard up callback. The key callback parameter is the generated ASCII character. The state of modifier keys such as Shift cannot be determined directly; their only effect will be on the returned ASCII data. The x and y callback parameters indicate the mouse location in window relative coordinates when the key was pressed. When a new window is created, no keyboard callback is initially registered, and ASCII key strokes in the window are ignored. Passing NULL to glutKeyboardFunc disables the generation of keyboard callbacks. During a keyboard up callback, glutGetModifiers may be called to determine the state of modifier keys when the keystroke generating the callback occurred. To avoid the reporting of key release/press pairs due to auto repeat, use glutIgnoreKeyRepeat to ignore auto repeated keystrokes. There is no guarantee that the keyboard press callback will match the exact ASCII character as the keyboard up callback. For example, the key down may be for a lowercase b, but the key release may report an uppercase B if the shift state has changed. The same applies to sym- bols and control characters. The precise behavior is window system dependent. Use glutSpecialUpFunc for a means to detect non-ASCII key releases. SEE ALSO
glutKeyboardFunc, glutSpecialUpFunc, glutSpecialFunc, glutCreateWindow, glutMouseFunc, glutSpaceballButtonFunc, glutButtonBoxFunc, glut- TabletButtonFunc, glutGetModifiers, glutIgnoreKeyRepeat AUTHOR
Mark J. Kilgard (mjk@nvidia.com) GLUT
3.7 glutKeyboardUpFunc(3GLUT)
All times are GMT -4. The time now is 02:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy