Mini2440 USB Keyboard Access

Chuck W5UXH
I have been working with a USB keyboard connected to the Mini2440. I
thought I needed to handle the /dev/input/event1 (the USB keyboard device)
input data myself and encode the key codes into ASCII and had made
reasonable progress doing this using stdout to display the resulting ASCII
characters in a terminal emulator.

I then started trying to write the characters to the LCD framebuffer and
found that there clearly is a driver somewhere handling the USB keyboard
input and displaying the characters on the LCD display. I need some
pointers to help me figure out how to access the input characters myself
and to control how (and if) they are displayed on the LCD panel. I need to
be able to implement a small scrolling section on the LCD instead of just
allowing the existing sequence where I have no control over the display.

I will paste the source for the test program at the end. The program opens
/dev/tty0 (which seems to be the LCD framebuffer and possibly somehow is
also the USB keyboard input?). The program then displays a one line
"prompt" and goes into an infinite loop doing nothing at all. While running
in this loop, any characters typed on the keys are displayed on the LCD.
Backspace works normally and the display scrolls normally.

I also uploaded a youtube "demo" that shows the behaviour as characters are
typed on the USB keyboard and magically appear on the LCD display. Not that
informative, and the loud key clicks as I type are distracting. There are a
few typos in the video. I could not see the LCD display while typing. 

I welcome any pointers to what is going on here since I have no clue how to
prevent this "automatic" sequence where any key press is passed to the LCD.
I need to be able to "intercept" the key presses and control the LCD
myself. 

My test program is based on examples from the ELLK Users Manual
(Intellimetrix, Doug Abbott), without which I would never have gotten even
this far in learning to work with the Mini2440.

Thanks,

Chuck
Las Cruces, NM

http://www.youtube.com/watch?v=PYvgzQgeUl8

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

int fd, fback;
char text[80];


int main (int argc, char *argv[])
{
 static const char onoff[] = {'0', '1'};

 // LCD_init();
 fback = open ("/dev/backlight", O_RDWR | O_SYNC);
 fd = open ("/dev/tty0", O_RDWR | O_SYNC);

 // LCD_erase (LCD_SCREEN);
 write (fd, "\x1b[2J", 4);

 // LCD_backlight (1);
 write (fback, &onoff[1], 1);

 // LCD_set_cursor (1,1);
 sprintf (text, "\x1b[%d;%dH", 1, 1);
 write (fd, text, strlen (text));

 // Display welcome text on LCD
 sprintf (text, "%s\n", "Type on the USB keyboard:");
 write (fd, text, strlen (text));

 while (1) {};

 exit(0);

}

Juergen Beisert
"/dev/tty0" is a TTY (a terminal emulation). So, you are talking to a TTY
emulation, not to the LCD framebuffer. The terminal emulation just uses the
LCD framebuffer as its output media. To change the behaviour you see, you
must change the TTY's settings.

Refer here for more keywords
http://www.lafn.org/~dave/linux/terminalIO.html -> Raw Mode

Chuck W5UXH
Hi Juergen,

Thanks for the reply.  I will follow the link you provided and see if I can
eventually climb up my steep learning curve!

Chuck

Chuck W5UXH
Juergen,

Quick note to let you know that I managed to learn enough about the termios
structure to control the echo ON/OFF, so your reply comment about changing
the settings helped me focus on where I needed to study.

Thanks again.

Chuck