LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-02-2017, 08:48 AM   #1
cristian.barbarosie
LQ Newbie
 
Registered: Jan 2017
Location: Portugal
Distribution: archlinux
Posts: 17

Rep: Reputation: Disabled
Post character input in linux console


Hello everybody,
This is not really a question. Rather, I want to share with you my quest for understanding how the character input travels from the physical keyboard to the software waiting for input. I emphasise on the text editor emacs.
Comments, corrections and suggestions are welcome.

Last edited by cristian.barbarosie; 02-02-2017 at 08:50 AM. Reason: tiny typo
 
Old 02-02-2017, 09:01 AM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Nice, seems that you glossed over the hardware aspect with this line "When a human presses a key, some codes are sent to the linux kernel, of which the console driver is a part." The article is interesting though - good job.

You can gain some understanding of the logic device, clock and ASCII with an explanation like this:

https://eewiki.net/pages/viewpage.ac...ageId=28279002

It makes a good introduction for your paper.
 
Old 02-07-2017, 03:11 PM   #3
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Rep: Reputation: 255Reputation: 255Reputation: 255
this will show code key into your termianl

Code:

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>                  /*  for sleep()  */
#include <curses.h>


int main(void) {

    WINDOW * mainwin;

    
    /*  Initialize ncurses  */

    if ( (mainwin = initscr()) == NULL ) {
	fprintf(stderr, "Error initialising ncurses.\n");
	exit(EXIT_FAILURE);
    }


    /*  Display "Hello, world!" in the centre of the
	screen, call refresh() to show our changes, and
	sleep() for a few seconds to get the full screen effect  */

    mvaddstr(1, 33, "Hello, world!");
    mvaddstr(2, 33, "Press Key!");
    refresh();
    int kepr = getch(); 

    mvaddstr(5, 33, "Key Pressed: %d", kepr );
    getch(); 
    /*  Clean up after ourselves  */

    delwin(mainwin);
    endwin();
    refresh();

    return EXIT_SUCCESS;
}
 
Old 02-09-2017, 02:58 PM   #4
cristian.barbarosie
LQ Newbie
 
Registered: Jan 2017
Location: Portugal
Distribution: archlinux
Posts: 17

Original Poster
Rep: Reputation: Disabled
hmmm ...

Quote:
Originally Posted by Xeratul View Post
this will show code key into your termianl
This is basically what showkey does, right ?
 
  


Reply

Tags
character, console, input, keymap



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
Why chinese character can't input and display on debian terminal console? luofeiyu Linux - Newbie 1 08-26-2016 04:29 PM
[SOLVED] get the character at a given position in a linux console application in C++ irancplusplus Programming 1 09-04-2013 01:50 PM
Cannot input password on the linux console swaroopkml Linux - General 3 05-07-2012 08:23 AM
input of a character from console without pressing enter Bonny Programming 8 10-28-2008 04:50 PM
How to Input Japanese character? ubyt3m3 Slackware 4 05-06-2008 10:24 PM

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

All times are GMT -5. The time now is 04:19 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